I followed the generic instructions for a new ts project and created a new flat config eslint.config.mjs
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(
{
ignores: ["**/*.config.*"],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
}
);
Now I want to disable this rule @typescript-eslint/no-unsafe-assignment
but I’m unable to.
What I have tried:
// ... previous code
export default tseslint.config(
{
ignores: ["**/*.config.*"],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/no-unsafe-argument': 'off', // NOT WORKING
'@typescript-eslint/naming-convention': 'warn' // WORKING
}
}
);
Not sure why but naming-convention
customization is working but no-unsafe-argument
is not (the error received is Unsafe assignment of an 'any' value.eslint@typescript-eslint/no-unsafe-assignment)
.
I have also tried to add a new object to config as
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// New config
{
files: ['*.ts'],
rules: {
'@typescript-eslint/no-unsafe-argument': 'off',
},
}
Still no luck.
What’s the general way to override rules from a default like eslint.configs.recommended
or tseslint.configs.recommended
?