forked from redhat-developer/app-services-ui-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
93 lines (93 loc) · 2.71 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
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
"ecmaVersion": 2020,
"sourceType": "module",
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint", "react-hooks", "deprecation"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:storybook/recommended",
"prettier",
],
rules: {
"deprecation/deprecation": "error",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error",
"no-restricted-imports": [
"error",
{
paths: [
{
name: ".",
message:
"Please import sibling components explictly to avoid cyclic dependencies",
},
{
name: "./",
message:
"Please import sibling components explictly to avoid cyclic dependencies",
},
{
name: "dayjs",
message: "Please use date-fns instead",
},
{
name: "date-fns",
importNames: ["format"],
message:
"Please use format or formatInTimeZone from date-fns-tz instead",
},
],
patterns: [
{
group: ["@patternfly/react-icons/dist/*"],
message:
"Please use the ESM import of the icon, eg. `import { TimesIcon } from '@patternfly/react-icons' instead of `import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';`",
},
{
group: ["@patternfly/react-tokens/dist/*"],
message: "Please use the ESM import",
},
{
group: ["date-fns/*"],
message: "Please use the ESM import",
},
],
},
],
},
overrides: [
{
files: ["*.test.ts", "*.test.tsx", "*.stories.tsx"],
rules: {
"@typescript-eslint/no-non-null-assertion": "off",
},
},
{
files: ["*.stories.tsx", "storybookHelpers.tsx"],
rules: {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
{
files: ["*Machine.ts"],
rules: {
"@typescript-eslint/consistent-type-imports": "off",
},
},
],
ignorePatterns: ["ProofOfconcepts", "*.typegen.ts"],
};