@odg/eslint-config 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +126 -0
- package/package.json +1 -1
- package/rules/javascript/best-practices.js +6 -2
package/index.js
CHANGED
|
@@ -143,6 +143,132 @@ module.exports = {
|
|
|
143
143
|
project: [ "tsconfig.json", "@odg/tsconfig/tsconfig.json" ], // Specify it only for TypeScript files
|
|
144
144
|
},
|
|
145
145
|
},
|
|
146
|
+
{
|
|
147
|
+
files: [ "*.tsx" ],
|
|
148
|
+
rules: {
|
|
149
|
+
"import/no-anonymous-default-export": [ "off" ],
|
|
150
|
+
"@typescript-eslint/naming-convention": [
|
|
151
|
+
"error",
|
|
152
|
+
{
|
|
153
|
+
|
|
154
|
+
selector: [
|
|
155
|
+
"function",
|
|
156
|
+
],
|
|
157
|
+
format: [
|
|
158
|
+
"PascalCase",
|
|
159
|
+
"camelCase",
|
|
160
|
+
],
|
|
161
|
+
|
|
162
|
+
// We allow double underscore because of GraphQL type names and some React names.
|
|
163
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
164
|
+
trailingUnderscore: "allow",
|
|
165
|
+
|
|
166
|
+
// Ignore `{'Retry-After': retryAfter}` type properties.
|
|
167
|
+
filter: {
|
|
168
|
+
regex: "[- ]",
|
|
169
|
+
match: false,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
|
|
174
|
+
selector: [
|
|
175
|
+
"variable",
|
|
176
|
+
"function",
|
|
177
|
+
"parameterProperty",
|
|
178
|
+
"classMethod",
|
|
179
|
+
"objectLiteralMethod",
|
|
180
|
+
"typeMethod",
|
|
181
|
+
"accessor",
|
|
182
|
+
],
|
|
183
|
+
format: [
|
|
184
|
+
"strictCamelCase",
|
|
185
|
+
"camelCase",
|
|
186
|
+
],
|
|
187
|
+
|
|
188
|
+
// We allow double underscore because of GraphQL type names and some React names.
|
|
189
|
+
leadingUnderscore: "allowSingleOrDouble",
|
|
190
|
+
trailingUnderscore: "allow",
|
|
191
|
+
|
|
192
|
+
// Ignore `{'Retry-After': retryAfter}` type properties.
|
|
193
|
+
filter: {
|
|
194
|
+
regex: "[- ]",
|
|
195
|
+
match: false,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
selector: "classProperty",
|
|
200
|
+
format: [
|
|
201
|
+
"strictCamelCase",
|
|
202
|
+
"camelCase",
|
|
203
|
+
"UPPER_CASE",
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
selector: "typeLike",
|
|
208
|
+
format: [
|
|
209
|
+
"PascalCase",
|
|
210
|
+
"camelCase",
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
selector: "variable",
|
|
215
|
+
types: [
|
|
216
|
+
"boolean",
|
|
217
|
+
],
|
|
218
|
+
format: [
|
|
219
|
+
"StrictPascalCase",
|
|
220
|
+
],
|
|
221
|
+
prefix: [
|
|
222
|
+
"is",
|
|
223
|
+
"has",
|
|
224
|
+
"can",
|
|
225
|
+
"should",
|
|
226
|
+
"will",
|
|
227
|
+
"did",
|
|
228
|
+
"does",
|
|
229
|
+
"are",
|
|
230
|
+
"do",
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
|
|
235
|
+
selector: "interface",
|
|
236
|
+
format: [
|
|
237
|
+
"PascalCase",
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
|
|
242
|
+
// Type parameter name should either be `T` or a descriptive name.
|
|
243
|
+
selector: "typeParameter",
|
|
244
|
+
filter: /^T$|^[A-Z][A-Za-z]+$/.source,
|
|
245
|
+
format: [
|
|
246
|
+
"StrictPascalCase",
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
// Allow these in non-camel-case when quoted.
|
|
251
|
+
{
|
|
252
|
+
selector: [
|
|
253
|
+
"classProperty",
|
|
254
|
+
"objectLiteralProperty",
|
|
255
|
+
],
|
|
256
|
+
format: null,
|
|
257
|
+
modifiers: [
|
|
258
|
+
"requiresQuotes",
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
files: [ "*.config.ts", "*.config.mts" ],
|
|
266
|
+
rules: {
|
|
267
|
+
"import/no-anonymous-default-export": [ "off" ],
|
|
268
|
+
"filenames/match-exported": [ "off" ],
|
|
269
|
+
"import/no-extraneous-dependencies": [ "off" ],
|
|
270
|
+
},
|
|
271
|
+
},
|
|
146
272
|
{
|
|
147
273
|
files: [ "*.json", "*.json5", "*.jsonc", ".eslintrc", "*.code-*" ],
|
|
148
274
|
plugins: [ "jsonc" ],
|
package/package.json
CHANGED
|
@@ -324,10 +324,14 @@ module.exports = {
|
|
|
324
324
|
"**/vue.config.{js,ts}",
|
|
325
325
|
"**/webpack.config.*.{js,ts}",
|
|
326
326
|
"**/webpack.config.{js,ts}",
|
|
327
|
+
"*.config.ts",
|
|
328
|
+
"*.config.mts",
|
|
329
|
+
"electron",
|
|
330
|
+
"electron**",
|
|
327
331
|
],
|
|
328
332
|
"optionalDependencies": true,
|
|
329
|
-
"peerDependencies":
|
|
330
|
-
"bundledDependencies":
|
|
333
|
+
"peerDependencies": true,
|
|
334
|
+
"bundledDependencies": true,
|
|
331
335
|
},
|
|
332
336
|
], // Não dependa de pacotes em devDependencies
|
|
333
337
|
"import/order": [
|