Skip to content

Commit

Permalink
feat: allow vars with _ to be excluded from eslint rule (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
asharonbaltazar authored Dec 13, 2024
1 parent 345d784 commit 85d8bf0
Showing 1 changed file with 47 additions and 36 deletions.
83 changes: 47 additions & 36 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,57 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, includeIgnoreFile(gitignorePath), {
plugins: {
// @ts-expect-error Types mismatch for eslint-plugin-react
react,
// @ts-expect-error https://github.com/facebook/react/pull/28773#issuecomment-2147149016
"react-hooks": fixupPluginRules(eslintReactHooks),
},
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
includeIgnoreFile(gitignorePath),
{
plugins: {
// @ts-expect-error Types mismatch for eslint-plugin-react
react,
// @ts-expect-error https://github.com/facebook/react/pull/28773#issuecomment-2147149016
"react-hooks": fixupPluginRules(eslintReactHooks),
},
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
},

settings: {
react: {
version: "detect",
settings: {
react: {
version: "detect",
},
},
},

rules: {
"@typescript-eslint/no-empty-interface": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": [
"off",
{
"ts-ignore": false,
"ts-nocheck": false,
"ts-check": true,
"ts-expect-error": true,
},
],
rules: {
"@typescript-eslint/no-empty-interface": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/ban-ts-comment": [
"off",
{
"ts-ignore": false,
"ts-nocheck": false,
"ts-check": true,
"ts-expect-error": true,
},
],
},
},
});
);

0 comments on commit 85d8bf0

Please sign in to comment.