Reputation: 11468
I'm writing a custom plugin that based on various conditions, it fixes an error by passing a new type. for example,
before the fix:
const x = X("A");
~ <-- Error
after the fix:
const x = X<A>("A");
Everything seems to working, except the part where the following rule is being enforced in JS files as well. How can I enforce the rule to run only in TS files?
Upvotes: 0
Views: 580
Reputation: 272
One way to achive this, is to use "overrides" in your .eslintrc.js file. to only enable it on .ts files and keep the rest of your eslint config the same: You can look at this in more detail on https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns
Example:
module.exports = {
...
"overrides": [
"files": [
"**/*.ts"
],
"rules": {
"your-cool-rule": "error"
}
]
...
}
Upvotes: 1