forked from cloudscape-design/components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
170 lines (170 loc) · 4.6 KB
/
.eslintrc
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
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:no-unsanitized/DOM"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["unicorn", "react-hooks", "@cloudscape-design/eslint-plugin", "no-unsanitized", "header"],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"react/display-name": "off",
"react/no-danger": "error",
"react/no-unstable-nested-components": ["error", { "allowAsProps": true }],
"react/prop-types": "off",
"react/forbid-component-props": ["warn", { "forbid": ["className", "id"] }],
"react/jsx-boolean-value": ["error", "always"],
"@cloudscape-design/ban-files": [
"error",
[
{
"pattern": "./src/index.ts",
"message": "Disallowed import '{{ path }}' in favor of having smaller bundle sizes."
},
{
"pattern": "./src/*/index.tsx",
"message": "Disallowed import '{{ path }}'. Use the internal component for composition or the interface directly."
}
]
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "typeLike",
"format": ["PascalCase"]
}
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": [
"error",
{
"additionalHooks": "(useContainerQuery|useContainerBreakpoints|useEffectOnUpdate)"
}
],
"unicorn/filename-case": "error",
"curly": "error",
"dot-notation": "error",
"eqeqeq": "error",
"no-return-await": "error",
"require-await": "error",
"header/header": [
"error",
"line",
[" Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.", " SPDX-License-Identifier: Apache-2.0"]
],
"no-warning-comments": "warn"
},
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true
},
"globals": {
// it is a part of es6, but supported in IE11
"Set": true,
"Map": true,
"WeakMap": true
},
"overrides": [
{
"files": ["*.js", "build-tools/**"],
"rules": {
"@typescript-eslint/no-var-requires": "off"
},
"env": {
"browser": false,
"es6": true,
"node": true
}
},
{
"files": ["build-tools/jest/**", "**/__tests__/**", "**/__mocks__/**"],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off"
},
"env": {
"es6": true,
"jasmine": true,
"jest": true
},
"globals": {
"Promise": true
}
},
{
"files": ["build-tools/integ/**", "**/__integ__/**", "**/__a11y__/**"],
"rules": {
// useBrowser is not a React hook
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off"
},
"env": {
"jest": true
}
},
{
"files": ["src/test-utils/**/*.ts"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-non-null-assertion": "off"
}
},
{
"files": ["pages/**"],
"globals": {
"Promise": true
},
"rules": {
"@cloudscape-design/ban-files": [
"error",
[
{
"pattern": "lib/components/**/*",
"message": "Disallowed import '{{ path }}'. Use '~components' instead."
},
{
"pattern": "lib/design-tokens/**/*",
"message": "Disallowed import '{{ path }}'. Use '~design-tokens' instead."
}
]
]
}
},
{
"files": ["src/**"],
"excludedFiles": ["src/**/__tests__/**", "src/**/__integ__/**", "src/**/__a11y__/**"],
"rules": {
"@cloudscape-design/no-implicit-svg-focusable": "error",
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["lodash", "lodash/*"],
"message": "lodash is a commonjs module, which breaks webpack esm optimizations."
}
]
}
]
}
}
]
}