Enable type-aware linting in ESLint
mainTo improve production application development, you can enable type-aware lint rules by configuring parserOptions and using stricter TypeScript ESLint configurations.
- Update
languageOptions.parserOptionsto include your project's tsconfig files and the current directory. - Replace
tseslint.configs.recommendedwithtseslint.configs.recommendedTypeCheckedortseslint.configs.strictTypeChecked. - (Optional) Add
...tseslint.configs.stylisticTypeChecked.
This ensures ESLint can leverage TypeScript's type information for more accurate linting.
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})