Last active
May 31, 2024 02:25
-
-
Save Stanzilla/f8b1703c66dc41c0f39e2b79ed706cc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | |
import vitest from "eslint-plugin-vitest"; | |
import { fixupConfigRules } from "@eslint/compat"; | |
import tsParser from "@typescript-eslint/parser"; | |
import path from "node:path"; | |
import { fileURLToPath } from "node:url"; | |
import js from "@eslint/js"; | |
import { FlatCompat } from "@eslint/eslintrc"; | |
const __filename = fileURLToPath(import.meta.url); | |
const __dirname = path.dirname(__filename); | |
const compat = new FlatCompat({ | |
baseDirectory: __dirname, | |
recommendedConfig: js.configs.recommended, | |
allConfig: js.configs.all | |
}); | |
export default [...fixupConfigRules(compat.extends( | |
"plugin:react/jsx-runtime", | |
"plugin:react-hooks/recommended", | |
"plugin:promise/recommended", | |
"plugin:@tanstack/eslint-plugin-query/recommended", | |
"plugin:vitest/legacy-recommended", | |
"plugin:@typescript-eslint/recommended-type-checked", | |
"plugin:@cspell/recommended", | |
"plugin:import-x/recommended", | |
"plugin:import-x/typescript", | |
"prettier", | |
)), { | |
plugins: { | |
"@typescript-eslint": typescriptEslint, | |
vitest, | |
}, | |
languageOptions: { | |
parser: tsParser, | |
ecmaVersion: 2022, | |
sourceType: "module", | |
parserOptions: { | |
project: true, | |
}, | |
}, | |
settings: { | |
"import-x/resolver": { | |
typescript: true, | |
node: true, | |
}, | |
}, | |
rules: { | |
"react/react-in-jsx-scope": "off", | |
"react/prop-types": "off", | |
"react/require-default-props": "off", | |
"react/jsx-props-no-spreading": "off", | |
"no-shadow": "off", | |
"@typescript-eslint/no-shadow": "error", | |
"no-unused-vars": "off", | |
"no-underscore-dangle": "off", | |
"@typescript-eslint/no-unused-vars": ["warn", { | |
varsIgnorePattern: "^React", | |
}], | |
"@typescript-eslint/no-explicit-any": "off", | |
"@typescript-eslint/no-floating-promises": "off", | |
"no-return-await": "off", | |
"@typescript-eslint/require-await": "off", | |
"@typescript-eslint/no-misused-promises": ["error", { | |
checksVoidReturn: false, | |
}], | |
"jsx-a11y/label-has-associated-control": "off", | |
"jsx-a11y/no-autofocus": "off", | |
"react/jsx-filename-extension": [1, { | |
extensions: [".js", ".jsx", ".ts", ".tsx", ".test.tsx"], | |
}], | |
"react/function-component-definition": "off", | |
"no-console": "off", | |
"react-hooks/exhaustive-deps": "error", | |
"import-x/no-named-as-default": "off", | |
"import-x/no-named-as-default-member": "off", | |
}, | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
extends: [ | |
'plugin:react/jsx-runtime', | |
'plugin:react-hooks/recommended', | |
'plugin:promise/recommended', | |
'plugin:@tanstack/eslint-plugin-query/recommended', | |
'plugin:vitest/legacy-recommended', | |
'plugin:@typescript-eslint/recommended-type-checked', | |
'plugin:@cspell/recommended', | |
'plugin:import-x/recommended', | |
'plugin:import-x/typescript', | |
'prettier', | |
], | |
plugins: ['@typescript-eslint', 'vitest'], | |
rules: { | |
'react/react-in-jsx-scope': 'off', | |
'react/prop-types': 'off', | |
'react/require-default-props': 'off', | |
'react/jsx-props-no-spreading': 'off', | |
'no-shadow': 'off', | |
'@typescript-eslint/no-shadow': 'error', | |
'no-unused-vars': 'off', | |
'no-underscore-dangle': 'off', | |
'@typescript-eslint/no-unused-vars': [ | |
'warn', | |
{ varsIgnorePattern: '^React' }, | |
], | |
'@typescript-eslint/no-explicit-any': 'off', | |
'@typescript-eslint/no-floating-promises': 'off', | |
'no-return-await': 'off', | |
'@typescript-eslint/require-await': 'off', | |
'@typescript-eslint/no-misused-promises': [ | |
'error', | |
{ | |
checksVoidReturn: false, | |
}, | |
], | |
'jsx-a11y/label-has-associated-control': 'off', | |
'jsx-a11y/no-autofocus': 'off', | |
'react/jsx-filename-extension': [ | |
1, | |
{ extensions: ['.js', '.jsx', '.ts', '.tsx', '.test.tsx'] }, | |
], | |
'react/function-component-definition': 'off', | |
'no-console': 'off', | |
'react-hooks/exhaustive-deps': 'error', | |
'import-x/no-named-as-default': 'off', | |
'import-x/no-named-as-default-member': 'off', | |
}, | |
settings: { | |
'import-x/resolver': { | |
typescript: true, | |
node: true, | |
}, | |
}, | |
parser: '@typescript-eslint/parser', | |
parserOptions: { | |
ecmaVersion: 2022, | |
sourceType: 'module', | |
project: true, | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Errors: | |
ConfigError: Config (unnamed): Key "plugins": Cannot redefine plugin "vitest". | |
ConfigError: Config (unnamed): Key "plugins": Cannot redefine plugin "@typescript-eslint". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment