diff --git a/.changeset/twenty-jars-fix.md b/.changeset/twenty-jars-fix.md new file mode 100644 index 000000000..b3a02b8f5 --- /dev/null +++ b/.changeset/twenty-jars-fix.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-import-x": patch +--- + +Fix https://github.com/nuxt/eslint/issues/494 by avoid importing from `@typescript-eslint/typescript-estree`. diff --git a/package.json b/package.json index f61776314..e0ed83733 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "eslint": "^8.57.0 || ^9.0.0" }, "dependencies": { - "@typescript-eslint/typescript-estree": "^8.1.0", "@typescript-eslint/utils": "^8.1.0", "debug": "^4.3.4", "doctrine": "^3.0.0", diff --git a/src/rules/no-rename-default.ts b/src/rules/no-rename-default.ts index 084898541..e52ef03db 100644 --- a/src/rules/no-rename-default.ts +++ b/src/rules/no-rename-default.ts @@ -6,7 +6,7 @@ import path from 'node:path' -import type { TSESTree } from '@typescript-eslint/typescript-estree' +import type { TSESTree } from '@typescript-eslint/utils' import { createRule, ExportMap } from '../utils' import type { ModuleOptions } from '../utils' diff --git a/src/utils/parse.ts b/src/utils/parse.ts index afa08ae47..f1ce213a5 100644 --- a/src/utils/parse.ts +++ b/src/utils/parse.ts @@ -1,6 +1,6 @@ import path from 'node:path' -import { withoutProjectParserOptions } from '@typescript-eslint/typescript-estree' +// import { withoutProjectParserOptions } from '@typescript-eslint/typescript-estree' import type { TSESLint, TSESTree } from '@typescript-eslint/utils' import debug from 'debug' @@ -13,6 +13,19 @@ import type { import { moduleRequire } from './module-require' +// https://github.com/nuxt/eslint/issues/494 +function withoutProjectParserOptions( + opts: TSESLint.ParserOptions, +): Exclude< + TSESLint.ParserOptions, + 'EXPERIMENTAL_useProjectService' | 'project' | 'projectService' +> { + // eslint-disable-next-line @typescript-eslint/no-unused-vars -- The variables are meant to be omitted + const { EXPERIMENTAL_useProjectService, project, projectService, ...rest } = + opts + return rest +} + const log = debug('eslint-plugin-import-x:parse') function keysFromParser( @@ -90,9 +103,7 @@ export function parse( // "project" or "projects" in parserOptions. Removing these options means the parser will // only parse one file in isolate mode, which is much, much faster. // https://github.com/import-js/eslint-plugin-import/issues/1408#issuecomment-509298962 - parserOptions = withoutProjectParserOptions( - parserOptions, - ) as TSESLint.ParserOptions + parserOptions = withoutProjectParserOptions(parserOptions) // require the parser relative to the main module (i.e., ESLint) const parser = diff --git a/yarn.lock b/yarn.lock index 3eb55d0ca..aaee6f7f1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2428,7 +2428,7 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@8.1.0", "@typescript-eslint/typescript-estree@^8.1.0": +"@typescript-eslint/typescript-estree@8.1.0": version "8.1.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.1.0.tgz#c44e5667683c0bb5caa43192e27de6a994f4e4c4" integrity sha512-NTHhmufocEkMiAord/g++gWKb0Fr34e9AExBRdqgWdVBaKoei2dIyYKD9Q0jBnvfbEA5zaf8plUFMUH6kQ0vGg==