diff --git a/README.md b/README.md index 9ce2e03883..b5e795936a 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,10 @@ Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?it } ``` +### TypeScript Aware Rules + +Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root. Refer to [this file](https://github.com/antfu/eslint-config/blob/main/packages/typescript/index.js#L17). + ## Extended Reading Learn more about the context - [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier). diff --git a/packages/typescript/index.js b/packages/typescript/index.js index d45c2b893c..b14c360f9e 100644 --- a/packages/typescript/index.js +++ b/packages/typescript/index.js @@ -14,7 +14,7 @@ module.exports = { }, }, overrides: basic.overrides.concat( - !fs.existsSync(join(process.cwd(), 'tsconfig.json')) + !fs.existsSync(join(process.cwd(), 'tsconfig.eslint.json')) ? [] : [{ parserOptions: { @@ -31,7 +31,7 @@ module.exports = { '@typescript-eslint/no-implied-eval': 'error', 'dot-notation': 'off', '@typescript-eslint/dot-notation': ['error', { allowKeywords: true }], - 'no-void': ['error', { 'allowAsStatement': true }], + 'no-void': ['error', { allowAsStatement: true }], '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/no-misused-promises': 'error', },