How can I configure the new "flat config" file (eslint.config.js
) to instruct ESLint to exclusively analyze TypeScript files (*.ts
) and apply the TypeScript "strict"
rules?
eslint.config.js
import tseslint from 'typescript-eslint';
export default [
...tseslint.configs.strict,
{
files: ['**/*.ts'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
];
package.json
"scripts": {
“lint": "eslint --max-warnings 0"
},
When I run the npm run lint
command for the lint
task, it fails because ESLint analyzes all JavaScript files in my project (resulting in numerous error messages).
My goal is for only TypeScript files (*.ts
) to undergo analysis with the "strict"
rules.
Bonus Inquiry:
While the official ESLint documentation provides detailed information on each configuration option, a comprehensive overview of file selection strategy seems lacking. The "flat config" consists of an array of objects, but what is the overall process flow for grouping and processing files through these objects?