-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
159 lines (150 loc) · 7.03 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
const defaultSeverity = 'warn';
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {},
extends: [
'react-app',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:import/typescript'
],
plugins: ['prettier', '@typescript-eslint', 'import', 'react', 'react-hooks'],
env: {
es6: true,
browser: true,
node: true,
},
rules: {
// https://eslint.org/docs/rules/comma-dangle
'comma-dangle': defaultSeverity,
// https://eslint.org/docs/rules/jsx-quotes
'jsx-quotes': defaultSeverity,
// https://eslint.org/docs/rules/key-spacing
'key-spacing': defaultSeverity,
// https://eslint.org/docs/rules/no-bitwise
'no-bitwise': defaultSeverity,
// https://eslint.org/docs/rules/no-dupe-class-members
'no-dupe-class-members': 'off',
// https://eslint.org/docs/rules/no-undef
'no-undef': 'off',
// https://eslint.org/docs/rules/no-var
'no-var': defaultSeverity,
// https://eslint.org/docs/rules/quote-props
'quote-props': [defaultSeverity, 'consistent-as-needed'],
// https://eslint.org/docs/rules/quotes
'quotes': [defaultSeverity, 'single'],
// https://eslint.org/docs/rules/semi-spacing
'semi-spacing': defaultSeverity,
// https://eslint.org/docs/rules/sort-imports
'sort-imports': [defaultSeverity, {
'ignoreDeclarationSort': true
}],
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
"import/order": [defaultSeverity, {
"alphabetize": {
"order": "asc",
"caseInsensitive": true
},
"groups": [ "builtin", "external", "internal", "parent", ["index", "sibling"], "unknown" ],
"newlines-between": "always"
}],
// https://github.com/prettier/eslint-plugin-prettier#options
'prettier/prettier': [defaultSeverity, {
'arrowParens': 'always',
'printWidth': 140,
'proseWrap': 'always',
'quoteProps': 'consistent',
'singleQuote': true,
'tabWidth': 4,
'useTabs': false
}],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
'@typescript-eslint/ban-types': [defaultSeverity, {
'types': {
'Object': {
'message': 'Avoid using the `Object` type. Did you mean `object`?',
'fixWith': 'object'
},
'Boolean': {
'message': 'Avoid using the `Boolean` type. Did you mean `boolean`?',
'fixWith': 'boolean'
},
'Number': {
'message': 'Avoid using the `Number` type. Did you mean `number`?',
'fixWith': 'number'
},
'String': {
'message': 'Avoid using the `String` type. Did you mean `string`?',
'fixWith': 'string'
},
'Symbol': {
'message': 'Avoid using the `Symbol` type. Did you mean `symbol`?',
'fixWith': 'symbol'
}
}
}],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-ignore.md
'@typescript-eslint/ban-ts-ignore': 'off',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
'@typescript-eslint/explicit-member-accessibility': [defaultSeverity, {
'accessibility': 'explicit',
'overrides': {
'constructors': 'no-public'
}
}],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
'@typescript-eslint/explicit-function-return-type': 'off',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/indent.md
'@typescript-eslint/indent': 'off',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/interface-name-prefix.md
'@typescript-eslint/interface-name-prefix': [defaultSeverity, 'never'],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
'@typescript-eslint/member-ordering': [defaultSeverity, {
'default': [
// Fields
'public-field', // = ['public-static-field', 'public-instance-field'])
'protected-field', // = ['protected-static-field', 'protected-instance-field'])
'private-field', // = ['private-static-field', 'private-instance-field'])
// Constructors
'constructor', // = ['public-constructor', 'protected-constructor', 'private-constructor'])
// Methods
'public-method', // = ['public-static-method', 'public-instance-method'])
'protected-method', // = ['protected-static-method', 'protected-instance-method'])
'private-method', // = ['private-static-method', 'private-instance-method'])
]
}],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
'@typescript-eslint/no-empty-interface': [
'error',
{
'allowSingleExtends': true
}
],
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
'@typescript-eslint/no-explicit-any': 'off',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
'@typescript-eslint/no-inferrable-types': 'off',
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
'@typescript-eslint/no-unused-vars': 'off'
},
overrides: [{
files: ["*.tsx"],
rules: {
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
'@typescript-eslint/member-ordering': 'off',
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
'react/sort-comp': [defaultSeverity, {
'order': [
'instance-variables',
'lifecycle',
'everything-else',
'static-methods',
'instance-methods',
'render'
]
}],
}
}]
};