Skip to content

Commit

Permalink
refactor: isolate parsing w/ typescript-eslint v8 (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored Aug 26, 2024
1 parent 4ac2b98 commit ac11f62
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"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",
Expand Down
11 changes: 4 additions & 7 deletions src/utils/parse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path'

import { withoutProjectParserOptions } from '@typescript-eslint/typescript-estree'

This comment has been minimized.

Copy link
@Revadike

Revadike Sep 4, 2024

@SukkaW Can you please check this issue?
nuxt/eslint#494

import type { TSESLint, TSESTree } from '@typescript-eslint/utils'
import debug from 'debug'

Expand Down Expand Up @@ -89,13 +90,9 @@ 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

// TODO: prefer https://github.com/typescript-eslint/typescript-eslint/pull/9233 when typescript-eslint v8
// become stable
delete parserOptions.EXPERIMENTAL_useProjectService
delete parserOptions.projectService
delete parserOptions.project
delete parserOptions.projects
parserOptions = withoutProjectParserOptions(
parserOptions,
) as TSESLint.ParserOptions

// require the parser relative to the main module (i.e., ESLint)
const parser =
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2421,7 +2421,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==
Expand Down

0 comments on commit ac11f62

Please sign in to comment.