-
Notifications
You must be signed in to change notification settings - Fork 6
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
9 changed files
with
130 additions
and
74 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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import eslint from '@eslint/js'; | ||
import eslintConfigPrettier from 'eslint-config-prettier'; | ||
import eslintPluginImport from 'eslint-plugin-import'; | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | ||
import eslintPluginReact from 'eslint-plugin-react'; | ||
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'; | ||
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y'; | ||
|
||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
eslint.configs.recommended, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access | ||
eslintPluginImport.flatConfigs.recommended, | ||
...tseslint.configs.strictTypeChecked, | ||
...tseslint.configs.stylisticTypeChecked, | ||
// Uncomment once released - https://github.com/facebook/react/pull/30774 | ||
// eslintPluginReactHooks.configs.recommended, | ||
eslintPluginReact.configs.flat.recommended, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access | ||
eslintPluginJsxA11y.flatConfigs.recommended, | ||
eslintPluginPrettierRecommended, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
eslintConfigPrettier, | ||
{ | ||
ignores: ['!.*', 'node_modules', 'dist', 'compiled', 'build'], | ||
}, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: true, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
tsconfigRootDir: import.meta.name, | ||
}, | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
typescript: { project: 'tsconfig.dev.json' }, | ||
}, | ||
react: { version: 'detect' }, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.{js,ts,tsx}'], | ||
|
||
plugins: { | ||
// Remove once released - https://github.com/facebook/react/pull/30774 | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
'react-hooks': eslintPluginReactHooks, | ||
}, | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
rules: { | ||
// Remove once released - https://github.com/facebook/react/pull/30774 | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
...eslintPluginReactHooks.configs.recommended.rules, | ||
|
||
'react/jsx-sort-props': ['error', { callbacksLast: true, shorthandFirst: true }], | ||
|
||
'no-undef': 'off', | ||
'prefer-template': 'error', | ||
'no-nested-ternary': 'error', | ||
'no-unneeded-ternary': 'error', | ||
|
||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }], | ||
'@typescript-eslint/consistent-type-definitions': ['error', 'type'], | ||
'@typescript-eslint/array-type': ['error', { default: 'generic' }], | ||
'@typescript-eslint/prefer-nullish-coalescing': 'error', | ||
'@typescript-eslint/no-unnecessary-condition': 'error', | ||
'@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }], | ||
'@typescript-eslint/restrict-plus-operands': 'off', | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'typeAlias', | ||
format: ['PascalCase'], | ||
}, | ||
{ | ||
selector: 'variable', | ||
types: ['boolean'], | ||
format: ['PascalCase'], | ||
prefix: ['is', 'should', 'has', 'can', 'did', 'will'], | ||
}, | ||
{ | ||
// Generic type parameter must start with letter T, followed by any uppercase letter. | ||
selector: 'typeParameter', | ||
format: ['PascalCase'], | ||
custom: { regex: '^T[A-Z]', match: true }, | ||
}, | ||
], | ||
|
||
'import/no-default-export': 'error', | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['stories/**/*'], | ||
rules: { | ||
'import/no-default-export': '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
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
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
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
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
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
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