@arcgis/eslint-config 4.33.0-next.16 → 4.33.0-next.160
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/dist/config/applications.d.ts +5 -0
- package/dist/config/applications.js +40 -0
- package/dist/config/extra.js +2 -3
- package/dist/config/index.d.ts +2 -19
- package/dist/config/index.js +52 -123
- package/dist/config/lumina.d.ts +1 -5
- package/dist/config/lumina.js +17 -20
- package/dist/config/storybook.d.ts +1 -1
- package/dist/makePlugin-DEVY1iGf.js +38 -0
- package/dist/plugins/lumina/index.d.ts +1 -2
- package/dist/plugins/lumina/index.js +2242 -5
- package/dist/plugins/lumina/plugin.d.ts +8 -0
- package/dist/plugins/lumina/rules/add-missing-jsx-import.d.ts +2 -1
- package/dist/plugins/lumina/rules/auto-add-type.d.ts +3 -2
- package/dist/plugins/lumina/rules/ban-events.d.ts +6 -0
- package/dist/plugins/lumina/rules/component-placement-rules.d.ts +2 -1
- package/dist/plugins/lumina/rules/consistent-event-naming.d.ts +2 -2
- package/dist/plugins/lumina/rules/consistent-nullability.d.ts +2 -0
- package/dist/plugins/lumina/rules/decorators-context.d.ts +2 -1
- package/dist/plugins/lumina/rules/explicit-setter-type.d.ts +19 -0
- package/dist/plugins/lumina/rules/member-ordering/build.d.ts +3 -3
- package/dist/plugins/lumina/rules/member-ordering/comments.d.ts +2 -2
- package/dist/plugins/lumina/rules/member-ordering/config.d.ts +1 -1
- package/dist/plugins/lumina/rules/member-ordering/normalize.d.ts +2 -2
- package/dist/plugins/lumina/rules/member-ordering.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-create-element-component.d.ts +2 -0
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.d.ts +3 -2
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-jsx-spread.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-non-component-exports.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-render-false.d.ts +3 -2
- package/dist/plugins/lumina/rules/no-unnecessary-assertion-on-event.d.ts +3 -0
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.d.ts +2 -1
- package/dist/plugins/lumina/rules/no-unnecessary-key.d.ts +2 -1
- package/dist/plugins/lumina/rules/tag-name-rules.d.ts +2 -2
- package/dist/plugins/lumina/utils/checker.d.ts +3 -1
- package/dist/plugins/lumina/utils/estree.d.ts +2 -1
- package/dist/plugins/lumina/utils/tags.d.ts +14 -0
- package/dist/plugins/utils/makePlugin.d.ts +12 -13
- package/dist/plugins/webgis/index.d.ts +1 -2
- package/dist/plugins/webgis/index.js +180 -5
- package/dist/plugins/webgis/plugin.d.ts +8 -0
- package/dist/plugins/webgis/rules/no-dts-files.d.ts +2 -0
- package/dist/plugins/webgis/rules/no-import-outside-src.d.ts +2 -1
- package/dist/plugins/webgis/rules/no-touching-jsdoc.d.ts +2 -1
- package/dist/plugins/webgis/rules/require-js-in-imports.d.ts +2 -0
- package/package.json +9 -10
- package/dist/chunk-2ND3FRSX.js +0 -160
- package/dist/chunk-C76ANB4Z.js +0 -26
- package/dist/chunk-PVNFCQDL.js +0 -1975
- package/dist/plugins/lumina/rules/add-missing-jsx-import.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/auto-add-type.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/component-placement-rules.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/consistent-event-naming.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/decorators-context.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/member-ordering.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-ignore-jsdoc-tag.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-incorrect-dynamic-tag-name.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-inline-arrow-in-ref.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-invalid-directives-prop.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-jsx-spread.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-listen-in-connected-callback.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-non-component-exports.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-property-name-start-with-on.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-render-false.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-unnecessary-attribute-name.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-unnecessary-bind-this.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/no-unnecessary-key.test.d.ts +0 -1
- package/dist/plugins/lumina/rules/tag-name-rules.spec.d.ts +0 -1
- package/dist/plugins/lumina/utils/creator.d.ts +0 -3
- package/dist/plugins/utils/tests.d.ts +0 -26
- package/dist/plugins/webgis/rules/no-import-outside-src.test.d.ts +0 -1
- package/dist/plugins/webgis/rules/no-touching-jsdoc.test.d.ts +0 -1
- package/dist/plugins/webgis/rules/require-js-in-core-import.d.ts +0 -1
- package/dist/plugins/webgis/rules/require-js-in-core-import.test.d.ts +0 -1
- package/dist/plugins/webgis/utils/creator.d.ts +0 -3
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const _default: (TSESLint.FlatConfig.Config | import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | {
|
|
3
|
+
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
|
4
|
+
})[];
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import defaultConfig from "./index.js";
|
|
2
|
+
const applications = [
|
|
3
|
+
...defaultConfig,
|
|
4
|
+
{
|
|
5
|
+
rules: {
|
|
6
|
+
// Not autofixable. Can be annoying
|
|
7
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
8
|
+
// Less important in apps than in libraries
|
|
9
|
+
// Though, explicit return type improve TypeScript performance
|
|
10
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
11
|
+
// Less important for non-public APIs.
|
|
12
|
+
// And can be tedious to refactor existing code.
|
|
13
|
+
"@typescript-eslint/max-params": "off",
|
|
14
|
+
// No big harm in letting people do this if they want to
|
|
15
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
16
|
+
// A convenient lazy variant, but less safe
|
|
17
|
+
"@typescript-eslint/no-unsafe-function-type": "off",
|
|
18
|
+
// Non-customer-facing code can handle Errors in what way is most convenient
|
|
19
|
+
"@typescript-eslint/only-throw-error": "off",
|
|
20
|
+
// Non-customer-facing code can handle Errors in what way is most convenient
|
|
21
|
+
"@typescript-eslint/prefer-promise-reject-errors": "off",
|
|
22
|
+
// A trade off between developer convenience and code quality
|
|
23
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
24
|
+
// A trade off between developer convenience and code quality
|
|
25
|
+
"@typescript-eslint/promise-function-async": "off",
|
|
26
|
+
// Let developer decide to add or omit it. If not present, creates
|
|
27
|
+
// worse exception messages.
|
|
28
|
+
"func-names": "off",
|
|
29
|
+
// This rule is for consistency between library developers - less important for monolith apps.
|
|
30
|
+
"id-denylist": "off",
|
|
31
|
+
// Some cases actually require sequential async loops
|
|
32
|
+
"no-await-in-loop": "off",
|
|
33
|
+
// More important for library-exposed symbols than apps
|
|
34
|
+
"symbol-description": "off"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
export {
|
|
39
|
+
applications as default
|
|
40
|
+
};
|
package/dist/config/extra.js
CHANGED
package/dist/config/index.d.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* https://qawebgis.esri.com/components/monorepo/support-packages/eslint
|
|
4
|
-
*
|
|
5
|
-
* Some advice on editing rules:
|
|
6
|
-
* - prioritize autofixable rules to make adoption in existing codebases easier
|
|
7
|
-
* - disable redundant rules (rules redundant with TypeScript, or each other),
|
|
8
|
-
* to reduce noise and performance impact
|
|
9
|
-
* - if rule is always auto-fixable, it may be a good idea to emit it as a
|
|
10
|
-
* warning instead of an error to be less disruptive when the developer is
|
|
11
|
-
* typing code
|
|
12
|
-
* - emit rules that have a lot of false positives as warnings instead of errors
|
|
13
|
-
* - provide justification for enabling opinionated rules
|
|
14
|
-
* - provide justification for disabling default rules
|
|
15
|
-
* - if rule is disabled because it's buggy, describe how so
|
|
16
|
-
* (code sample, GitHub issue, permalink to file, etc)
|
|
17
|
-
*/
|
|
18
|
-
import type { TSESLint } from "@typescript-eslint/utils";
|
|
19
|
-
declare const _default: (TSESLint.FlatConfig.Config | {
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const _default: (TSESLint.FlatConfig.Config | import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | {
|
|
20
3
|
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
|
21
4
|
})[];
|
|
22
5
|
export default _default;
|
package/dist/config/index.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
webgis_default
|
|
3
|
-
} from "../chunk-2ND3FRSX.js";
|
|
4
|
-
import "../chunk-C76ANB4Z.js";
|
|
5
|
-
|
|
6
|
-
// src/config/index.ts
|
|
7
1
|
import eslint from "@eslint/js";
|
|
8
2
|
import tsEslint from "typescript-eslint";
|
|
9
3
|
import restrictedGlobals from "confusing-browser-globals";
|
|
10
4
|
import globals from "globals";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
import { webgisPlugin } from "../plugins/webgis/index.js";
|
|
6
|
+
import { globalIgnores } from "eslint/config";
|
|
7
|
+
const defaultConfig = [
|
|
8
|
+
globalIgnores(["**/www", "**/dist", "**/assets", "**/coverage", "**/.docs"]),
|
|
15
9
|
eslint.configs.recommended,
|
|
16
10
|
...tsEslint.configs.strictTypeChecked,
|
|
17
11
|
...tsEslint.configs.stylisticTypeChecked,
|
|
18
12
|
{
|
|
19
|
-
...
|
|
13
|
+
...webgisPlugin.configs.recommended,
|
|
20
14
|
files: ["**/*.ts", "**/*.tsx"]
|
|
21
15
|
},
|
|
22
16
|
{
|
|
23
17
|
files: ["**/*.ts", "**/*.tsx"],
|
|
24
18
|
linterOptions: {
|
|
25
|
-
reportUnusedDisableDirectives: "error"
|
|
19
|
+
reportUnusedDisableDirectives: "error",
|
|
20
|
+
reportUnusedInlineConfigs: "error"
|
|
26
21
|
},
|
|
27
22
|
languageOptions: {
|
|
28
23
|
globals: {
|
|
@@ -79,6 +74,13 @@ var config_default = [
|
|
|
79
74
|
"valid-typeof": "off",
|
|
80
75
|
// TypeScript reports this
|
|
81
76
|
"@typescript-eslint/prefer-namespace-keyword": "off",
|
|
77
|
+
// TypeScript should catch most cases where this can cause issues
|
|
78
|
+
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
79
|
+
// Many exceptions. Error causes caught by TypeScript. Non-error cases
|
|
80
|
+
// create minor code naming inconsistency only.
|
|
81
|
+
"new-cap": "off",
|
|
82
|
+
// TypeScript reports this
|
|
83
|
+
"no-unreachable": "off",
|
|
82
84
|
//#endregion
|
|
83
85
|
//#region Disable rules Redundant with Prettier
|
|
84
86
|
/**
|
|
@@ -150,8 +152,8 @@ var config_default = [
|
|
|
150
152
|
"no-extra-bind": "warn",
|
|
151
153
|
"no-multi-assign": "error",
|
|
152
154
|
// Not an error as some external APIs require calling "new" even if we don't
|
|
153
|
-
// care about the retune time
|
|
154
|
-
"no-new": "
|
|
155
|
+
// care about the retune time. Controllers also use this pattern
|
|
156
|
+
"no-new": "off",
|
|
155
157
|
"no-useless-computed-key": ["warn", { enforceForClassMembers: true }],
|
|
156
158
|
"no-useless-concat": "error",
|
|
157
159
|
"no-unneeded-ternary": "warn",
|
|
@@ -164,35 +166,21 @@ var config_default = [
|
|
|
164
166
|
// variable. If you actually mean to use them, prepend with "globalThis."
|
|
165
167
|
"no-restricted-globals": [
|
|
166
168
|
"error",
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
"Infinity",
|
|
183
|
-
// use Number.NaN instead
|
|
184
|
-
"NaN",
|
|
185
|
-
// use Number.isNaN instead
|
|
186
|
-
"isNaN",
|
|
187
|
-
// Use Number.isFinite instead
|
|
188
|
-
"isFinite",
|
|
189
|
-
// use Number.parseFloat instead
|
|
190
|
-
"parseFloat",
|
|
191
|
-
// use Number.parseInt instead
|
|
192
|
-
"parseInt",
|
|
193
|
-
// Use Object.keys instead
|
|
194
|
-
"keys"
|
|
195
|
-
])
|
|
169
|
+
"i",
|
|
170
|
+
"index",
|
|
171
|
+
{
|
|
172
|
+
name: "isNaN",
|
|
173
|
+
message: "Use Number.isNaN instead as it has more predictable behavior. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN#description"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "isFinite",
|
|
177
|
+
message: "Use Number.isFinite instead as it has more predictable behavior. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN#description (same applies to isFinite)"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: "parseInt",
|
|
181
|
+
message: "Use Number.parseInt instead for more predicable parsing behavior. Also, radix=10 is the default for Number.parseInt, so you can omit it."
|
|
182
|
+
},
|
|
183
|
+
...restrictedGlobals
|
|
196
184
|
],
|
|
197
185
|
"@typescript-eslint/no-useless-empty-export": "warn",
|
|
198
186
|
// Consider using String.prototype.localeCompare()
|
|
@@ -275,16 +263,7 @@ var config_default = [
|
|
|
275
263
|
"prefer-object-has-own": "warn",
|
|
276
264
|
// Lots of false positives
|
|
277
265
|
"@typescript-eslint/no-base-to-string": "off",
|
|
278
|
-
"@typescript-eslint/no-
|
|
279
|
-
"error",
|
|
280
|
-
{
|
|
281
|
-
ignoreArrowShorthand: true,
|
|
282
|
-
ignoreVoidOperator: true
|
|
283
|
-
}
|
|
284
|
-
],
|
|
285
|
-
// Conflicts with @typescript-eslint/no-confusing-void-expression
|
|
286
|
-
// See https://github.com/typescript-eslint/typescript-eslint/issues/4507
|
|
287
|
-
"@typescript-eslint/no-meaningless-void-operator": "off",
|
|
266
|
+
"@typescript-eslint/no-meaningless-void-operator": "warn",
|
|
288
267
|
"@typescript-eslint/no-empty-function": [
|
|
289
268
|
// There can be use cases for this (when providing a callback is required
|
|
290
269
|
// but you don't want to do anything)
|
|
@@ -315,6 +294,9 @@ var config_default = [
|
|
|
315
294
|
}
|
|
316
295
|
}
|
|
317
296
|
],
|
|
297
|
+
// Generally this should be avoided, but some patterns require it
|
|
298
|
+
// (type-only getters/setters, or mixins)
|
|
299
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
318
300
|
//#endregion
|
|
319
301
|
//#region Report consistency issues
|
|
320
302
|
// TODO: make these more or less strict as needed
|
|
@@ -334,26 +316,8 @@ var config_default = [
|
|
|
334
316
|
// Rationale: https://devtopia.esri.com/WebGIS/arcgis-web-components/issues/289
|
|
335
317
|
// TODO: replace with unicorn/prevent-abbreviations
|
|
336
318
|
"id-denylist": ["error", "elt", "elem", "evt", "ev", "cb"],
|
|
337
|
-
|
|
338
|
-
"
|
|
339
|
-
"warn",
|
|
340
|
-
{
|
|
341
|
-
capIsNewExceptions: [
|
|
342
|
-
// Exclude Stencil decorators
|
|
343
|
-
"Component",
|
|
344
|
-
"Element",
|
|
345
|
-
"Event",
|
|
346
|
-
"AttachInternals",
|
|
347
|
-
"Listen",
|
|
348
|
-
"Method",
|
|
349
|
-
"Prop",
|
|
350
|
-
"State",
|
|
351
|
-
"Watch",
|
|
352
|
-
// Exclude Angular decorator
|
|
353
|
-
"NgModule"
|
|
354
|
-
]
|
|
355
|
-
}
|
|
356
|
-
],
|
|
319
|
+
// Leave it to developer to decide when it is time to refactor-out
|
|
320
|
+
"complexity": "off",
|
|
357
321
|
// TODO: discuss (this avoids longer lines, improves readability)
|
|
358
322
|
// "no-inline-comments": "error",
|
|
359
323
|
// TODO: discuss (similar to the rule above, might be redundant).
|
|
@@ -367,48 +331,6 @@ var config_default = [
|
|
|
367
331
|
* ```
|
|
368
332
|
*/
|
|
369
333
|
"@typescript-eslint/no-this-alias": "off",
|
|
370
|
-
// ENUM values like "1<<0" ... "1<<9" are very useful
|
|
371
|
-
"@typescript-eslint/prefer-literal-enum-member": "off",
|
|
372
|
-
"no-magic-numbers": "off",
|
|
373
|
-
"@typescript-eslint/no-magic-numbers": [
|
|
374
|
-
// Error on code like:
|
|
375
|
-
// switch (code) { case 9: // '\t' ...
|
|
376
|
-
// refactor to:
|
|
377
|
-
// export const charCodes = { tab: 9 };
|
|
378
|
-
// switch (code) { case charCodes.tab: ...
|
|
379
|
-
//
|
|
380
|
-
// Benefits:
|
|
381
|
-
// - charCodes can be exported and reused in the codebase
|
|
382
|
-
// - no need for '\t' comment anymore
|
|
383
|
-
// - comment can be wrong or get out of data
|
|
384
|
-
// - easy to find all usages of charCodes.tab (harder to search for usages
|
|
385
|
-
// of 9)
|
|
386
|
-
//
|
|
387
|
-
// Similarly, you can define a dictionary of all HTTP status codes and
|
|
388
|
-
// other special numbers. Example:
|
|
389
|
-
// https://github.com/specify/specify7/blob/xml-editor/specifyweb/frontend/js_src/lib/utils/ajax/definitions.ts
|
|
390
|
-
// And now it's trivial to see all the places in the code that handle a
|
|
391
|
-
// particular http status code.
|
|
392
|
-
// Similarly, in that file further down you can see how by using
|
|
393
|
-
// [Http.Conflict] rather than 409:, the code is more self-documenting
|
|
394
|
-
"warn",
|
|
395
|
-
{
|
|
396
|
-
ignore: [
|
|
397
|
-
// Don't know why these aren't ignored by default
|
|
398
|
-
-1,
|
|
399
|
-
0,
|
|
400
|
-
1,
|
|
401
|
-
2
|
|
402
|
-
],
|
|
403
|
-
ignoreDefaultValues: true,
|
|
404
|
-
ignoreClassFieldInitialValues: true,
|
|
405
|
-
detectObjects: false,
|
|
406
|
-
ignoreEnums: true,
|
|
407
|
-
ignoreNumericLiteralTypes: true,
|
|
408
|
-
ignoreReadonlyClassProperties: true,
|
|
409
|
-
ignoreTypeIndexes: true
|
|
410
|
-
}
|
|
411
|
-
],
|
|
412
334
|
"no-warning-comments": [
|
|
413
335
|
// TODO: consider forbidding TODO in favor of BUG, HACK, REFACTOR, FEATURE,
|
|
414
336
|
// LOW, TEST, PERF. Then can configure IDE to assign different colors to
|
|
@@ -595,12 +517,6 @@ var config_default = [
|
|
|
595
517
|
// TODO: replace with perfectionist/sort-intersection-types and perfectionist/sort-union-types rules.
|
|
596
518
|
// Autofixable, so only a warning to be less disruptive
|
|
597
519
|
"@typescript-eslint/sort-type-constituents": "warn",
|
|
598
|
-
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
599
|
-
"warn",
|
|
600
|
-
{
|
|
601
|
-
ignorePrimitives: { string: true }
|
|
602
|
-
}
|
|
603
|
-
],
|
|
604
520
|
// The string.match() is more intuitive than the RegExp.exec()
|
|
605
521
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
606
522
|
// Both types and interfaces have uses in the edge cases. In the common
|
|
@@ -610,7 +526,20 @@ var config_default = [
|
|
|
610
526
|
// This is error by default. Turning into warning because it falsely
|
|
611
527
|
// reports when component tries to emit an event that is marked as
|
|
612
528
|
// deprecated.
|
|
613
|
-
"@typescript-eslint/no-deprecated": "warn"
|
|
529
|
+
"@typescript-eslint/no-deprecated": "warn",
|
|
530
|
+
// For can be useful in support packages and hot paths
|
|
531
|
+
"@typescript-eslint/prefer-for-of": "off",
|
|
532
|
+
// Enums are generally discouraged. Not much harm in this particular issue though
|
|
533
|
+
"@typescript-eslint/no-mixed-enums": "off",
|
|
534
|
+
// ENUM values like "1<<0" ... "1<<9" are very useful
|
|
535
|
+
"@typescript-eslint/prefer-literal-enum-member": "off",
|
|
536
|
+
// We discourage enums, so little added value in this check
|
|
537
|
+
"@typescript-eslint/no-duplicate-enum-values": "off",
|
|
538
|
+
// We discourage enums, so little added value in this check
|
|
539
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "off",
|
|
540
|
+
// Developer may actually mean to use ||
|
|
541
|
+
// Also, refactoring this out may break things
|
|
542
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off"
|
|
614
543
|
//#endregion
|
|
615
544
|
// TODO: go over https://typescript-eslint.io/linting/troubleshooting/performance-troubleshooting
|
|
616
545
|
}
|
|
@@ -622,5 +551,5 @@ var config_default = [
|
|
|
622
551
|
}
|
|
623
552
|
];
|
|
624
553
|
export {
|
|
625
|
-
|
|
554
|
+
defaultConfig as default
|
|
626
555
|
};
|
package/dist/config/lumina.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
* In addition to the main index.js config, this rule set contains rule for
|
|
3
|
-
* `@arcgis/lumina`
|
|
4
|
-
*/
|
|
5
|
-
import type { TSESLint } from "@typescript-eslint/utils";
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
6
2
|
declare const _default: TSESLint.FlatConfig.Config[];
|
|
7
3
|
export default _default;
|
package/dist/config/lumina.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
lumina_default
|
|
3
|
-
} from "../chunk-PVNFCQDL.js";
|
|
4
|
-
import "../chunk-C76ANB4Z.js";
|
|
5
|
-
|
|
6
|
-
// src/config/storybook.ts
|
|
7
1
|
import eslintPluginStorybook from "eslint-plugin-storybook";
|
|
8
|
-
|
|
2
|
+
import { luminaPlugin } from "../plugins/lumina/index.js";
|
|
3
|
+
const storybookConfig = [
|
|
9
4
|
{
|
|
10
5
|
ignores: ["**/storybook-static*"]
|
|
11
6
|
},
|
|
@@ -41,19 +36,17 @@ var storybookConfig = [
|
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
38
|
];
|
|
44
|
-
|
|
45
|
-
// src/config/lumina.ts
|
|
46
|
-
var lumina_default2 = [
|
|
39
|
+
const lumina = [
|
|
47
40
|
...storybookConfig,
|
|
48
41
|
{
|
|
49
|
-
...
|
|
42
|
+
...luminaPlugin.configs.recommended,
|
|
50
43
|
files: ["**/*.tsx"]
|
|
51
44
|
},
|
|
52
|
-
// Enable this rule in both .ts and .tsx files
|
|
53
45
|
{
|
|
54
46
|
files: ["**/*.ts", "**/*.tsx"],
|
|
55
|
-
plugins: { lumina:
|
|
47
|
+
plugins: { lumina: luminaPlugin },
|
|
56
48
|
rules: {
|
|
49
|
+
// Enable this rule in both .ts and .tsx files
|
|
57
50
|
"lumina/component-placement-rules": "error"
|
|
58
51
|
}
|
|
59
52
|
},
|
|
@@ -63,12 +56,8 @@ var lumina_default2 = [
|
|
|
63
56
|
// It's a good practice for @method() in components to be async even if
|
|
64
57
|
// they don't have await
|
|
65
58
|
"@typescript-eslint/require-await": "off",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* limitations of TypeScript when it comes to expressing the type of a
|
|
69
|
-
* property that changes during lifecycle (from non-null to eventual null)
|
|
70
|
-
*/
|
|
71
|
-
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
59
|
+
// Too many offenders for now to report this as an error. Assigned issues to tackle this.
|
|
60
|
+
"lumina/no-create-element-component": "warn",
|
|
72
61
|
"@typescript-eslint/no-restricted-imports": [
|
|
73
62
|
"error",
|
|
74
63
|
{
|
|
@@ -139,6 +128,14 @@ declare global {
|
|
|
139
128
|
importNames: ["ContextProvider", "ContextConsumer", "provide", "consume"],
|
|
140
129
|
message: `For lazy-loading compatibility, import the useContextProvider() and the useContextConsumer() controllers from @arcgis/lumina rather than directly calling the Lit's controllers/decorators.`,
|
|
141
130
|
caseSensitive: true
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
group: ["/@arcgis/components-controllers/accessor"],
|
|
134
|
+
message: 'Import from "@arcgis/lumina/controllers/accessor" instead'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
group: ["/@arcgis/components-controllers"],
|
|
138
|
+
message: 'Import from "@arcgis/lumina/controllers" instead'
|
|
142
139
|
}
|
|
143
140
|
]
|
|
144
141
|
}
|
|
@@ -223,5 +220,5 @@ declare global {
|
|
|
223
220
|
},*/
|
|
224
221
|
];
|
|
225
222
|
export {
|
|
226
|
-
|
|
223
|
+
lumina as default
|
|
227
224
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
export declare const storybookConfig: TSESLint.FlatConfig.ConfigArray;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
|
+
const version = "4.33.0-next.160";
|
|
3
|
+
function makeEslintPlugin(pluginName, urlCreator) {
|
|
4
|
+
const rules = [];
|
|
5
|
+
const creator = ESLintUtils.RuleCreator(urlCreator);
|
|
6
|
+
return {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
8
|
+
createRule(rule) {
|
|
9
|
+
const { meta, name, ...rest } = rule;
|
|
10
|
+
const docs = { ...meta.docs, name };
|
|
11
|
+
const ruleModule = creator({ ...rest, meta: { ...meta, docs }, name });
|
|
12
|
+
rules.push(ruleModule);
|
|
13
|
+
return ruleModule;
|
|
14
|
+
},
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
16
|
+
finalize() {
|
|
17
|
+
const config = {
|
|
18
|
+
rules: Object.fromEntries(
|
|
19
|
+
rules.map((rule) => [`${pluginName}/${rule.meta.docs.name}`, rule.meta.docs.defaultLevel])
|
|
20
|
+
)
|
|
21
|
+
};
|
|
22
|
+
const plugin = {
|
|
23
|
+
meta: { name: `@arcgis/eslint-plugin-${pluginName}`, version },
|
|
24
|
+
configs: {
|
|
25
|
+
recommended: config
|
|
26
|
+
},
|
|
27
|
+
rules: Object.fromEntries(rules.map((rule) => [rule.meta.docs.name, rule]))
|
|
28
|
+
};
|
|
29
|
+
config.plugins = {
|
|
30
|
+
[pluginName]: plugin
|
|
31
|
+
};
|
|
32
|
+
return plugin;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
makeEslintPlugin as m
|
|
38
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
export declare const luminaPlugin: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Plugin & {
|
|
2
2
|
configs: {
|
|
3
3
|
recommended: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config;
|
|
4
4
|
};
|
|
5
5
|
};
|
|
6
|
-
export default _default;
|