-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ESLint, migrate configuration file
- Loading branch information
1 parent
0577ffd
commit 4505339
Showing
84 changed files
with
1,498 additions
and
1,420 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* eslint-disable sort-keys */ | ||
const smallImageAttachment = [ | ||
{ | ||
type: 'image', | ||
|
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,128 @@ | ||
import js from '@eslint/js'; | ||
import globals from 'globals'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
import reactPlugin from 'eslint-plugin-react'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
import jestPlugin from 'eslint-plugin-jest'; | ||
import jestDOMPlugin from 'eslint-plugin-jest-dom'; | ||
|
||
export default tseslint.config( | ||
{ | ||
ignores: ['dist', 'src/@types', '*.{js,ts}'], | ||
}, | ||
{ | ||
name: 'default', | ||
extends: [ | ||
js.configs.recommended, | ||
...tseslint.configs.recommended, | ||
reactPlugin.configs.flat.recommended, | ||
], | ||
files: ['src/**/*.{js,ts,jsx,tsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
}, | ||
plugins: { | ||
'react-hooks': reactHooksPlugin, | ||
import: importPlugin, | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
rules: { | ||
'array-callback-return': 'error', | ||
'arrow-body-style': 'error', | ||
'comma-dangle': 'off', | ||
'default-case': 'error', | ||
eqeqeq: ['error', 'smart'], | ||
'jsx-quotes': ['error', 'prefer-single'], | ||
'linebreak-style': ['error', 'unix'], | ||
'no-console': 'off', | ||
'no-mixed-spaces-and-tabs': 'warn', | ||
'no-self-compare': 'error', | ||
'no-underscore-dangle': ['error', { allowAfterThis: true }], | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ ignoreRestSiblings: true, caughtErrors: 'none' }, | ||
], | ||
'no-use-before-define': 'off', | ||
'no-useless-concat': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': 'warn', | ||
'prefer-const': 'warn', | ||
'react/jsx-sort-props': [ | ||
'error', | ||
{ | ||
callbacksLast: false, | ||
ignoreCase: true, | ||
noSortAlphabetically: false, | ||
reservedFirst: false, | ||
shorthandFirst: false, | ||
shorthandLast: false, | ||
}, | ||
], | ||
'react/prop-types': 'off', | ||
'require-await': 'error', | ||
semi: ['warn', 'always'], | ||
// TODO: find appropriate plugin for this rule | ||
// "sort-destructure-keys/sort-destructure-keys": [ | ||
// "error", | ||
// { caseSensitive: false }, | ||
// ], | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
allowSeparatedGroups: true, | ||
ignoreCase: true, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], | ||
}, | ||
], | ||
'sort-keys': ['error', 'asc', { caseSensitive: false, minKeys: 2, natural: false }], | ||
'valid-typeof': 'error', | ||
'import/prefer-default-export': 'off', | ||
'import/extensions': 'off', | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
devDependencies: true, // TODO: set to false once React is in the dependencies (not devDependencies) | ||
optionalDependencies: false, | ||
peerDependencies: false, | ||
}, | ||
], | ||
'max-classes-per-file': 'off', | ||
camelcase: 'off', | ||
'react-hooks/rules-of-hooks': 'warn', | ||
'react-hooks/exhaustive-deps': 'error', | ||
'no-unused-expressions': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'error', | ||
// TODO: remove this rule once all files are .mjs (and require is not used) | ||
'@typescript-eslint/no-require-imports': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
}, | ||
}, | ||
{ | ||
name: 'jest', | ||
files: ['src/**/__tests__/**'], | ||
plugins: { jest: jestPlugin, 'jest-dom': jestDOMPlugin }, | ||
languageOptions: { | ||
globals: jestPlugin.environments.globals.globals, | ||
}, | ||
rules: { | ||
'jest/expect-expect': 'off', | ||
'jest/no-conditional-expect': 'off', | ||
'jest/prefer-inline-snapshots': 'off', | ||
'jest/lowercase-name': 'off', | ||
'jest/prefer-expect-assertions': 'off', | ||
'jest/no-hooks': 'off', | ||
'jest/no-if': 'off', | ||
'jest-dom/prefer-in-document': 'error', | ||
}, | ||
}, | ||
); |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.