-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
170 additions
and
138 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,149 +1,159 @@ | ||
import typescriptEslint from "@typescript-eslint/eslint-plugin"; | ||
import _import from "eslint-plugin-import"; | ||
import onlyWarn from "eslint-plugin-only-warn"; | ||
import prettier from "eslint-plugin-prettier"; | ||
import react from "eslint-plugin-react"; | ||
import reactHooks from "eslint-plugin-react-hooks"; | ||
import globals from "globals"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
import path from "node:path"; | ||
import js from "@eslint/js"; | ||
|
||
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 [{ | ||
ignores: ["**/*.css", "ui-icons/src/"], | ||
}, ...fixupConfigRules(compat.extends( | ||
"eslint:recommended", | ||
"prettier", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:react/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:storybook/recommended", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
)), { | ||
import importPlugin from 'eslint-plugin-import'; | ||
import prettier from 'eslint-plugin-prettier'; | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
import reactPlugin from 'eslint-plugin-react'; | ||
import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
import globals from 'globals'; | ||
import tseslint from 'typescript-eslint'; | ||
import js from '@eslint/js'; | ||
|
||
export default [ | ||
{ | ||
ignores: ['**/*.css', 'ui-icons/src/'], | ||
}, | ||
...tseslint.config(js.configs.recommended, ...tseslint.configs.recommended), | ||
eslintPluginPrettierRecommended, | ||
importPlugin.flatConfigs.recommended, | ||
importPlugin.flatConfigs.typescript, | ||
reactPlugin.configs.flat.recommended, | ||
reactPlugin.configs.flat['jsx-runtime'], | ||
{ | ||
plugins: { | ||
"@typescript-eslint": fixupPluginRules(typescriptEslint), | ||
import: fixupPluginRules(_import), | ||
"only-warn": onlyWarn, | ||
prettier: fixupPluginRules(prettier), | ||
react: fixupPluginRules(react), | ||
"react-hooks": fixupPluginRules(reactHooks), | ||
'react-hooks': reactHooksPlugin, | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
}, | ||
|
||
parser: tsParser, | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
|
||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
|
||
rules: { | ||
"import/order": ["error", { | ||
groups: ["builtin", "external", "internal"], | ||
...reactHooksPlugin.configs.recommended.rules, | ||
|
||
'import/order': [ | ||
'error', | ||
{ | ||
groups: ['builtin', 'external', 'internal'], | ||
|
||
pathGroups: [ | ||
{ | ||
pattern: 'react', | ||
group: 'builtin', | ||
position: 'before', | ||
}, | ||
], | ||
|
||
pathGroupsExcludedImportTypes: ['react'], | ||
'newlines-between': 'always', | ||
|
||
pathGroups: [{ | ||
pattern: "react", | ||
group: "builtin", | ||
position: "before", | ||
}], | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
|
||
pathGroupsExcludedImportTypes: ["react"], | ||
"newlines-between": "always", | ||
'no-shadow': 'off', | ||
|
||
alphabetize: { | ||
order: "asc", | ||
caseInsensitive: true, | ||
}, | ||
}], | ||
|
||
"no-shadow": "off", | ||
|
||
"@typescript-eslint/consistent-type-imports": ["error", { | ||
fixStyle: "inline-type-imports", | ||
}], | ||
|
||
"@typescript-eslint/no-shadow": "error", | ||
"@typescript-eslint/no-use-before-define": "error", | ||
"@typescript-eslint/no-explicit-any": 2, | ||
"@typescript-eslint/explicit-module-boundary-types": 0, | ||
"@typescript-eslint/space-before-blocks": 0, | ||
|
||
"@typescript-eslint/no-restricted-types": ["error", { | ||
types: { | ||
LegacyFilterSpecification: { | ||
message: "Use ExpressionFilterSpecification instead", | ||
fixWith: "ExpressionFilterSpecification", | ||
}, | ||
|
||
FC: "Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177", | ||
"React.FC": "Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177", | ||
"React.FunctionComponent": "Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177", | ||
"React.FunctionalComponent": "Preact specific, useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177", | ||
'@typescript-eslint/consistent-type-imports': [ | ||
'error', | ||
{ | ||
fixStyle: 'inline-type-imports', | ||
}, | ||
], | ||
|
||
'@typescript-eslint/no-shadow': 'error', | ||
'@typescript-eslint/no-use-before-define': 'error', | ||
'@typescript-eslint/no-explicit-any': 2, | ||
'@typescript-eslint/explicit-module-boundary-types': 0, | ||
'@typescript-eslint/space-before-blocks': 0, | ||
|
||
'@typescript-eslint/no-restricted-types': [ | ||
'error', | ||
{ | ||
types: { | ||
LegacyFilterSpecification: { | ||
message: 'Use ExpressionFilterSpecification instead', | ||
fixWith: 'ExpressionFilterSpecification', | ||
}, | ||
}], | ||
|
||
"@typescript-eslint/no-unused-vars": ["warn", { | ||
argsIgnorePattern: "^_", | ||
}], | ||
|
||
camelcase: 0, | ||
"no-nonoctal-decimal-escape": 0, | ||
"no-unsafe-optional-chaining": 0, | ||
"object-curly-newline": 0, | ||
"react/function-component-definition": 0, | ||
"react/no-array-index-key": 0, | ||
"react/require-default-props": 0, | ||
"arrow-body-style": ["error", "as-needed"], | ||
"global-require": "off", | ||
|
||
"import/extensions": ["error", "ignorePackages", { | ||
js: "never", | ||
jsx: "never", | ||
ts: "never", | ||
tsx: "never", | ||
}], | ||
|
||
"import/no-extraneous-dependencies": 0, | ||
|
||
"import/no-unresolved": [2, { | ||
commonjs: true, | ||
amd: true, | ||
}], | ||
|
||
"jsx-a11y/click-events-have-key-events": "off", | ||
"linebreak-style": ["error", "unix"], | ||
|
||
"no-console": ["error", { | ||
allow: ["info", "debug", "warn", "error"], | ||
}], | ||
|
||
"no-named-as-default": "off", | ||
"no-param-reassign": 0, | ||
"no-use-before-define": "off", | ||
"prettier/prettier": ["warn"], | ||
"react/forbid-prop-types": "off", | ||
"react/jsx-filename-extension": "off", | ||
"react/jsx-no-useless-fragment": "error", | ||
"react/jsx-props-no-spreading": 0, | ||
"react/prefer-stateless-function": "off", | ||
"react/static-property-placement": 0, | ||
"vitest/prefer-to-be": "off", | ||
|
||
FC: 'Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177', | ||
'React.FC': | ||
'Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177', | ||
'React.FunctionComponent': | ||
'Useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177', | ||
'React.FunctionalComponent': | ||
'Preact specific, useless and has some drawbacks, see https://github.com/facebook/create-react-app/pull/8177', | ||
}, | ||
}, | ||
], | ||
|
||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
|
||
camelcase: 0, | ||
'no-nonoctal-decimal-escape': 0, | ||
'no-unsafe-optional-chaining': 0, | ||
'object-curly-newline': 0, | ||
'react/function-component-definition': 0, | ||
'react/no-array-index-key': 0, | ||
'react/require-default-props': 0, | ||
'arrow-body-style': ['error', 'as-needed'], | ||
'global-require': 'off', | ||
|
||
'import/extensions': [ | ||
'error', | ||
'ignorePackages', | ||
{ | ||
js: 'never', | ||
jsx: 'never', | ||
ts: 'never', | ||
tsx: 'never', | ||
}, | ||
], | ||
|
||
'import/no-extraneous-dependencies': 0, | ||
|
||
'import/no-unresolved': [ | ||
2, | ||
{ | ||
commonjs: true, | ||
amd: true, | ||
}, | ||
], | ||
|
||
'jsx-a11y/click-events-have-key-events': 'off', | ||
'linebreak-style': ['error', 'unix'], | ||
|
||
'no-console': [ | ||
'error', | ||
{ | ||
allow: ['info', 'debug', 'warn', 'error'], | ||
}, | ||
], | ||
|
||
'no-named-as-default': 'off', | ||
'no-param-reassign': 0, | ||
'no-use-before-define': 'off', | ||
'prettier/prettier': ['warn'], | ||
'react/forbid-prop-types': 'off', | ||
'react/jsx-filename-extension': 'off', | ||
'react/jsx-no-useless-fragment': 'error', | ||
'react/jsx-props-no-spreading': 0, | ||
'react/prefer-stateless-function': 'off', | ||
'react/static-property-placement': 0, | ||
'vitest/prefer-to-be': 'off', | ||
}, | ||
}]; | ||
}, | ||
]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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