Skip to content

Commit

Permalink
fix: use --force to install eslint v9 + tseslint (#118)
Browse files Browse the repository at this point in the history
it does not suppport eslint v9 yet.
refs: #89 (comment)
  • Loading branch information
aladdin-add authored May 26, 2024
1 parent 76e94e6 commit 27a207e
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug

if (this.answers.language === "typescript") {
this.result.devDependencies.push("typescript-eslint");
this.result.installFlags.push("--force"); // tseslint does not support eslint 9.x yet
importContent += "import tseslint from \"typescript-eslint\";\n";
exportContent += " ...tseslint.configs.recommended,\n";
}
Expand All @@ -182,7 +183,9 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug
if (this.answers.framework === "react") {
if (this.answers.eslintVersion === "9.x") {
this.result.devDependencies.push("eslint-plugin-react", "@eslint/compat");
this.result.installFlags.push("--force");
if (!this.result.installFlags.includes("--force")) {
this.result.installFlags.push("--force");
}
importContent += "import pluginReactConfig from \"eslint-plugin-react/configs/recommended.js\";\n";
importContent += "import { fixupConfigRules } from \"@eslint/compat\";\n";
exportContent += " ...fixupConfigRules(pluginReactConfig),\n";
Expand Down
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-commonjs-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-esm-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/problems-script-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-commonjs-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-react-eslint8.x-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-esm-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-none-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}
1 change: 1 addition & 0 deletions tests/__snapshots__/syntax-script-vue-typescript
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export default [
],
"installFlags": [
"-D",
"--force",
],
}

0 comments on commit 27a207e

Please sign in to comment.