-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
123 lines (121 loc) · 3.46 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
const fs = require('fs')
const tsconfig = require('./tsconfig.json')
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
// 'plugin:import/errors',
// 'plugin:import/warnings',
'plugin:import/typescript',
'plugin:tailwindcss/recommended',
],
plugins: [
'import',
'jsx-a11y',
'react',
'react-hooks',
'testing-library',
'simple-import-sort',
'tailwindcss',
],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: ['./tsconfig.json'],
},
rules: {
'prettier/prettier': ['error', require('./.prettierrc.json')],
curly: ['error', 'multi-line', 'consistent'],
'import/no-duplicates': 'error',
'jsx-a11y/media-has-caption': 'off',
'object-shorthand': 'error',
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: 'return' },
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: 'if' },
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
],
'prefer-const': ['error', { destructuring: 'all' }],
quotes: ['error', 'single', { allowTemplateLiterals: true }],
'react/display-name': 'off',
'react/prop-types': 'off',
'react/sort-comp': [
'error',
{
order: [
'type-annotations',
'static-methods',
'instance-variables',
'lifecycle',
'everything-else',
'rendering',
],
groups: {
rendering: ['/^render.+$/', 'render'],
},
},
],
'react/jsx-curly-brace-presence': ['error', 'never'],
'react/react-in-jsx-scope': 'off', // react 17 🎉
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'simple-import-sort/imports': [
'error',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Packages. `react` and `gatsby` related packages come first.
['^react', '^gatsby', '^@?\\w'],
// Root-level imports
['^~/.*'],
// src folders
[
`^(${fs
.readdirSync(tsconfig.compilerOptions.baseUrl)
.join('|')})(/.*|$)`,
],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Style imports.
['^.+\\.s?css$'],
],
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true, argsIgnorePattern: '^_' },
],
'@typescript-eslint/explicit-member-accessibility': [
'warn',
{ accessibility: 'no-public' },
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'@typescript-eslint/no-misused-promises': 'error',
},
settings: {
react: {
version: 'detect',
},
tailwindcss: {
whitelist: ['chunky-underline-\\w+-\\d{2,3}'],
},
},
}