forked from Kong/insomnia
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
133 lines (128 loc) · 4.45 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
/** @type { import('eslint').Linter.Config } */
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: [
'./tsconfig.eslint.json',
'./packages/*/tsconfig.json',
'./plugins/*/tsconfig.json',
],
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: true,
},
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
plugins: [
'@typescript-eslint',
'react',
'jest',
'html',
'json',
'filenames',
'react-hooks',
'import',
'simple-import-sort',
],
globals: {
__DEV__: true,
fail: true,
NodeJS: true,
HTMLDivElement: true,
HTMLElement: true,
HTMLInputElement: true,
HTMLSelectElement: true,
JSX: true,
},
env: {
browser: true,
commonjs: true,
es6: true,
'jest/globals': true,
node: true,
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
rules: {
'array-bracket-spacing': 'error',
'brace-style': 'off', // successor('@typescript-eslint/brace-style')
'camelcase': ['error', { allow: ['__export_format', '__export_date', '__export_source'] }],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': 'error',
'default-case': 'error',
'default-case-last': 'error',
'filenames/match-exported': ['error', 'kebab'],
'indent': ['error', 2, { SwitchCase: 1 }],
'eol-last': ['error', 'always'],
'arrow-parens': ['error', 'as-needed'],
'keyword-spacing': 'off', // successor('@typescript-eslint/keyword-spacing')
'no-async-promise-executor': 'off',
'no-case-declarations': 'off',
'no-duplicate-imports': 'off',
'no-prototype-builtins': 'off',
'no-redeclare': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-var': 'error',
'no-trailing-spaces': 'error',
'no-multiple-empty-lines': ['error', { 'max': 1, 'maxEOF': 0 }],
'object-curly-spacing': ['error', 'always'],
'quotes': 'off',
'semi': ['error', 'always'],
'space-before-function-paren': ['error', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
'space-in-parens': 'error',
'spaced-comment': ['error', 'always', {
exceptions: ['/', '*', '-', '* '], // for ASCII art :)
markers: [
'/', // for TypeScript directives, doxygen, vsdoc, etc. (which use `///`)
'?', // for Quokka
],
}],
'filenames/match-exported': ['error', 'kebab'],
'react/no-find-dom-node': 'off',
'react/no-unescaped-entities': 'off', // TSCONVERSION
'react/jsx-first-prop-new-line': ['error', 'multiline'],
'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-indent': ['error', 2],
'react/jsx-indent-props': ['error', 2],
'react/prop-types': 'off',
'react/function-component-definition': ['error', {
'namedComponents': 'arrow-function',
'unnamedComponents': 'arrow-function',
}],
'react/jsx-max-props-per-line': ['error', { 'maximum': 1, 'when': 'multiline' }],
'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
'react/prefer-stateless-function': 'warn', // TODO: fix this and change to error
'react/jsx-key': ['error', { 'checkFragmentShorthand': true }],
'react/no-array-index-key': 'warn',
'react/self-closing-comp': 'error',
'react-hooks/exhaustive-deps': 'error',
'react-hooks/rules-of-hooks': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array', readonly: 'array' }],
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/keyword-spacing': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true }],
'simple-import-sort/imports': 'error',
},
};