@iqrf/eslint-config 0.0.6 → 0.0.7
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/index.d.ts +45 -5
- package/dist/index.js +188 -23
- package/package.json +4 -6
package/dist/index.d.ts
CHANGED
|
@@ -34,11 +34,11 @@ declare const comments: Linter.FlatConfig[];
|
|
|
34
34
|
* limitations under the License.
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
-
interface Options$
|
|
37
|
+
interface Options$2 {
|
|
38
38
|
typescript: boolean;
|
|
39
39
|
vue: boolean;
|
|
40
40
|
}
|
|
41
|
-
declare const imports: (options: Options$
|
|
41
|
+
declare const imports: (options: Options$2) => Linter.FlatConfig[];
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Copyright 2024 MICRORISC s.r.o.
|
|
@@ -92,7 +92,10 @@ declare const json: Linter.FlatConfig[];
|
|
|
92
92
|
* limitations under the License.
|
|
93
93
|
*/
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
interface Options$1 {
|
|
96
|
+
typescript: boolean;
|
|
97
|
+
}
|
|
98
|
+
declare const markdown: (options: Options$1) => Linter.FlatConfig[];
|
|
96
99
|
|
|
97
100
|
/**
|
|
98
101
|
* Copyright 2024 MICRORISC s.r.o.
|
|
@@ -184,6 +187,42 @@ declare const stylistic: Linter.FlatConfig[];
|
|
|
184
187
|
|
|
185
188
|
declare const typescript: Linter.FlatConfig[];
|
|
186
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Copyright 2024 MICRORISC s.r.o.
|
|
192
|
+
*
|
|
193
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
* you may not use this file except in compliance with the License.
|
|
195
|
+
* You may obtain a copy of the License at
|
|
196
|
+
*
|
|
197
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
*
|
|
199
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
* See the License for the specific language governing permissions and
|
|
203
|
+
* limitations under the License.
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
declare const unicorn: Linter.FlatConfig[];
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Copyright 2024 MICRORISC s.r.o.
|
|
210
|
+
*
|
|
211
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
212
|
+
* you may not use this file except in compliance with the License.
|
|
213
|
+
* You may obtain a copy of the License at
|
|
214
|
+
*
|
|
215
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
216
|
+
*
|
|
217
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
218
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
219
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
220
|
+
* See the License for the specific language governing permissions and
|
|
221
|
+
* limitations under the License.
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
declare const vitest: Linter.FlatConfig[];
|
|
225
|
+
|
|
187
226
|
/**
|
|
188
227
|
* Copyright 2024 MICRORISC s.r.o.
|
|
189
228
|
*
|
|
@@ -277,8 +316,9 @@ declare const versionVue: string | undefined;
|
|
|
277
316
|
* See the License for the specific language governing permissions and
|
|
278
317
|
* limitations under the License.
|
|
279
318
|
*/
|
|
280
|
-
|
|
281
319
|
interface IqrfEslintOptions {
|
|
320
|
+
/** List of paths to ignore. */
|
|
321
|
+
ignores?: string[];
|
|
282
322
|
/** Import support - enabled by default. */
|
|
283
323
|
import: boolean;
|
|
284
324
|
/** Markdown support - enabled by default. */
|
|
@@ -319,4 +359,4 @@ interface IqrfEslintOptions {
|
|
|
319
359
|
|
|
320
360
|
declare function iqrfEslint(options?: Partial<IqrfEslintOptions>, config?: Linter.FlatConfig | Linter.FlatConfig[]): Linter.FlatConfig[];
|
|
321
361
|
|
|
322
|
-
export { comments, getVueVersion, hasPinia, hasTypescript, hasVitest, hasVue, hasVueI18n, hasVuetify, imports, iqrfEslint, isInEditor, javascript, json, markdown, pinia, promise, regexp, stylistic, typescript, versionVue, vue, vueI18n };
|
|
362
|
+
export { comments, getVueVersion, hasPinia, hasTypescript, hasVitest, hasVue, hasVueI18n, hasVuetify, imports, iqrfEslint, isInEditor, javascript, json, markdown, pinia, promise, regexp, stylistic, typescript, unicorn, versionVue, vitest, vue, vueI18n };
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,7 @@ var json = pluginJson.configs["flat/recommended-with-json"];
|
|
|
165
165
|
|
|
166
166
|
// src/configs/markdown.ts
|
|
167
167
|
import pluginMarkdown from "eslint-plugin-markdown";
|
|
168
|
-
var markdown = [
|
|
168
|
+
var markdown = (options) => [
|
|
169
169
|
{
|
|
170
170
|
files: ["**/*.md"],
|
|
171
171
|
plugins: {
|
|
@@ -175,7 +175,43 @@ var markdown = [
|
|
|
175
175
|
rules: {
|
|
176
176
|
...pluginMarkdown.configs.recommended.rules
|
|
177
177
|
}
|
|
178
|
-
}
|
|
178
|
+
},
|
|
179
|
+
...options.typescript ? [
|
|
180
|
+
{
|
|
181
|
+
files: ["**/*.md/*.ts"],
|
|
182
|
+
languageOptions: {
|
|
183
|
+
parserOptions: {
|
|
184
|
+
project: null
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
rules: {
|
|
188
|
+
"@typescript-eslint/await-thenable": "off",
|
|
189
|
+
"@typescript-eslint/dot-notation": "off",
|
|
190
|
+
"@typescript-eslint/no-base-to-string": "off",
|
|
191
|
+
"@typescript-eslint/no-duplicate-type-constituents": "off",
|
|
192
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
193
|
+
"@typescript-eslint/no-implied-eval": "off",
|
|
194
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
195
|
+
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
196
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
197
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
198
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
199
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
200
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "off",
|
|
201
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
202
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
203
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
204
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "off",
|
|
205
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
206
|
+
"@typescript-eslint/prefer-optional-chain": "off",
|
|
207
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "off",
|
|
208
|
+
"@typescript-eslint/require-await": "off",
|
|
209
|
+
"@typescript-eslint/restrict-plus-operands": "off",
|
|
210
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
211
|
+
"@typescript-eslint/unbound-method": "off"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
] : []
|
|
179
215
|
];
|
|
180
216
|
|
|
181
217
|
// src/configs/pinia.ts
|
|
@@ -344,8 +380,123 @@ if (hasPinia) {
|
|
|
344
380
|
}
|
|
345
381
|
var typescript = tsEslint.config(...configs);
|
|
346
382
|
|
|
383
|
+
// src/configs/unicorn.ts
|
|
384
|
+
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
385
|
+
var unicorn = [
|
|
386
|
+
{
|
|
387
|
+
languageOptions: {
|
|
388
|
+
ecmaVersion: 2024
|
|
389
|
+
},
|
|
390
|
+
plugins: {
|
|
391
|
+
unicorn: pluginUnicorn
|
|
392
|
+
},
|
|
393
|
+
rules: {
|
|
394
|
+
"unicorn/better-regex": "error",
|
|
395
|
+
"unicorn/catch-error-name": "error",
|
|
396
|
+
"unicorn/custom-error-definition": "error",
|
|
397
|
+
"unicorn/error-message": "error",
|
|
398
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
399
|
+
"unicorn/no-array-for-each": "error",
|
|
400
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
401
|
+
"unicorn/no-instanceof-array": "error",
|
|
402
|
+
"unicorn/no-this-assignment": "error",
|
|
403
|
+
"unicorn/no-typeof-undefined": "error",
|
|
404
|
+
"unicorn/no-unnecessary-await": "error",
|
|
405
|
+
"unicorn/no-unreadable-iife": "warn",
|
|
406
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
407
|
+
"unicorn/no-useless-length-check": "error",
|
|
408
|
+
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
409
|
+
"unicorn/no-zero-fractions": "warn",
|
|
410
|
+
"unicorn/number-literal-case": "error",
|
|
411
|
+
"unicorn/numeric-separators-style": [
|
|
412
|
+
"error",
|
|
413
|
+
{
|
|
414
|
+
onlyIfContainsSeparator: false,
|
|
415
|
+
hexadecimal: {
|
|
416
|
+
minimumDigits: 0,
|
|
417
|
+
groupLength: 2
|
|
418
|
+
},
|
|
419
|
+
binary: {
|
|
420
|
+
minimumDigits: 0,
|
|
421
|
+
groupLength: 4
|
|
422
|
+
},
|
|
423
|
+
octal: {
|
|
424
|
+
minimumDigits: 0,
|
|
425
|
+
groupLength: 3
|
|
426
|
+
},
|
|
427
|
+
number: {
|
|
428
|
+
minimumDigits: 5,
|
|
429
|
+
groupLength: 3
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
],
|
|
433
|
+
"unicorn/prefer-array-index-of": "error",
|
|
434
|
+
"unicorn/prefer-date-now": "error",
|
|
435
|
+
"unicorn/prefer-default-parameters": "error",
|
|
436
|
+
"unicorn/prefer-dom-node-append": "error",
|
|
437
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
438
|
+
"unicorn/prefer-export-from": "error",
|
|
439
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
440
|
+
"unicorn/prefer-node-protocol": "error",
|
|
441
|
+
"unicorn/prefer-number-properties": "error",
|
|
442
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
443
|
+
"unicorn/prefer-regexp-test": "error",
|
|
444
|
+
"unicorn/prefer-set-size": "error",
|
|
445
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
446
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
447
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
448
|
+
"unicorn/prefer-structured-clone": "error",
|
|
449
|
+
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
450
|
+
"unicorn/throw-new-error": "error"
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
];
|
|
454
|
+
|
|
455
|
+
// src/configs/vitest.ts
|
|
456
|
+
import pluginVitest from "eslint-plugin-vitest";
|
|
457
|
+
var vitest = [
|
|
458
|
+
{
|
|
459
|
+
files: ["**/*.test.*"],
|
|
460
|
+
plugins: {
|
|
461
|
+
vitest: pluginVitest
|
|
462
|
+
},
|
|
463
|
+
languageOptions: {
|
|
464
|
+
globals: {
|
|
465
|
+
...pluginVitest.environments.env.globals
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
rules: {
|
|
469
|
+
...pluginVitest.configs.recommended.rules,
|
|
470
|
+
"vitest/no-alias-methods": "warn",
|
|
471
|
+
"vitest/no-duplicate-hooks": "warn",
|
|
472
|
+
"vitest/no-focused-tests": "warn",
|
|
473
|
+
"vitest/prefer-called-with": "warn",
|
|
474
|
+
"vitest/prefer-comparison-matcher": "warn",
|
|
475
|
+
"vitest/prefer-each": "warn",
|
|
476
|
+
"vitest/prefer-equality-matcher": "warn",
|
|
477
|
+
"vitest/prefer-expect-assertions": "error",
|
|
478
|
+
"vitest/prefer-expect-resolves": "warn",
|
|
479
|
+
"vitest/prefer-hooks-in-order": "warn",
|
|
480
|
+
"vitest/prefer-hooks-on-top": "warn",
|
|
481
|
+
"vitest/prefer-mock-promise-shorthand": "warn",
|
|
482
|
+
"vitest/prefer-spy-on": "warn",
|
|
483
|
+
"vitest/prefer-to-be-falsy": "warn",
|
|
484
|
+
"vitest/prefer-to-be-truthy": "warn",
|
|
485
|
+
"vitest/prefer-to-contain": "warn",
|
|
486
|
+
"vitest/prefer-to-have-length": "warn",
|
|
487
|
+
"vitest/require-to-throw-message": "warn"
|
|
488
|
+
},
|
|
489
|
+
settings: {
|
|
490
|
+
vitest: {
|
|
491
|
+
typecheck: true
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
];
|
|
496
|
+
|
|
347
497
|
// src/configs/vue.ts
|
|
348
498
|
import pluginVue from "eslint-plugin-vue";
|
|
499
|
+
import pluginVueScopedCSS from "eslint-plugin-vue-scoped-css";
|
|
349
500
|
import { getPackageInfoSync as getPackageInfoSync2 } from "local-pkg";
|
|
350
501
|
import tsEslint2 from "typescript-eslint";
|
|
351
502
|
import parserVue from "vue-eslint-parser";
|
|
@@ -356,9 +507,15 @@ function getVueVersion() {
|
|
|
356
507
|
}
|
|
357
508
|
return 3;
|
|
358
509
|
}
|
|
359
|
-
var
|
|
510
|
+
var configs2 = getVueVersion() === 3 ? [
|
|
511
|
+
...pluginVue.configs["flat/recommended"],
|
|
512
|
+
...pluginVueScopedCSS.configs["flat/recommended"]
|
|
513
|
+
] : [
|
|
514
|
+
...pluginVue.configs["flat/vue2-recommended"],
|
|
515
|
+
...pluginVueScopedCSS.configs["flat/vue2-recommended"]
|
|
516
|
+
];
|
|
360
517
|
var vue = (options) => [
|
|
361
|
-
...
|
|
518
|
+
...configs2,
|
|
362
519
|
{
|
|
363
520
|
files: ["**/*.vue"],
|
|
364
521
|
plugins: {
|
|
@@ -416,63 +573,69 @@ var vueI18n = [
|
|
|
416
573
|
];
|
|
417
574
|
|
|
418
575
|
// src/index.ts
|
|
419
|
-
function iqrfEslint(options = {},
|
|
576
|
+
function iqrfEslint(options = {}, config = []) {
|
|
420
577
|
const {
|
|
578
|
+
ignores = [],
|
|
421
579
|
import: enableImport = true,
|
|
422
580
|
markdown: enableMarkdown = true,
|
|
423
581
|
pinia: enablePinia = hasPinia,
|
|
424
582
|
promise: enablePromise = true,
|
|
425
583
|
regExp: enableRegExp = true,
|
|
426
584
|
typescript: enableTypescript = hasTypescript,
|
|
585
|
+
vitest: enableVitest = hasVitest,
|
|
427
586
|
vue: enableVue = hasVue,
|
|
428
587
|
vueI18n: enableVueI18n = hasVueI18n,
|
|
429
588
|
vuetify: enableVuetify = hasVuetify
|
|
430
589
|
} = options;
|
|
431
|
-
const
|
|
590
|
+
const configs3 = [];
|
|
432
591
|
const ignoreFiles = [".gitignore", ".eslintignore"].filter((path4) => fs.existsSync(path4));
|
|
433
592
|
if (ignoreFiles.length > 0) {
|
|
434
|
-
|
|
435
|
-
files: ignoreFiles
|
|
593
|
+
configs3.push(configGitignore({
|
|
594
|
+
files: [...ignoreFiles, ...ignores]
|
|
436
595
|
}));
|
|
437
596
|
}
|
|
438
|
-
|
|
439
|
-
|
|
597
|
+
configs3.push(...javascript);
|
|
598
|
+
configs3.push(...comments);
|
|
440
599
|
if (enableTypescript) {
|
|
441
|
-
|
|
600
|
+
configs3.push(...typescript);
|
|
442
601
|
}
|
|
443
602
|
if (enableImport) {
|
|
444
|
-
|
|
603
|
+
configs3.push(...imports({
|
|
445
604
|
typescript: enableTypescript,
|
|
446
605
|
vue: enableVue
|
|
447
606
|
}));
|
|
448
607
|
}
|
|
449
608
|
if (enablePinia) {
|
|
450
|
-
|
|
609
|
+
configs3.push(...pinia);
|
|
451
610
|
}
|
|
452
611
|
if (enablePromise) {
|
|
453
|
-
|
|
612
|
+
configs3.push(...promise);
|
|
454
613
|
}
|
|
455
614
|
if (enableRegExp) {
|
|
456
|
-
|
|
615
|
+
configs3.push(...regexp);
|
|
457
616
|
}
|
|
458
617
|
if (enableMarkdown) {
|
|
459
|
-
|
|
618
|
+
configs3.push(...markdown({ typescript: enableTypescript }));
|
|
460
619
|
}
|
|
461
620
|
if (enableVue) {
|
|
462
|
-
|
|
621
|
+
configs3.push(...vue({
|
|
463
622
|
typescript: enableTypescript,
|
|
464
623
|
vuetify: enableVuetify
|
|
465
624
|
}));
|
|
466
625
|
}
|
|
467
626
|
if (enableVueI18n) {
|
|
468
|
-
|
|
627
|
+
configs3.push(...vueI18n);
|
|
628
|
+
}
|
|
629
|
+
if (enableVitest) {
|
|
630
|
+
configs3.push(...vitest);
|
|
469
631
|
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
632
|
+
configs3.push(...json);
|
|
633
|
+
configs3.push(...stylistic);
|
|
634
|
+
configs3.push(...unicorn);
|
|
635
|
+
if (Object.keys(config).length > 0) {
|
|
636
|
+
configs3.push(...Array.isArray(config) ? config : [config]);
|
|
474
637
|
}
|
|
475
|
-
return
|
|
638
|
+
return configs3;
|
|
476
639
|
}
|
|
477
640
|
export {
|
|
478
641
|
comments,
|
|
@@ -494,7 +657,9 @@ export {
|
|
|
494
657
|
regexp,
|
|
495
658
|
stylistic,
|
|
496
659
|
typescript,
|
|
660
|
+
unicorn,
|
|
497
661
|
versionVue,
|
|
662
|
+
vitest,
|
|
498
663
|
vue,
|
|
499
664
|
vueI18n
|
|
500
665
|
};
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@eslint/js": "^9.6.0",
|
|
19
19
|
"@intlify/eslint-plugin-vue-i18n": "^3.0.0",
|
|
20
20
|
"@stylistic/eslint-plugin": "^2.3.0",
|
|
21
|
-
"eslint-config-flat-gitignore": "^0.1.
|
|
21
|
+
"eslint-config-flat-gitignore": "^0.1.6",
|
|
22
22
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
23
23
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
24
24
|
"eslint-plugin-import-x": "^0.5.3",
|
|
@@ -26,16 +26,14 @@
|
|
|
26
26
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
27
27
|
"eslint-plugin-markdown": "^5.0.0",
|
|
28
28
|
"eslint-plugin-math": "^0.6.0",
|
|
29
|
-
"eslint-plugin-n": "^17.9.0",
|
|
30
|
-
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
31
29
|
"eslint-plugin-perfectionist": "^2.11.0",
|
|
32
30
|
"eslint-plugin-pinia": "^0.2.0",
|
|
33
31
|
"eslint-plugin-promise": "^6.4.0",
|
|
34
32
|
"eslint-plugin-regexp": "^2.6.0",
|
|
35
33
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
36
|
-
"eslint-plugin-unused-imports": "^4.0.0",
|
|
37
34
|
"eslint-plugin-vitest": "^0.5.4",
|
|
38
35
|
"eslint-plugin-vue": "^9.27.0",
|
|
36
|
+
"eslint-plugin-vue-scoped-css": "^2.8.1",
|
|
39
37
|
"eslint-plugin-vuetify": "^2.4.0",
|
|
40
38
|
"globals": "^15.8.0",
|
|
41
39
|
"jsonc-eslint-parser": "^2.4.0",
|
|
@@ -47,7 +45,7 @@
|
|
|
47
45
|
"@types/eslint": "^8.56.10",
|
|
48
46
|
"@types/eslint-plugin-markdown": "^2.0.2",
|
|
49
47
|
"@types/eslint__js": "^8.42.3",
|
|
50
|
-
"@types/node": "^20.14.
|
|
48
|
+
"@types/node": "^20.14.10",
|
|
51
49
|
"bumpp": "^9.4.1",
|
|
52
50
|
"eslint": "^9.6.0",
|
|
53
51
|
"eslint-plugin-eslint-plugin": "^6.2.0",
|
|
@@ -83,7 +81,7 @@
|
|
|
83
81
|
},
|
|
84
82
|
"type": "module",
|
|
85
83
|
"types": "dist/index.d.ts",
|
|
86
|
-
"version": "0.0.
|
|
84
|
+
"version": "0.0.7",
|
|
87
85
|
"scripts": {
|
|
88
86
|
"build": "tsup",
|
|
89
87
|
"lint": "eslint .",
|