Skip to content

Commit

Permalink
fix: not config tseslint twice
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 b8cfa1b
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
Expand Up @@ -144,6 +144,13 @@ export class ConfigGenerator {
this.answers.framework = "none";
}

// tseslint should have been set in the shared configs
// avoid setting it twice - it may install multi tseslint version
// see https://github.com/eslint/create-config/issues/93
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
@@ -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 b8cfa1b

Please sign in to comment.