forked from elastic/eui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
175 lines (167 loc) Β· 5.62 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
const SSPL_ELASTIC_2_0_LICENSE_HEADER = `
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
`;
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: [
'./tsconfig.json',
'./cypress/tsconfig.json',
'./.storybook/tsconfig.json',
],
ecmaFeatures: {
jsx: true,
},
},
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.tsx', '.js', '.json'],
},
webpack: {
config: './.eslintwebpack.config.js',
},
},
react: {
version: 'detect',
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:storybook/recommended',
// Prettier options need to come last, in order to override other style rules
'plugin:prettier/recommended',
],
plugins: [
'mocha',
'jsx-a11y',
'local',
'import',
'react',
'react-hooks',
'@emotion',
],
rules: {
'block-scoped-var': 'error',
camelcase: 'off',
'dot-notation': ['error', { allowKeywords: true }],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'guard-for-in': 'error',
'new-cap': ['error', { capIsNewExceptions: ['Private'] }],
'no-caller': 'error',
'no-const-assign': 'error',
'no-debugger': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-eval': 'error',
'no-extend-native': 'error',
'no-global-assign': 'error',
'no-loop-func': 'error',
'no-restricted-globals': ['error', 'context'],
'no-script-url': 'error',
'no-sequences': 'error',
'no-var': 'error',
'no-with': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
strict: ['error', 'never'],
'valid-typeof': 'error',
'local/i18n': 'error',
'local/href-with-rel': 'error',
'local/forward-ref': 'error',
'local/css-logical-properties': 'error',
'local/css_before_spread_props': 'error',
'local/require-cypress-references': 'error',
'local/require-license-header': [
'warn',
{
license: SSPL_ELASTIC_2_0_LICENSE_HEADER,
},
],
'import/no-unresolved': ['error', { amd: true, commonjs: true }],
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'error',
'import/no-duplicates': 'error',
'mocha/handle-done-callback': 'error',
'mocha/no-exclusive-tests': 'error',
'jsx-a11y/accessible-emoji': 'error',
'jsx-a11y/alt-text': 'error',
'jsx-a11y/anchor-has-content': 'error',
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
'jsx-a11y/aria-props': 'error',
'jsx-a11y/aria-proptypes': 'error',
'jsx-a11y/aria-role': [2, { ignoreNonDOM: true }],
'jsx-a11y/aria-unsupported-elements': 'error',
'jsx-a11y/heading-has-content': 'error',
'jsx-a11y/html-has-lang': 'error',
'jsx-a11y/iframe-has-title': 'error',
'jsx-a11y/interactive-supports-focus': 'error',
'jsx-a11y/media-has-caption': 'error',
'jsx-a11y/mouse-events-have-key-events': 'error',
'jsx-a11y/no-access-key': 'error',
'jsx-a11y/no-distracting-elements': 'error',
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
'jsx-a11y/no-noninteractive-element-interactions': 'error',
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
'jsx-a11y/scope': 'error',
'jsx-a11y/tabindex-no-positive': 'error',
'jsx-a11y/label-has-associated-control': 'error',
'react/jsx-uses-vars': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-pascal-case': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/ban-tslint-comment': 'error',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-triple-slash-reference': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-empty-function': 'off',
// It"s all very well saying that some types are trivially inferrable,
// but being explicit is still clearer.
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/consistent-type-exports': [
'error',
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
},
overrides: [
{
files: ['*.d.ts'],
rules: {
'react/prefer-es6-class': 'off',
},
},
],
};