Skip to content

Commit

Permalink
fix: not install multi tseslint versions (#94)
Browse files Browse the repository at this point in the history
The ts style guide typically depend on tseslint, so there's no need
to install it separately. Doing so might result in multiple versions
being installed, leading to errors.

fixes #97, #98
  • Loading branch information
aladdin-add committed Apr 16, 2024
1 parent 1b0d6dd commit ba1a02c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 7 additions & 0 deletions lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ export class ConfigGenerator {
this.answers.framework = "none";
}

// tseslint should have been a dependency in the shared configs
// avoid install tseslint - it may install multi tseslint versions
// see https://github.com/eslint/create-config/issues/97
if (this.answers.styleguide && this.answers.language === "typescript") {
this.answers.language = "javascript";
}

let importContent = "";
const helperContent = `import path from "path";
import { fileURLToPath } from "url";
Expand Down
3 changes: 0 additions & 3 deletions tests/__snapshots__/style-esm-none-xo-typescript
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"configContent": "import globals from "globals";
import tseslint from "typescript-eslint";

import path from "path";
import { fileURLToPath } from "url";
Expand All @@ -15,7 +14,6 @@ const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: plug
export default [
{languageOptions: { globals: globals.browser }},
...compat.extends("xo-typescript"),
...tseslint.configs.recommended,
];",
"configFilename": "eslint.config.mjs",
"devDependencies": [
Expand All @@ -26,7 +24,6 @@ export default [
"@typescript-eslint/parser@>=7.0.2",
"eslint@>=8.56.0",
"typescript@>=5.0.0",
"typescript-eslint",
"@eslint/eslintrc",
"@eslint/js",
],
Expand Down

0 comments on commit ba1a02c

Please sign in to comment.