Skip to content

Commit

Permalink
Add back tsconfigRootDir
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Dec 13, 2022
1 parent 3c4850b commit 16e52d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/linting/Typed_Linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
// Added lines start
parserOptions: {
tsconfigRootDir: __dirname,
project: true,
},
// Added lines end
Expand All @@ -27,6 +28,8 @@ module.exports = {

In more detail:

- `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory.
- This is helpful if ESLint is invoked from a different directory, such as a subdirectory within the project.
- `parserOptions.project` tells our parser to use the closest `tsconfig.json` to each file for informing that file's type information.
- If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/Monorepos.md).
- `plugin:@typescript-eslint/recommended-requiring-type-checking` is another recommended configuration we provide. This one contains rules that specifically require type information.
Expand Down
2 changes: 2 additions & 0 deletions docs/linting/typed-linting/Monorepos.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module.exports = {
],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
// Remove this line
project: true,
// Add this line
Expand All @@ -75,6 +76,7 @@ module.exports = {
],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
// Remove this line
project: ['./tsconfig.eslint.json', './**/tsconfig.json'],
// Add this line
Expand Down

0 comments on commit 16e52d5

Please sign in to comment.