-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
executable file
·143 lines (131 loc) · 5.23 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
const schemaJson = require('./server/schema.json');
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
env: {
browser: true,
node: true,
jest: true,
},
plugins: ['@typescript-eslint', 'import', 'graphql'],
extends: [
'react-app',
'airbnb',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
rules: {
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
'no-underscore-dangle': ['error', { allow: ['__typename'] }],
'class-methods-use-this': 0,
'react/jsx-curly-newline': 0,
'no-plusplus': [2, { allowForLoopAfterthoughts: true }],
'react/jsx-filename-extension': 0,
'react/jsx-indent': 0,
'react/jsx-one-expression-per-line': 0,
'react/jsx-props-no-spreading': 0,
'react/jsx-wrap-multilines': 0,
'react/prefer-stateless-function': 0,
'react/react-in-jsx-scope': 0,
'react/no-array-index-key': 0,
'graphql/capitalized-type-name': ['warn', { schemaJson }],
'graphql/named-operations': ['warn', { schemaJson }],
'graphql/required-fields': ['error', { schemaJson, requiredFields: ['id'] }],
// 'graphql/template-strings': ['error', { env: 'apollo', schemaJson, tagName: 'gql' }],
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'import/extensions': 0,
'import/newline-after-import': 'error',
'import/order': [
'error',
{
groups: ['external', 'builtin', 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
{
// CSS should be loaded last so that it can override components in common folder
pattern: './*.module.css',
group: 'sibling',
position: 'after',
},
],
},
],
'import/prefer-default-export': 0,
'jsx-a11y/label-has-for': 'off',
'jsx-a11y/label-has-associated-control': [
'error',
{
labelComponents: [],
labelAttributes: [],
controlComponents: ['Input', 'Textarea', 'Select', 'Checkbox', 'Radio', 'DateInput'],
},
],
'jsx-a11y/control-has-associated-label': [
'error',
{
controlComponents: ['Button', 'SubmitButton'],
},
],
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/indent': 0,
'@typescript-eslint/member-delimiter-style': 0,
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'error',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-duplicate-imports.md
'no-duplicate-imports': 'off',
'@typescript-eslint/no-duplicate-imports': 'error',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
'no-implied-eval': 'off',
'@typescript-eslint/no-implied-eval': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
'return-await': 'off',
'@typescript-eslint/return-await': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-this.md
'no-invalid-this': 'off',
'@typescript-eslint/no-invalid-this': ['error'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/init-declarations.md
'init-declarations': 'off',
'@typescript-eslint/init-declarations': ['error'],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 0,
},
},
{
files: ['*.test.ts', '*.test.tsx', '*.stories.ts', '*.stories.tsx'],
rules: {
'@typescript-eslint/ban-ts-ignore': 0,
},
},
],
settings: {
'import/resolver': {
typescript: {},
},
},
};