-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.json
175 lines (167 loc) · 5.02 KB
/
.eslintrc.json
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
{
"root": true,
"extends": ["@pega"],
"parserOptions": {
"project": "tsconfig.json",
"ecmaVersion": 13,
"sourceType": "module"
},
"globals": {
"PCore": "readonly"
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"settings": {
"import/resolver": {
"typescript": {},
"node": {
"extensions": [".js", ".jsx"]
}
},
"react": {
"version": "detect"
}
},
"ignorePatterns": ["node_modules", "packages/*/lib", "!.storybook", ".storybook/public", "**/**/*.json"],
"rules": {
// Note: the "0" means to allow it. 1 = warning, 2 = error
"react/jsx-filename-extension": [0, { "extensions": [".jsx", "*.tsx"] }],
// Prettier recommends running separately from a linter.
// https://prettier.io/docs/en/integrating-with-linters.html#notes
"prettier/prettier": "off",
// Disable rules from shared configs we're not ready for yet.
"sonarjs/cognitive-complexity": ["warn", 20],
"sonarjs/no-duplicate-string": "off",
//
// Initial release: turning these off; phase in to "warn" or "error" over time
// For "quotes" and "@typescript-eslint/quotes", see override below for .ts/.tsx files
"import/extensions": ["off", "never"],
"import/named": "off",
"import/no-cycle": "off",
"import/no-duplicates": "off",
"import/no-extraneous-dependencies": "off",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/no-self-import": "off",
"import/no-unresolved": "off",
"import/no-useless-path-segments": "off",
"import/order": "off",
"no-underscore-dangle": "off", // TODO : adhere to standard naming
"no-restricted-syntax": "off", // TODO : fix for-in loops
"jsx-a11y/alt-text": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/no-static-element-interactions": "off",
"@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions
"@typescript-eslint/ban-types": "off", // also, see override below
"import/no-relative-packages": "off" // arnab
},
"overrides": [
{
"files": "*.@(ts|tsx)",
"rules": {
"@typescript-eslint/method-signature-style": ["error", "property"],
// "@typescript-eslint/ban-types": [
// "warn",
// {
// "types": {
// "Omit": "Please use the 'OmitStrict' type from 'src/types/' instead.",
// "object": false,
// "Function": false
// },
// "extendDefaults": true
// }
// ],
"quotes": "off",
"@typescript-eslint/quotes": "off"
// [
// "error",
// "single",
// {
// "avoidEscape": true,
// "allowTemplateLiterals": false
// }
// ]
}
},
{
"files": "*.@(jsx|tsx|mdx)",
"rules": {
"react/react-in-jsx-scope": "off",
// Set up configuration for future sweep
"react-hooks/exhaustive-deps": [
"off",
{
"additionalHooks": "useAfterInitialEffect"
}
]
}
},
{
"files": "*.@(js|jsx|ts|tsx|mdx)",
"rules": {}
},
{
"files": ".storybook/*.js",
"extends": ["@pega/eslint-config/script"]
},
{
"files": "*/**/mocks/**.@(mocks|styles).@(tsx|ts)",
"rules": {
"import/prefer-default-export": ["off"]
}
},
// associated components eslint rules to match DXCB
{
"files": ["**/custom-constellation/**/*.@(js|jsx)"],
"rules": {
"import/no-relative-packages": "off",
"import/prefer-default-export": "off",
"@typescript-eslint/no-shadow": "error",
"react/jsx-fragments": "off",
"no-undef": "error",
"no-console": "error",
"prefer-regex-literals": "off",
"sonarjs/cognitive-complexity": ["warn", 50]
}
},
{
"files": ["**/custom-constellation/**/*.@(ts|tsx)"],
"rules": {
"eqeqeq": "off",
"no-alert": "off",
"no-console": "off",
"no-fallthrough": "error",
"no-undef": "off",
"no-unused-vars": "off",
"no-var": "off",
"yoda": "error",
"no-irregular-whitespace": "off",
"no-empty": "off",
"no-new-object": "off",
"react/jsx-fragments": "off",
"import/prefer-default-export": "off",
"@typescript-eslint/no-inferrable-types": "error",
// "@typescript-eslint/array-type": ["error", { "default": "generic" }],
"@typescript-eslint/array-type": "off",
"sonarjs/cognitive-complexity": ["warn", 45],
"react-hooks/exhaustive-deps": [
"error",
{
"additionalHooks": "useAfterInitialEffect"
}
]
}
},
{
"files": ["**/custom-sdk/**/**/mock.stories.js"],
"rules": {
"storybook/default-exports": "off"
}
}
]
}