@arcgis/eslint-config 5.2.0-next.99 → 5.2.0

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.
@@ -1,4 +1,4 @@
1
- import eslint from "@eslint/js";
1
+ import * as jsoncParser from "jsonc-eslint-parser";
2
2
  import tsEslint from "typescript-eslint";
3
3
  import restrictedGlobals from "confusing-browser-globals";
4
4
  import globals from "globals";
@@ -11,24 +11,95 @@ import { createTypeScriptImportResolver } from "eslint-import-resolver-typescrip
11
11
  const packageJsonSortableCollections = packageJson.rules["sort-collections"].meta.defaultOptions[0].filter(
12
12
  (collection) => !["scripts", "exports"].includes(collection)
13
13
  ) ?? [];
14
- const importXTypeScriptSettings = { ...importX.flatConfigs.typescript.settings };
15
- delete importXTypeScriptSettings["import-x/resolver"];
14
+ const { "import-x/resolver": legacyResolver, ...importXTypeScriptSettings } = importX.flatConfigs.typescript.settings;
15
+ const markdownLanguageOptions = {
16
+ frontmatter: "yaml"
17
+ };
16
18
  const config = [
17
19
  globalIgnores(["**/www", "**/dist", "**/assets", "**/coverage", "**/.docs"]),
18
20
  {
21
+ // TODO: align the config between .js and .ts file, or drop .js files support entirely
22
+ // As it stands these rules contradict .ts config, or add redundant checks
23
+ // Plus, monorepo disables eslint for .js files so these don't even run
19
24
  files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
20
- ...eslint.configs.recommended
25
+ rules: {
26
+ "constructor-super": "error",
27
+ "for-direction": "error",
28
+ "getter-return": "error",
29
+ "no-async-promise-executor": "error",
30
+ "no-case-declarations": "error",
31
+ "no-class-assign": "error",
32
+ "no-compare-neg-zero": "error",
33
+ "no-cond-assign": "error",
34
+ "no-const-assign": "error",
35
+ "no-constant-binary-expression": "error",
36
+ "no-constant-condition": "error",
37
+ "no-control-regex": "error",
38
+ "no-debugger": "error",
39
+ "no-delete-var": "error",
40
+ "no-dupe-args": "error",
41
+ "no-dupe-class-members": "error",
42
+ "no-dupe-else-if": "error",
43
+ "no-dupe-keys": "error",
44
+ "no-duplicate-case": "error",
45
+ "no-empty": "error",
46
+ "no-empty-character-class": "error",
47
+ "no-empty-pattern": "error",
48
+ "no-empty-static-block": "error",
49
+ "no-ex-assign": "error",
50
+ "no-extra-boolean-cast": "error",
51
+ "no-fallthrough": "error",
52
+ "no-func-assign": "error",
53
+ "no-global-assign": "error",
54
+ "no-import-assign": "error",
55
+ "no-invalid-regexp": "error",
56
+ "no-irregular-whitespace": "error",
57
+ "no-loss-of-precision": "error",
58
+ "no-misleading-character-class": "error",
59
+ "no-new-native-nonconstructor": "error",
60
+ "no-nonoctal-decimal-escape": "error",
61
+ "no-obj-calls": "error",
62
+ "no-octal": "error",
63
+ "no-prototype-builtins": "error",
64
+ "no-redeclare": "error",
65
+ "no-regex-spaces": "error",
66
+ "no-self-assign": "error",
67
+ "no-setter-return": "error",
68
+ "no-shadow-restricted-names": "error",
69
+ "no-sparse-arrays": "error",
70
+ "no-this-before-super": "error",
71
+ "no-unassigned-vars": "error",
72
+ "no-undef": "error",
73
+ "no-unexpected-multiline": "error",
74
+ "no-unreachable": "error",
75
+ "no-unsafe-finally": "error",
76
+ "no-unsafe-negation": "error",
77
+ "no-unsafe-optional-chaining": "error",
78
+ "no-unused-labels": "error",
79
+ "no-unused-private-class-members": "error",
80
+ "no-unused-vars": "error",
81
+ "no-useless-assignment": "error",
82
+ "no-useless-backreference": "error",
83
+ "no-useless-catch": "error",
84
+ "no-useless-escape": "error",
85
+ "no-with": "error",
86
+ "preserve-caught-error": "error",
87
+ "require-yield": "error",
88
+ "use-isnan": "error",
89
+ "valid-typeof": "error"
90
+ }
91
+ },
92
+ {
93
+ files: ["**/*.ts", "**/*.tsx"],
94
+ languageOptions: { parser: tsEslint.parser, sourceType: "module" },
95
+ plugins: { "@typescript-eslint": tsEslint.plugin }
21
96
  },
22
- ...[...tsEslint.configs.strictTypeChecked, ...tsEslint.configs.stylisticTypeChecked].map((config2) => ({
23
- ...config2,
24
- files: ["**/*.ts", "**/*.tsx"]
25
- })),
26
97
  {
27
98
  ...webgisPlugin.configs.recommended,
28
99
  files: ["**/*.ts", "**/*.tsx"]
29
100
  },
30
101
  {
31
- ...importX.flatConfigs.typescript,
102
+ plugins: { "import-x": importX },
32
103
  settings: {
33
104
  ...importXTypeScriptSettings,
34
105
  "import-x/resolver-next": [createTypeScriptImportResolver()]
@@ -49,142 +120,320 @@ const config = [
49
120
  sourceType: "module"
50
121
  },
51
122
  rules: {
52
- //#region Disable rules redundant with Typescript
53
- /**
54
- * The following rules are disabled because they are redundant with
55
- * TypeScript. No need to needlessly slow down ESLint and clutter the
56
- * error messages.
57
- */
58
- // TypeScript reports this
59
- "no-unused-labels": "off",
60
- "@typescript-eslint/no-unused-vars": [
61
- "off",
62
- // This configuration matches TypeScript
123
+ // Require that all overloads for the same method are next to each other in the class
124
+ "@typescript-eslint/adjacent-overload-signatures": "error",
125
+ // Use T[] over Array<T> for consistency
126
+ "@typescript-eslint/array-type": ["warn"],
127
+ // Forbid await of non-promise value
128
+ "@typescript-eslint/await-thenable": "error",
129
+ // Encourage safer ts directive comments, and encourage providing why? comments
130
+ "@typescript-eslint/ban-ts-comment": [
131
+ "error",
63
132
  {
64
- // Allow args and vars that begin with _
65
- // It is sometimes useful to define an unused variable for readability
66
- // (i.e when doing array destructuring).
67
- // TypeScript ignores unused variables starting with _ too
68
- argsIgnorePattern: "^_",
69
- varsIgnorePattern: "^(_|(h|Fragment)$)"
133
+ "ts-expect-error": "allow-with-description",
134
+ "ts-ignore": false,
135
+ "ts-nocheck": "allow-with-description",
136
+ "ts-check": true,
137
+ "minimumDescriptionLength": 3
70
138
  }
71
139
  ],
72
- // Redundant with TypeScript, but has autofix, so enabled for convenience
73
- "no-unsafe-negation": "warn",
74
- // TypeScript reports this
75
- "no-unused-private-class-members": "off",
76
- // TypeScript detects re-declarations like this
77
- "no-case-declarations": "off",
78
- // Narrow use case. Even less with TypeScript
79
- "no-ex-assign": "off",
80
- // Redundant with no-restricted-globals and with TypeScript
81
- "no-global-assign": "off",
82
- // Redundant with prefer-regex-literals, which enforces regex literal
83
- // syntax, which is checked by TypeScript
84
- "no-invalid-regexp": "off",
85
- // TypeScript reports this as syntax error
86
- "no-nonoctal-decimal-escape": "off",
87
- // TypeScript reports this as syntax error
88
- "no-octal": "off",
89
- // TypeScript reports this as type error
90
- "no-unsafe-optional-chaining": "off",
91
- // TypeScript emits an error for with() statements
92
- "no-with": "off",
93
- // TypeScript reports this as a type error
94
- "valid-typeof": "off",
95
- // TypeScript reports this
96
- "@typescript-eslint/prefer-namespace-keyword": "off",
97
- // TypeScript should catch most cases where this can cause issues
98
- "@typescript-eslint/no-confusing-void-expression": "off",
99
- // Many exceptions. Error causes caught by TypeScript. Non-error cases
100
- // create minor code naming inconsistency only.
101
- "new-cap": "off",
102
- // TypeScript reports this
103
- "no-unreachable": "off",
104
- //#endregion
105
- //#region Disable rules Redundant with Prettier
106
- /**
107
- * The following rules are redundant with Prettier
108
- */
109
- "no-unexpected-multiline": "off",
110
- // Outside of comments, this is redundant with Prettier.
111
- // In comments, it is not an issue since comments are stripped in minified
112
- // builds
113
- "no-irregular-whitespace": "off",
114
- //#endregion
115
- //#region Disable obsolete rules
116
- /**
117
- * Obsolete rules (rules that enforced constraints that are no longer
118
- * present in the language, or that are no longer relevant)
119
- */
120
- // Namespaces are needed for defining custom elements
121
- "@typescript-eslint/no-namespace": "off",
122
- // A lot of false positives when dealing with Arcade
123
- "no-template-curly-in-string": "off",
124
- // We don't use TSLint
125
- "@typescript-eslint/ban-tslint-comment": "off",
126
- //#endregion
127
- //#region Disable rules that were moved to extra config
128
- /**
129
- *
130
- * The following default rules are disabled in favor of moving them into the
131
- * @arcgis/eslint-config/extra due to huge number of false positives or
132
- * performance issues.
133
- *
134
- */
135
- // Disabled as per https://devtopia.esri.com/WebGIS/webgis-sdk/discussions/446#discussioncomment-3166
136
- "@typescript-eslint/no-unsafe-return": "off",
137
- /*
138
- * Lot's of false positives on pure functions that don't use
139
- * "this". For example:
140
- * const { whenOnce } = await importCoreReactiveUtils();
141
- */
142
- "@typescript-eslint/unbound-method": "off",
143
- /**
144
- * False positive when constructor exists to improve typing/narrow down the
145
- * type
146
- */
147
- "@typescript-eslint/no-useless-constructor": "off",
148
- //#endregion
149
- //#region Detect possible bugs
150
- /**
151
- *
152
- * The following rules report what is a possible bug. If you are sure that the
153
- * behavior is intentional, you can disable the rule for that line. However,
154
- * consider refactoring to less confusing syntax instead
155
- *
156
- */
157
- // Too many false positives. Some cases require sequential execution of
158
- // async code for correctness, cleaner output, or to avoid performance
159
- // constraints
160
- "no-await-in-loop": "off",
161
- "no-constructor-return": "warn",
162
- "no-fallthrough": ["error", { reportUnusedFallthroughComment: true }],
163
- // This mis-fires for anonymous functions when not wrapped in {}
164
- "no-promise-executor-return": "off",
165
- "no-self-compare": "error",
166
- "no-unreachable-loop": "error",
140
+ // Use a=new Set<T> over a:Set<T>=new Set()
141
+ "@typescript-eslint/consistent-generic-constructors": "error",
142
+ // Use Record<string,string> over {[x in string]: string} for consistency
143
+ "@typescript-eslint/consistent-indexed-object-style": "error",
144
+ // Use `a as b` over `<b>a` TypeScript type casting syntax
145
+ "@typescript-eslint/consistent-type-assertions": [
146
+ "warn",
147
+ {
148
+ assertionStyle: "as",
149
+ // In some cases object literal type assertions are necessary
150
+ objectLiteralTypeAssertions: "allow-as-parameter"
151
+ }
152
+ ],
153
+ // Require `type` keyword when exporting/reexporting types for compatibility
154
+ "@typescript-eslint/consistent-type-exports": ["warn", { fixMixedExportsWithInlineTypeSpecifier: true }],
155
+ "@typescript-eslint/consistent-type-imports": [
156
+ "warn",
157
+ {
158
+ prefer: "type-imports",
159
+ fixStyle: "inline-type-imports",
160
+ // Type imports are necessary in namespaces and global augmentations
161
+ disallowTypeAnnotations: false
162
+ }
163
+ ],
164
+ // Prefer a.b over a["b"]
165
+ "@typescript-eslint/dot-notation": "warn",
166
+ "@typescript-eslint/explicit-function-return-type": [
167
+ // Providing explicit type improves type-checking performance and
168
+ // catches bugs (when actual return type is not what you are expecting,
169
+ // or return type changed accidentally during incorrect refactoring).
170
+ // It also improves code documentation
171
+ // In some cases, explicit type would be very bloated/complicated (i.e in
172
+ // case of mixins), thus you can silence this rule in those cases
173
+ "error",
174
+ {
175
+ allowConciseArrowFunctionExpressionsStartingWithVoid: true
176
+ }
177
+ ],
178
+ // Error if function has 6+ params. Encourage objects instead (easier to
179
+ // add/remove properties without breaking changes, and less bug prone) or
180
+ // smaller functions.
181
+ // TODO: Subjective, and copilot autofixes this badly - needs more discussion.
182
+ "@typescript-eslint/max-params": ["warn", { max: 5 }],
183
+ // "property" style is more type-safe then "method" (has covariance checks)
184
+ "@typescript-eslint/method-signature-style": "warn",
185
+ "@typescript-eslint/naming-convention": [
186
+ "error",
187
+ {
188
+ /*
189
+ * Use camelCase and PascalCase by default
190
+ * Pascal case is allowed because, despite variable names
191
+ * commonly starting with lower case, there are use cases for
192
+ * capital letter:
193
+ * - functional components
194
+ * - React contexts
195
+ * - constructors/dynamically created classes/mixins
196
+ * - enum-like config objects
197
+ */
198
+ selector: "default",
199
+ format: ["camelCase", "PascalCase"],
200
+ // Denotes unused variables. Also may denote private members
201
+ leadingUnderscore: "allow",
202
+ trailingUnderscore: "forbid"
203
+ },
204
+ {
205
+ // TypeLike must be in PascalCase
206
+ selector: "typeLike",
207
+ format: ["PascalCase"]
208
+ },
209
+ {
210
+ // Relax restrictions for keys like `en-US` and etc.
211
+ selector: "default",
212
+ modifiers: ["requiresQuotes"],
213
+ format: null
214
+ },
215
+ {
216
+ // Enum members should be in upper case
217
+ selector: "enumMember",
218
+ format: ["UPPER_CASE"]
219
+ }
220
+ ],
221
+ "@typescript-eslint/no-array-constructor": ["warn"],
222
+ "@typescript-eslint/no-array-delete": "error",
223
+ // Forbid !a==b when a!=b was meant
224
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
225
+ // Catch duplicate union members
226
+ "@typescript-eslint/no-duplicate-type-constituents": ["warn"],
227
+ // Forbid `delete` in favor of Map()
228
+ "@typescript-eslint/no-dynamic-delete": "error",
229
+ // If function is empty, require explanation comment
230
+ // False positives:
231
+ // There can be use cases for this (when providing a callback is required
232
+ // but you don't want to do anything)
233
+ "@typescript-eslint/no-empty-function": [
234
+ "warn",
235
+ {
236
+ allow: ["decoratedFunctions", "overrideMethods"]
237
+ }
238
+ ],
239
+ // Disallow using {} as a type because it means non-nullish `any` rather than empty object
240
+ "@typescript-eslint/no-empty-object-type": ["warn", { allowInterfaces: "with-single-extends" }],
241
+ // TODO: turn this into an error. Discuss with the team why "any" defeats the purpose and benefits of TypeScript.
242
+ // To get all benefits of TypeScript, you have to go all full-in. Use of any
243
+ // may indicate poor code quality, or lack of understanding of TypeScript.
244
+ // In extreme cases, "unknown" should be used instead of any. There are
245
+ // virtually no correct use cases of any
246
+ // TODO: This needs to be resolved before resolving implicit any
247
+ "@typescript-eslint/no-explicit-any": "warn",
248
+ // Forbid duplicate !! non null assertion - possible bug
249
+ "@typescript-eslint/no-extra-non-null-assertion": ["warn"],
250
+ // Encourage objects over static classes.
251
+ // TODO: consider dropping (like in core) because class properties are
252
+ // easier to mark readonly than in objects, and classes are better
253
+ // supported in the docs
254
+ "@typescript-eslint/no-extraneous-class": "error",
255
+ // TODO: discuss more
256
+ // Enabled by default, but this was disabled in component packages per
257
+ // feedback from contributors saying it was too annoying.
258
+ // Also, DOM APIs prefer uncaught exceptions, so floating promises are
259
+ // fine in some cases, especially in web components
260
+ "@typescript-eslint/no-floating-promises": ["warn", { ignoreVoid: true }],
261
+ // Forbid eval()-like functions
262
+ "@typescript-eslint/no-implied-eval": "error",
263
+ "@typescript-eslint/no-import-type-side-effects": "error",
264
+ // Prefer `a = 1` over `a: number = 1`
265
+ "@typescript-eslint/no-inferrable-types": ["warn"],
266
+ "@typescript-eslint/no-meaningless-void-operator": "warn",
267
+ // Catch accidental new(){} in classes when constructor(){} was meant
268
+ "@typescript-eslint/no-misused-new": "error",
269
+ "@typescript-eslint/no-misused-promises": [
270
+ "warn",
271
+ {
272
+ // Redundant with TypeScript
273
+ checksSpreads: false,
274
+ checksVoidReturn: {
275
+ arguments: true,
276
+ // Allow for patterns like ref={focusElement}
277
+ attributes: false,
278
+ inheritedMethods: true,
279
+ properties: true,
280
+ returns: true,
281
+ variables: true
282
+ }
283
+ }
284
+ ],
285
+ // Forbid spread of non-spreadable - may indicate forgotten `await`
286
+ "@typescript-eslint/no-misused-spread": "error",
287
+ // Forbid `foo! ?? bar` (non null with a null check)
288
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
289
+ // Disallow foo?.bar! (nullable asserted as non-nullable)
290
+ "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
291
+ // Catch loss of type precision when `any` in a union overrides all other members
292
+ "@typescript-eslint/no-redundant-type-constituents": "error",
293
+ "@typescript-eslint/no-require-imports": "warn",
294
+ "@typescript-eslint/no-restricted-imports": [
295
+ "error",
296
+ {
297
+ paths: [
298
+ {
299
+ name: "commander",
300
+ importNames: ["Command"],
301
+ message: "Import from @commander-js/extra-typings instead."
302
+ }
303
+ ]
304
+ }
305
+ ],
306
+ // Use `if(a)` over `if(a===true)` for strictly boolean values - autofixable
307
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["warn"],
308
+ "@typescript-eslint/no-unnecessary-condition": "error",
309
+ // Use "a" over `${"a"}`;
310
+ "@typescript-eslint/no-unnecessary-template-expression": "error",
311
+ // Remove needless `extends any` in type parameters
312
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
313
+ // Disallow needless runtim type cast
314
+ "@typescript-eslint/no-unnecessary-type-conversion": "warn",
315
+ // Catch passing any value to function
316
+ "@typescript-eslint/no-unsafe-argument": "error",
317
+ // Catch assignment of any value
318
+ "@typescript-eslint/no-unsafe-assignment": "error",
319
+ // Catch call of any function
320
+ "@typescript-eslint/no-unsafe-call": "error",
321
+ // Forbid using the `Function` type which stands for `any function`
322
+ "@typescript-eslint/no-unsafe-function-type": "error",
323
+ // Catch property access on any
324
+ "@typescript-eslint/no-unsafe-member-access": "error",
325
+ "@typescript-eslint/no-unsafe-unary-minus": "error",
326
+ "@typescript-eslint/no-unused-expressions": "error",
327
+ // TODO: disable because Conflicts with API Extractor. export{} is needed
328
+ // sometimes to disambiguate module jsdoc from first declaration's jsdoc
329
+ "@typescript-eslint/no-useless-empty-export": "warn",
330
+ // Require `string` type over `String`. String is almost never intended
331
+ "@typescript-eslint/no-wrapper-object-types": "error",
332
+ // Use ! over `as T` for non-null casts as it is less type unsafe
333
+ "@typescript-eslint/non-nullable-type-assertion-style": ["warn"],
334
+ // Throw only Error objects to preserve stack trace.
335
+ // TODO: consider dropping due to many false positives and requires
336
+ // configuring exceptions for the custom Error objects core has.
337
+ "@typescript-eslint/only-throw-error": "error",
338
+ // Prefer `a = 4 as const` or `readonly a = 4;` over `a: 4 = 4`
339
+ "@typescript-eslint/prefer-as-const": "error",
340
+ "@typescript-eslint/prefer-find": "error",
341
+ // Use ()=>a over {():a}
342
+ "@typescript-eslint/prefer-function-type": ["warn"],
343
+ "@typescript-eslint/prefer-includes": ["warn"],
344
+ "@typescript-eslint/prefer-optional-chain": ["warn"],
345
+ // Throw only Error objects to preserve stack trace.
346
+ // TODO: drop due to many false positives and requires configuring
347
+ // exceptions for the custom Error objects core has.
348
+ "@typescript-eslint/prefer-promise-reject-errors": "error",
349
+ // Use .reduce<T>(...) over .reduce(()=>..., v as T) for type safety
350
+ "@typescript-eslint/prefer-reduce-type-parameter": ["warn"],
351
+ // Return `this` over the class type to improve subclassing support
352
+ "@typescript-eslint/prefer-return-this-type": ["warn"],
353
+ "@typescript-eslint/prefer-string-starts-ends-with": ["warn"],
354
+ // Better documents code, and if exception occurs, results in a rejected
355
+ // promise rather than an unhandled exception
356
+ "@typescript-eslint/promise-function-async": "warn",
357
+ // Catch when getter and setter types are unrelated. Most commonly when getter may return null but
358
+ // setter doesn't accept nul - likely mistake
359
+ "@typescript-eslint/related-getter-setter-pairs": "error",
360
+ // Require comparision function in .sort() to ensure "2" is before "10"
361
+ // Consider using String.prototype.localeCompare()
362
+ "@typescript-eslint/require-array-sort-compare": "warn",
363
+ // Not an error because:
364
+ // If passing function as a prop, and the function is expected to
365
+ // return a promise, making function async is cleaner than
366
+ // returning Promise.resolve()
367
+ "@typescript-eslint/require-await": "warn",
368
+ // Require + is used only with strings and numbers - arrays must be explicitly concatenated. Avoids
369
+ // surprising implicit stringification
370
+ "@typescript-eslint/restrict-plus-operands": ["warn", { allowNumberAndString: true }],
371
+ // Permit only strings and numbers in `${}` expressions to avoid [object Object]
372
+ "@typescript-eslint/restrict-template-expressions": [
373
+ "warn",
374
+ {
375
+ allowNumber: true
376
+ }
377
+ ],
378
+ // This improves stack traces, improves performance, and makes code more
379
+ // explicit
380
+ "@typescript-eslint/return-await": ["warn", "always"],
381
+ // TODO: replace with perfectionist/sort-intersection-types and perfectionist/sort-union-types rules.
382
+ // Sort type union members
383
+ // Autofixable, so only a warning to be less disruptive
384
+ "@typescript-eslint/sort-type-constituents": "warn",
385
+ // Detect when switch forgot to handle cases. Can be ignored for intentional cases
386
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
387
+ // TODO: drop. While ///reference can sometimes be replaced with imports, not always -
388
+ // this rule has false positives in Lumina
389
+ "@typescript-eslint/triple-slash-reference": "error",
390
+ // Combine function overloads when possible
391
+ "@typescript-eslint/unified-signatures": "error",
167
392
  // This rule can provide optional optimizations. It might be redundant
168
393
  // with TypeScript in some cases, but it provides a less-confusing error
169
394
  // message (for example in .reduce())
170
395
  "array-callback-return": "warn",
171
- // Good rule to have, but many false positives, so only a warning
172
- "require-atomic-updates": "warn",
396
+ "arrow-body-style": "warn",
397
+ // We will enforce strict curly. Rational:
398
+ // - Same as core api
399
+ // - Better for debugging and breakpoints
400
+ "curly": ["warn", "all"],
401
+ // Ensure default: switch case is last for readability
402
+ "default-case-last": "error",
403
+ "eqeqeq": ["error", "always", { null: "ignore" }],
404
+ // Require function(){} syntax to include function name if name is not
405
+ // anomaly assigned by V8 - for debuggability.
406
+ // TODO: drop. In practice, arrow functions have the same issue, so maybe
407
+ // not worth enforcing this inconsistency
408
+ "func-names": ["warn", "as-needed"],
409
+ // Use arrow functions over `const a = function(){}`
410
+ "func-style": ["error", "declaration", { allowArrowFunctions: true, allowTypeAnnotation: true }],
411
+ // Require getter and setter to be next to each other in the class
173
412
  "grouped-accessor-pairs": "error",
413
+ // Rationale: https://devtopia.esri.com/WebGIS/webgis-sdk/issues/289
414
+ // TODO: replace with unicorn/prevent-abbreviations
415
+ "id-denylist": ["error", "elt", "elem", "evt", "ev", "cb"],
416
+ // Encourage ui dialogs over alert/prompt.
417
+ // TODO: discuss dropping. This didn't find any valid cases but found some
418
+ // semi-false positives in tests
419
+ "no-alert": "error",
420
+ "no-caller": "error",
421
+ // Do not use `return;` in constructors
422
+ "no-constructor-return": "warn",
423
+ "no-eval": "error",
424
+ // Forbid extending prototype of built-ins to avoid compatibility issues
425
+ "no-extend-native": "error",
426
+ // Detect needless .bind() usages
174
427
  "no-extra-bind": "warn",
428
+ "no-fallthrough": ["error", { reportUnusedFallthroughComment: true }],
429
+ // Catch numbers that have more decimal points than JS can represent - these are rounded implicitly
430
+ "no-loss-of-precision": "error",
431
+ // Disallow `a = b = 2` in favor of separate lines for readability
175
432
  "no-multi-assign": "error",
176
- // Not an error as some external APIs require calling "new" even if we don't
177
- // care about the retune time. Controllers also use this pattern
178
- "no-new": "off",
179
- // See https://devtopia.esri.com/WebGIS/webgis-sdk/pull/14943#discussion_r1661089
180
- "no-useless-computed-key": "off",
181
- "no-useless-concat": "error",
182
- "no-unneeded-ternary": "warn",
183
- "no-useless-call": "error",
184
- "no-useless-rename": "warn",
185
- // Useless returns are sometimes used for better readability
186
- // i.e "default: return;"
187
- "no-useless-return": "off",
433
+ "no-new-func": "error",
434
+ "no-new-wrappers": "error",
435
+ // Use {} over new Object()
436
+ "no-object-constructor": "error",
188
437
  // Prevent accidental usages of global when forgot to declare a
189
438
  // variable. If you actually mean to use them, prepend with "globalThis."
190
439
  "no-restricted-globals": [
@@ -205,47 +454,6 @@ const config = [
205
454
  },
206
455
  ...restrictedGlobals
207
456
  ],
208
- "@typescript-eslint/no-useless-empty-export": "warn",
209
- // Consider using String.prototype.localeCompare()
210
- "@typescript-eslint/require-array-sort-compare": "warn",
211
- "no-object-constructor": "error",
212
- /**
213
- * Something as simple as this cannot be typed without a TypeScript error
214
- * without using void in place of undefined:
215
- * const a = (callback: ()=>string | undefined) => {};
216
- * a(()=>{ console.log('1'); })
217
- */
218
- "@typescript-eslint/no-invalid-void-type": "off",
219
- "@typescript-eslint/no-empty-object-type": ["warn", { allowInterfaces: "with-single-extends" }],
220
- "@typescript-eslint/no-floating-promises": ["warn", { ignoreVoid: true }],
221
- "@typescript-eslint/restrict-template-expressions": [
222
- "warn",
223
- {
224
- allowNumber: true
225
- }
226
- ],
227
- "@typescript-eslint/restrict-plus-operands": ["warn", { allowNumberAndString: true }],
228
- // We often actually have control characters in our regexes
229
- "no-control-regex": "off",
230
- "@typescript-eslint/no-restricted-imports": [
231
- "error",
232
- {
233
- paths: [
234
- {
235
- name: "commander",
236
- importNames: ["Command"],
237
- message: "Import from @commander-js/extra-typings instead."
238
- }
239
- ]
240
- }
241
- ],
242
- // Functions that deal with JSON.stringify/localStorage may have a type
243
- // parameter as a more readable alternative to a type assertion.
244
- // Also, this rule is quite complicated/expensive.
245
- "@typescript-eslint/no-unnecessary-type-parameters": "off",
246
- // Disabling until this is fixed:
247
- // https://github.com/typescript-eslint/typescript-eslint/issues/9057
248
- "@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
249
457
  /**
250
458
  *
251
459
  * Disallow deprecated and discouraged language syntax
@@ -277,95 +485,29 @@ const config = [
277
485
  message: 'Replace with "createElement as h" (this allows using a single tsconfig.json both for Lumina and Storybook React)'
278
486
  }
279
487
  ],
280
- // We forbid for-in completely, so no need to detect incorrect usages
281
- "@typescript-eslint/no-for-in-array": "off",
282
- "no-alert": "error",
283
- "no-caller": "error",
284
- // TODO: re-enable once https://devtopia.esri.com/WebGIS/webgis-sdk/issues/1519 is fixed
285
- // "no-console": 'error',
286
- "no-eval": "error",
287
- "no-extend-native": "error",
288
- // This creates less readable code
488
+ // Forbid assignments inside return as these are likely unintentional,
489
+ // and not very readable
289
490
  "no-return-assign": "error",
491
+ // Forbid a.href="javascript:alert(1)" as it is eval-like
290
492
  "no-script-url": "error",
291
- // This creates less readable code
493
+ // Forbid a===a needless compare
494
+ "no-self-compare": "error",
495
+ // Detect unexpected use of comma operator - likely syntax error, or
496
+ // less redable code
292
497
  "no-sequences": "error",
293
- "prefer-arrow-callback": ["warn", { allowNamedFunctions: true }],
294
- "prefer-numeric-literals": "warn",
295
- "prefer-object-spread": "warn",
296
- "strict": "warn",
297
- "prefer-template": "warn",
298
- "prefer-object-has-own": "warn",
299
- // Lots of false positives
300
- "@typescript-eslint/no-base-to-string": "off",
301
- "@typescript-eslint/no-meaningless-void-operator": "warn",
302
- "@typescript-eslint/no-empty-function": [
303
- // There can be use cases for this (when providing a callback is required
304
- // but you don't want to do anything)
305
- "warn",
306
- {
307
- allow: ["decoratedFunctions", "overrideMethods"]
308
- }
309
- ],
310
- "no-loss-of-precision": "error",
311
- "@typescript-eslint/switch-exhaustiveness-check": "error",
312
- "default-case-last": "error",
313
- "func-style": ["error", "declaration", { allowArrowFunctions: true, allowTypeAnnotation: true }],
314
- "no-new-func": "error",
315
- "no-new-wrappers": "error",
316
- "@typescript-eslint/no-misused-promises": [
317
- "warn",
318
- {
319
- // Redundant with TypeScript
320
- checksSpreads: false,
321
- checksVoidReturn: {
322
- arguments: true,
323
- // Allow for patterns like ref={focusElement}
324
- attributes: false,
325
- inheritedMethods: true,
326
- properties: true,
327
- returns: true,
328
- variables: true
329
- }
330
- }
331
- ],
332
- // Generally this should be avoided, but some patterns require it
333
- // (type-only getters/setters, or mixins)
334
- "@typescript-eslint/no-unsafe-declaration-merging": "off",
335
- //#endregion
336
- //#region Report consistency issues
337
- // TODO: make these more or less strict as needed
338
- /**
339
- * Consistency and clean code rules
340
- */
341
- "arrow-body-style": "warn",
342
- // This rule is a good idea, but not autofixable, so is only a warning
343
- // TODO: this has basic type imports support. also consider import/no-duplicates
344
- "no-duplicate-imports": "off",
345
- // We will enforce strict curly. Rational:
346
- // - Same as core api
347
- // - Better for debugging and breakpoints
348
- "curly": ["warn", "all"],
349
- "eqeqeq": ["error", "always", { null: "ignore" }],
350
- "func-names": ["warn", "as-needed"],
351
- // Rationale: https://devtopia.esri.com/WebGIS/webgis-sdk/issues/289
352
- // TODO: replace with unicorn/prevent-abbreviations
353
- "id-denylist": ["error", "elt", "elem", "evt", "ev", "cb"],
354
- // Leave it to developer to decide when it is time to refactor-out
355
- "complexity": "off",
356
- // TODO: discuss (this avoids longer lines, improves readability)
357
- // "no-inline-comments": "error",
358
- // TODO: discuss (similar to the rule above, might be redundant).
359
- // "@stylistic/line-comment-position": "error",
360
- // Explicit boolean cast makes code more readable and catches potential bugs
361
- "no-extra-boolean-cast": "off",
362
- /**
363
- * Code like this is useful for readability:
364
- * ```ts
365
- * const component = this;
366
- * ```
367
- */
368
- "@typescript-eslint/no-this-alias": "off",
498
+ // Replace a?true:false with a
499
+ "no-unneeded-ternary": "warn",
500
+ // Forbid loop that always breaks on the first iteration
501
+ "no-unreachable-loop": "error",
502
+ // Forbid !a==b when a!=b was meant. Redundant with TypeScript but has
503
+ // autofix so enabled for convenience
504
+ "no-unsafe-negation": "warn",
505
+ // Catch needless .call() and .apply() usages
506
+ "no-useless-call": "error",
507
+ // Use "ab" over "a" + "b"
508
+ "no-useless-concat": "error",
509
+ "no-useless-rename": "warn",
510
+ "no-var": "error",
369
511
  "no-warning-comments": [
370
512
  "error",
371
513
  {
@@ -389,7 +531,26 @@ const config = [
389
531
  // without moving the line - makes refactoring harder, and makes git's
390
532
  // diff larger
391
533
  "one-var": ["warn", "never"],
534
+ "prefer-arrow-callback": ["warn", { allowNamedFunctions: true }],
535
+ "prefer-const": "warn",
536
+ // Use 0b111110111 over parseInt("111110111", 2).
537
+ // TODO: consider disabling because this is likely too niche - not sure it
538
+ // ever caught anything
539
+ "prefer-numeric-literals": "warn",
540
+ // Use Object.hasOwn over Object.prototype.hasOwnProperty.call
541
+ "prefer-object-has-own": "warn",
542
+ // Use spread over Object.assign
543
+ "prefer-object-spread": "warn",
544
+ // Detect needless new RegExp() that can be written as /regex/
392
545
  "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
546
+ // Use ...rest over `arguments`. Helps v8 optimize
547
+ "prefer-rest-params": "error",
548
+ // Use spread over .apply
549
+ "prefer-spread": "error",
550
+ // Prefer template `${}` syntax over string concat
551
+ "prefer-template": "warn",
552
+ // Good rule to have, but many false positives, so only a warning
553
+ "require-atomic-updates": "warn",
393
554
  // "u" flag in regex does two important things:
394
555
  // - support unicode surrogate paris (properly parse glyphs that are more
395
556
  // than one code point - i.e emojis)
@@ -402,244 +563,69 @@ const config = [
402
563
  // user and you want to be more lenient with parsing (u enables stricter
403
564
  // Regex)
404
565
  "require-unicode-regexp": "error",
405
- // TODO: discuss (or maybe use simple-import-sort)
406
- // 'sort-imports': 'error',
566
+ // Forbid "use strict"; in ESM modules as it is redundant
567
+ "strict": "warn",
568
+ // Require symbols to have a name for easier debugging.
569
+ // TODO: consider dropping. In practice most
570
+ // places in the code only deal with a single symbol kind at a time, so
571
+ // discrimination using a name is not mandatory - leave the name to the developer
407
572
  "symbol-description": "warn",
408
- // Autofixable, so only a warning
409
- "yoda": "warn",
573
+ // Forbid BOM marker as it is needless in utf8. Could be a copy paste error
410
574
  "unicode-bom": "warn",
411
- // Math.pow is more readable than **
412
- "prefer-exponentiation-operator": "off",
413
- "@typescript-eslint/ban-ts-comment": [
414
- "error",
415
- {
416
- "ts-expect-error": "allow-with-description",
417
- "ts-ignore": false,
418
- "ts-nocheck": "allow-with-description",
419
- "ts-check": true,
420
- "minimumDescriptionLength": 3
421
- }
422
- ],
423
- // Getters are slower than direct property access. And if library user has
424
- // TypeScript, overwriting readonly will be flagged as an error
425
- "@typescript-eslint/class-literal-property-style": "off",
426
- "@typescript-eslint/array-type": ["warn"],
427
- "@typescript-eslint/consistent-type-assertions": [
428
- // In some cases object literal type assertions are necessary
429
- "warn",
430
- {
431
- assertionStyle: "as",
432
- objectLiteralTypeAssertions: "allow-as-parameter"
433
- }
434
- ],
435
- "@typescript-eslint/consistent-type-imports": [
436
- "warn",
437
- {
438
- prefer: "type-imports",
439
- fixStyle: "inline-type-imports",
440
- // Type imports are necessary in namespaces and global augmentations
441
- disallowTypeAnnotations: false
442
- }
443
- ],
444
- "@typescript-eslint/consistent-type-exports": ["warn", { fixMixedExportsWithInlineTypeSpecifier: true }],
445
- "@typescript-eslint/no-import-type-side-effects": "error",
446
- "default-param-last": "off",
447
- // `undefined` can also be used to trigger default value
448
- "@typescript-eslint/default-param-last": "off",
449
- "@typescript-eslint/explicit-function-return-type": [
450
- // Providing explicit type improves type-checking performance and
451
- // catches bugs (when actual return type is not what you are expecting,
452
- // or return type changed accidentally during incorrect refactoring).
453
- // It also improves code documentation
454
- // In some cases, explicit type would be very bloated/complicated (i.e in
455
- // case of mixins), thus you can silence this rule in those cases
456
- "error",
457
- {
458
- allowConciseArrowFunctionExpressionsStartingWithVoid: true
459
- }
460
- ],
461
- "max-params": "off",
462
- // Two spaces is more readable than " {2}"
463
- "no-regex-spaces": "off",
464
- "prefer-const": "warn",
465
- "no-var": "error",
466
- // Prefer passing parameters as an object instead to be less error prone
467
- // and make adding/removing properties require less refactoring
468
- "@typescript-eslint/max-params": ["warn", { max: 5 }],
469
- // "property" style is more type-safe then "method" (has covariance checks)
470
- "@typescript-eslint/method-signature-style": "warn",
471
- "@typescript-eslint/no-inferrable-types": ["warn"],
472
- "@typescript-eslint/non-nullable-type-assertion-style": ["warn"],
473
- "@typescript-eslint/dot-notation": "warn",
474
- "@typescript-eslint/prefer-function-type": ["warn"],
475
- "@typescript-eslint/prefer-optional-chain": ["warn"],
476
- "@typescript-eslint/prefer-string-starts-ends-with": ["warn"],
477
- "@typescript-eslint/no-array-constructor": ["warn"],
478
- "@typescript-eslint/no-duplicate-type-constituents": ["warn"],
479
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": ["warn"],
480
- "@typescript-eslint/no-extra-non-null-assertion": ["warn"],
481
- // False positive for the following:
482
- // this.listen<CustomEvent>("arcgisChartsJSDataProcessComplete", this.handleDataProcessComplete);
483
- "@typescript-eslint/no-unnecessary-type-arguments": "off",
484
- // The autofix creates TS errors in makeT9nController(). This is a new
485
- // rule - give it more time to catch the bug cases. Also, this rule
486
- // changes runtime behavior, and may lead to breaking changes.
487
- "@typescript-eslint/no-useless-default-assignment": "off",
488
- // Since https://devtopia.esri.com/WebGIS/webgis-sdk/pull/17821,
489
- // this rule has more true positives, but also many more false positives.
490
- // The autofix often causes TypeScript errors, and new ESLint errors
491
- "@typescript-eslint/no-unnecessary-type-assertion": "off",
492
- "@typescript-eslint/prefer-includes": ["warn"],
493
- "@typescript-eslint/prefer-reduce-type-parameter": ["warn"],
494
- "@typescript-eslint/prefer-return-this-type": ["warn"],
495
- "@typescript-eslint/naming-convention": [
496
- "error",
497
- {
498
- /*
499
- * Use camelCase and PascalCase by default
500
- * Pascal case is allowed because, despite variable names
501
- * commonly starting with lower case, there are use cases for
502
- * capital letter:
503
- * - functional components
504
- * - React contexts
505
- * - constructors/dynamically created classes/mixins
506
- * - enum-like config objects
507
- */
508
- selector: "default",
509
- format: ["camelCase", "PascalCase"],
510
- // Denotes unused variables. Also may denote private members
511
- leadingUnderscore: "allow",
512
- trailingUnderscore: "forbid"
513
- },
514
- {
515
- // TypeLike must be in PascalCase
516
- selector: "typeLike",
517
- format: ["PascalCase"]
518
- },
519
- {
520
- // Relax restrictions for keys like `en-US` and etc.
521
- selector: "default",
522
- modifiers: ["requiresQuotes"],
523
- format: null
524
- },
525
- {
526
- // Enum members should be in upper case
527
- selector: "enumMember",
528
- format: ["UPPER_CASE"]
529
- }
530
- ],
531
- // TODO: turn this into an error. Discuss with the team why "any" defeats the purpose and benefits of TypeScript.
532
- // To get all benefits of TypeScript, you have to go all full-in. Use of any
533
- // may indicate poor code quality, or lack of understanding of TypeScript.
534
- // In extreme cases, "unknown" should be used instead of any. There are
535
- // virtually no correct use cases of any
536
- "@typescript-eslint/no-explicit-any": "warn",
537
- // There are cases where non-null assertions are useful as TypeScript fails
538
- // to detect the preceding non-null check. Example:
539
- // const key = 'key' as string; // Some dynamic key
540
- // const a: Record<string, string[] | undefined> = {};
541
- // a[key] ??= [];
542
- // a[key].push("a"); // False error
543
- //
544
- // Also, while you can explicitly check for non-null and throw an exception,
545
- // if you use !, the browser will automatically throw an exception for you:
546
- // if(someObject == null) throw new Error('someObject is not defined');
547
- // someObject.a();
548
- // is equivalent to:
549
- // someObject!.a();
550
- // (and browser's exception message may be more useful)
551
- //
552
- // More thoughts on this:
553
- // https://github.com/maxpatiiuk/dotfiles/blob/main/npm%2Feslint-config%2Feslint.config.js#L577-L602
554
- "@typescript-eslint/no-non-null-assertion": "off",
555
- "@typescript-eslint/no-require-imports": "warn",
556
- // Better documents code, and if exception occurs, results in a rejected
557
- // promise rather than an unhandled exception
558
- "@typescript-eslint/promise-function-async": "warn",
559
- // Not an error because:
560
- // If passing function as a prop, and the function is expected to
561
- // return a promise, making function async is cleaner than
562
- // returning Promise.resolve()
563
- "@typescript-eslint/require-await": "warn",
564
- // This improves stack traces, improves performance, and makes code more
565
- // explicit
566
- "@typescript-eslint/return-await": ["warn", "always"],
567
- // TODO: replace with perfectionist/sort-intersection-types and perfectionist/sort-union-types rules.
568
- // Autofixable, so only a warning to be less disruptive
569
- "@typescript-eslint/sort-type-constituents": "warn",
570
- // The string.match() is more intuitive than the RegExp.exec()
571
- "@typescript-eslint/prefer-regexp-exec": "off",
572
- // Both types and interfaces have uses in the edge cases. In the common
573
- // cases it often does not matter.
574
- // See alsohttps://www.youtube.com/watch?v=zM9UPcIyyhQ
575
- "@typescript-eslint/consistent-type-definitions": ["off", "type"],
576
- // This is error by default. Turning into warning because it falsely
577
- // reports when component tries to emit an event that is marked as
578
- // deprecated.
579
- "@typescript-eslint/no-deprecated": "warn",
580
- // For can be useful in support packages and hot paths
581
- "@typescript-eslint/prefer-for-of": "off",
582
- // Enums are generally discouraged. Not much harm in this particular issue though
583
- "@typescript-eslint/no-mixed-enums": "off",
584
- // ENUM values like "1<<0" ... "1<<9" are very useful
585
- "@typescript-eslint/prefer-literal-enum-member": "off",
586
- // We discourage enums, so little added value in this check
587
- "@typescript-eslint/no-duplicate-enum-values": "off",
588
- // We discourage enums, so little added value in this check
589
- "@typescript-eslint/no-unsafe-enum-comparison": "off",
590
- // Developer may actually mean to use ||
591
- // Also, refactoring this out may break things
592
- "@typescript-eslint/prefer-nullish-coalescing": "off",
593
- "@typescript-eslint/no-unnecessary-type-conversion": "warn"
594
- //#endregion
575
+ // Use if(a==="b") over if("b"===a) for consistency
576
+ // Autofixable, so only a warning
577
+ "yoda": "warn"
595
578
  // TODO: go over https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting
596
579
  }
597
580
  },
598
- ...markdown.configs.recommended,
599
581
  {
600
582
  files: ["**/*.md"],
583
+ plugins: { markdown },
601
584
  language: "markdown/gfm",
602
- languageOptions: {
603
- frontmatter: "yaml"
604
- },
585
+ languageOptions: markdownLanguageOptions,
605
586
  rules: {
606
- // we don't really use label refs and currently this rule does errors on GFM alerts.
607
- // https://github.com/eslint/markdown/issues/294
608
- "markdown/no-missing-label-refs": ["off"],
587
+ "markdown/fenced-code-language": "error",
588
+ "markdown/heading-increment": "error",
589
+ "markdown/no-duplicate-definitions": "error",
590
+ "markdown/no-empty-definitions": "error",
591
+ "markdown/no-empty-images": "error",
592
+ "markdown/no-empty-links": "error",
593
+ "markdown/no-invalid-label-refs": "error",
594
+ "markdown/no-missing-atx-heading-space": "error",
595
+ "markdown/no-missing-link-fragments": "error",
609
596
  // We allow frontmatter titles to be different from the h1 by setting to "" which never matches
610
597
  // This is useful to have a shorter title in the TOC than on the page.
611
- "markdown/no-multiple-h1": ["error", { frontmatterTitle: "" }]
598
+ "markdown/no-multiple-h1": ["error", { frontmatterTitle: "" }],
599
+ "markdown/no-reference-like-urls": "error",
600
+ "markdown/no-reversed-media-syntax": "error",
601
+ "markdown/no-space-in-emphasis": "error",
602
+ "markdown/no-unused-definitions": "error",
603
+ "markdown/require-alt-text": "error",
604
+ "markdown/table-column-count": "error"
612
605
  }
613
606
  },
614
607
  {
615
608
  // Don't do type-aware linting for untyped files
616
609
  files: ["**/*.js"],
617
- ...tsEslint.configs.disableTypeChecked
610
+ languageOptions: {
611
+ parserOptions: {
612
+ program: null,
613
+ project: false,
614
+ projectService: false
615
+ }
616
+ }
618
617
  },
619
- packageJson.configs.recommended,
620
618
  {
621
619
  files: ["**/package.json"],
620
+ plugins: { "package-json": packageJson },
621
+ languageOptions: { parser: jsoncParser },
622
622
  rules: {
623
- // We don't want to sort scripts and exports
624
- "package-json/sort-collections": ["warn", packageJsonSortableCollections],
625
- // Making a warning for now to avoid disrupting current work but we should go to error later
626
- "package-json/require-description": "warn",
627
623
  "package-json/bin-name-casing": "warn",
628
624
  // Allow empty "files" field to explicitly indicate that no files
629
625
  // should be included in the package
630
626
  "package-json/no-empty-fields": ["error", { ignoreProperties: ["files"] }],
631
- // We use license instead
632
- "package-json/require-attribution": "off",
633
- // We are not open source
634
- "package-json/require-repository": "off",
635
- // This option is tricky to set right, especially for web component
636
- // libraries that have many side effect entrypoints. It can also get out
637
- // of date easily. If we don't explicitly indicate sideEffects, bundlers
638
- // have good default AST-based heuristics.
639
- "package-json/require-sideEffects": "off",
640
- // Can't address these till 6.0 without breaking changes.
641
- // Most errors are in react wrappers which will be dropped in 6.0.
642
- "package-json/require-exports": "off",
627
+ "package-json/no-redundant-files": "error",
628
+ "package-json/no-redundant-publishConfig": "error",
643
629
  // Enforce a specific property order for better readability and consistency
644
630
  "package-json/order-properties": [
645
631
  "warn",
@@ -671,7 +657,55 @@ const config = [
671
657
  "packageManager"
672
658
  ]
673
659
  }
674
- ]
660
+ ],
661
+ "package-json/repository-shorthand": "error",
662
+ // Making a warning for now to avoid disrupting current work but we should go to error later
663
+ "package-json/require-description": "warn",
664
+ "package-json/require-files": "error",
665
+ "package-json/require-license": "error",
666
+ "package-json/require-name": "error",
667
+ "package-json/require-type": "error",
668
+ "package-json/require-version": "error",
669
+ // We don't want to sort scripts and exports
670
+ "package-json/sort-collections": ["warn", packageJsonSortableCollections],
671
+ "package-json/specify-peers-locally": "error",
672
+ "package-json/unique-dependencies": "error",
673
+ "package-json/valid-author": "error",
674
+ "package-json/valid-bin": "error",
675
+ "package-json/valid-bugs": "error",
676
+ "package-json/valid-bundleDependencies": "error",
677
+ "package-json/valid-config": "error",
678
+ "package-json/valid-contributors": "error",
679
+ "package-json/valid-cpu": "error",
680
+ "package-json/valid-dependencies": "error",
681
+ "package-json/valid-description": "error",
682
+ "package-json/valid-devDependencies": "error",
683
+ "package-json/valid-devEngines": "error",
684
+ "package-json/valid-directories": "error",
685
+ "package-json/valid-engines": "error",
686
+ "package-json/valid-exports": "error",
687
+ "package-json/valid-files": "error",
688
+ "package-json/valid-funding": "error",
689
+ "package-json/valid-homepage": "error",
690
+ "package-json/valid-keywords": "error",
691
+ "package-json/valid-license": "error",
692
+ "package-json/valid-main": "error",
693
+ "package-json/valid-man": "error",
694
+ "package-json/valid-module": "error",
695
+ "package-json/valid-name": "error",
696
+ "package-json/valid-optionalDependencies": "error",
697
+ "package-json/valid-os": "error",
698
+ "package-json/valid-packageManager": "error",
699
+ "package-json/valid-peerDependencies": "error",
700
+ "package-json/valid-private": "error",
701
+ "package-json/valid-publishConfig": "error",
702
+ "package-json/valid-repository": "error",
703
+ "package-json/valid-repository-directory": "error",
704
+ "package-json/valid-scripts": "error",
705
+ "package-json/valid-sideEffects": "error",
706
+ "package-json/valid-type": "error",
707
+ "package-json/valid-version": "error",
708
+ "package-json/valid-workspaces": "error"
675
709
  }
676
710
  }
677
711
  ];