I have a codebase with lots of .js and .ts/.tsx files. I want to run some rules on the whole codebase and some rules just on typescript files.
How can I achieve this in the best possible way?
specifically I want the rule: "react/prop-types": "error", to only run on .ts files
but it only gives one option of error, so not sure how to say just .ts for this?
you can use an overrides option in your .eslintrc file:
{
rules: {
// all your general rules that apply to everyone
},
overrides: {
files: ['*.ts', '*.tsx'],
rules: {
// rules you want for ts/tsx files
react/prop-types: 'error',
},
},
}