-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): adopt
projectService
and remove old pathsOverrides.ts…
…configLocation Fixes #203 BREAKING CHANGE: removed pathsOverrides.tsconfigLocation
- Loading branch information
1 parent
9a66082
commit 86f0bc7
Showing
9 changed files
with
47 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
packages/eslint-config-sheriff/src/utils/getLanguageOptionsTypescript.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import tseslint from 'typescript-eslint'; | ||
import { getLegacyCompatDirname } from './getLegacyCompatDirname'; | ||
|
||
export const getLanguageOptionsTypescript = ( | ||
userChosenTSConfig?: string | string[], | ||
disableProjectService: boolean, | ||
) => { | ||
return { | ||
parser: tseslint.parser, | ||
parserOptions: { | ||
ecmaFeatures: { modules: true }, | ||
project: userChosenTSConfig || true, | ||
...(disableProjectService ? {} : { projectService: true }), | ||
tsconfigRootDir: disableProjectService | ||
? undefined | ||
: getLegacyCompatDirname(), | ||
}, | ||
}; | ||
}; |
10 changes: 6 additions & 4 deletions
10
packages/eslint-config-sheriff/src/utils/getLanguageOptionsTypescriptReact.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/eslint-config-sheriff/src/utils/getLegacyCompatDirname.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { dirname } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
export const getLegacyCompatDirname = () => { | ||
const isESM = typeof import.meta !== 'undefined'; | ||
return isESM ? dirname(fileURLToPath(import.meta.url)) : __dirname; | ||
// return url.fileURLToPath(new URL('.', isESM ? import.meta.url : __filename)); // alternative code | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters