@@ -11,7 +11,15 @@ const eslintDeps = eslintTemplatePackage.devDependencies
11
11
12
12
export default function renderEslint (
13
13
rootDir ,
14
- { needsTypeScript, needsVitest, needsCypress, needsCypressCT, needsPrettier, needsPlaywright } ,
14
+ {
15
+ needsTypeScript,
16
+ needsVitest,
17
+ needsCypress,
18
+ needsCypressCT,
19
+ needsOxlint,
20
+ needsPrettier,
21
+ needsPlaywright,
22
+ } ,
15
23
) {
16
24
const additionalConfigs = getAdditionalConfigs ( {
17
25
needsVitest,
@@ -23,32 +31,20 @@ export default function renderEslint(
23
31
const { pkg, files } = createESLintConfig ( {
24
32
styleGuide : 'default' ,
25
33
hasTypeScript : needsTypeScript ,
34
+ needsOxlint,
35
+ // Theoretically, we could add Prettier without requring ESLint.
36
+ // But it doesn't seem to be a good practice, so we just let createESLintConfig handle it.
26
37
needsPrettier,
27
-
28
38
additionalConfigs,
29
39
} )
30
40
31
- const scripts : Record < string , string > = {
32
- lint : 'eslint . --fix' ,
33
- }
34
-
35
- // Theoretically, we could add Prettier without requring ESLint.
36
- // But it doesn't seem to be a good practice, so we just leave it here.
37
- if ( needsPrettier ) {
38
- // Default to only format the `src/` directory to avoid too much noise, and
39
- // the need for a `.prettierignore` file.
40
- // Users can still append any paths they'd like to format to the command,
41
- // e.g. `npm run format cypress/`.
42
- scripts . format = 'prettier --write src/'
43
- }
44
-
45
41
// update package.json
46
42
const packageJsonPath = path . resolve ( rootDir , 'package.json' )
47
43
const existingPkg = JSON . parse ( fs . readFileSync ( packageJsonPath , 'utf8' ) )
48
- const updatedPkg = sortDependencies ( deepMerge ( deepMerge ( existingPkg , pkg ) , { scripts } ) )
44
+ const updatedPkg = sortDependencies ( deepMerge ( existingPkg , pkg ) )
49
45
fs . writeFileSync ( packageJsonPath , JSON . stringify ( updatedPkg , null , 2 ) + '\n' , 'utf8' )
50
46
51
- // write to eslint.config.mjs , .prettierrc.json, .editorconfig, etc.
47
+ // write to eslint.config.js , .prettierrc.json, .editorconfig, etc.
52
48
for ( const [ fileName , content ] of Object . entries ( files ) ) {
53
49
const fullPath = path . resolve ( rootDir , fileName )
54
50
fs . writeFileSync ( fullPath , content as string , 'utf8' )
0 commit comments