I keep getting Unexpected empty arrow function @typescript-eslint/no-empty-function
in my .js
files even though the rule is off in my .eslintrc
file. Does anyone knows why I'm getting that ? Why is that typescript rule is checking my .js
files ?
{
"extends": [...],
"overrides": [
{
"files": "**/*.js",
"rules": {...},
},
{
"files": ["**/*.{ts,tsx}"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint", "prettier", "react-hooks", "jsx-a11y"],
"extends": [
"eslint:recommended",
"react-app",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"rules": {
"no-empty-function": 0,
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {}
},
"react": {
"version": "detect"
}
}
}
]
}
CodePudding user response:
I'm gonna go ahead and guess you only disabled the rule for .ts
and .tsx
files here, make sure you add the rule to the .js
section of the configuration you omitted at the top as well.
CodePudding user response:
ESLint.org have a helpful guide to resolve this empty function: https://eslint.org/docs/latest/rules/no-empty-function