-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
93 lines (91 loc) · 2.51 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// @ts-check
/** @type {import('eslint').Linter.Config} */
const eslintConfig = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: {},
},
},
env: {
browser: true,
amd: true,
node: true,
},
extends: [
'plugin:storybook/recommended',
'plugin:jsx-a11y/recommended',
'eslint:recommended',
'plugin:import/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:valtio/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended', // this should always be the last element in the array
],
ignorePatterns: ['src/proto/**/*'],
plugins: [
'@typescript-eslint',
'eslint-plugin-import',
'simple-import-sort',
'prettier',
],
rules: {
'prettier/prettier': [
'error',
{ endOfLine: 'auto' },
{
usePrettierrc: true,
},
],
'react/react-in-jsx-scope': 'off',
'jsx-a11y/accessible-emoji': 'off',
'no-unused-vars': 'off',
'import/no-duplicates': 'error',
'import/no-unresolved': 'error',
'@typescript-eslint/no-unused-vars': ['warn'],
'@typescript-eslint/explicit-function-return-type': 'off',
'simple-import-sort/exports': 'error',
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
// specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
'simple-import-sort/imports': [
'error',
{
groups: [
// Packages. `react` related packages come first.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^react', '^@?\\w'],
// absolute imports - types/util, then data-related
['^(types)', '^(util)(/.*|$)'],
['^(api|store|hooks|routes)', '^(api|store|hooks|routes)(/.*|$)'], // (repeating is due to a bug importing types)
// Pages, components
['^(pages)(/.*|$)', '^(@)(/.*|$)'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// assets
['^(assets)(/.*|$)'],
],
},
],
},
}
module.exports = eslintConfig