@ntnyq/eslint-config 3.2.0 → 3.2.2

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/README.md CHANGED
@@ -87,12 +87,12 @@ pnpm add husky nano-staged -D
87
87
  "prepare": "husky"
88
88
  },
89
89
  "nano-staged": {
90
- "*.{js,ts,cjs,mjs,jsx,tsx,vue,md,yml,yaml,json,html}": "eslint --fix"
90
+ "*.{js,ts,cjs,mjs,jsx,tsx,vue,md,html,json,toml,yml,yaml}": "eslint --fix"
91
91
  }
92
92
  }
93
93
  ```
94
94
 
95
- ### 3. Add a git hook
95
+ ### 3. Add a Git hook
96
96
 
97
97
  ```bash
98
98
  echo "nano-staged" > .husky/pre-commit
package/dist/index.cjs CHANGED
@@ -379,6 +379,186 @@ var vue3Rules = {
379
379
  ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
380
380
  ...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
381
381
  };
382
+ var disabledRules = {
383
+ "vue/no-v-html": "off",
384
+ "vue/require-prop-types": "off",
385
+ "vue/require-default-prop": "off",
386
+ "vue/multi-word-component-names": "off",
387
+ "vue/no-v-text-v-html-on-component": "off",
388
+ "vue/no-setup-props-reactivity-loss": "off"
389
+ };
390
+ var extensionRules = {
391
+ "vue/prefer-template": "error",
392
+ "vue/no-sparse-arrays": "error",
393
+ "vue/no-empty-pattern": "error",
394
+ "vue/space-infix-ops": "error",
395
+ "vue/no-loss-of-precision": "error",
396
+ "vue/no-constant-condition": "error",
397
+ "vue/template-curly-spacing": "error",
398
+ "vue/eqeqeq": ["error", "smart"],
399
+ "vue/comma-style": ["error", "last"],
400
+ "vue/block-spacing": ["error", "always"],
401
+ "vue/dot-location": ["error", "property"],
402
+ "vue/space-in-parens": ["error", "never"],
403
+ "vue/operator-linebreak": ["error", "before"],
404
+ "vue/no-extra-parens": ["error", "functions"],
405
+ "vue/array-bracket-spacing": ["error", "never"],
406
+ "vue/object-curly-spacing": ["error", "always"],
407
+ "vue/comma-dangle": ["error", "always-multiline"],
408
+ "vue/quote-props": ["error", "consistent-as-needed"],
409
+ "vue/arrow-spacing": ["error", { before: true, after: true }],
410
+ "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
411
+ "vue/comma-spacing": ["error", { before: false, after: true }],
412
+ "vue/dot-notation": ["error", { allowKeywords: true }],
413
+ "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
414
+ "vue/keyword-spacing": ["error", { before: true, after: true }],
415
+ "vue/no-restricted-syntax": ["error", "DebuggerStatement", "LabeledStatement", "WithStatement"],
416
+ "vue/space-unary-ops": [
417
+ "error",
418
+ {
419
+ words: true,
420
+ nonwords: false
421
+ }
422
+ ],
423
+ "vue/object-curly-newline": [
424
+ "error",
425
+ {
426
+ multiline: true,
427
+ consistent: true
428
+ }
429
+ ],
430
+ "vue/object-property-newline": [
431
+ "error",
432
+ {
433
+ allowMultiplePropertiesPerLine: true
434
+ }
435
+ ],
436
+ "vue/object-shorthand": [
437
+ "error",
438
+ "always",
439
+ {
440
+ ignoreConstructors: false,
441
+ avoidQuotes: true
442
+ }
443
+ ]
444
+ };
445
+ var unCategorizedRules = {
446
+ "vue/no-v-text": "error",
447
+ "vue/no-useless-v-bind": "error",
448
+ "vue/valid-define-options": "error",
449
+ "vue/prefer-define-options": "error",
450
+ "vue/prefer-use-template-ref": "error",
451
+ "vue/no-irregular-whitespace": "error",
452
+ "vue/no-use-v-else-with-v-for": "error",
453
+ "vue/no-deprecated-delete-set": "error",
454
+ "vue/no-empty-component-block": "error",
455
+ "vue/require-typed-object-prop": "error",
456
+ "vue/no-unused-emit-declarations": "error",
457
+ "vue/padding-line-between-blocks": "error",
458
+ "vue/no-multiple-objects-in-class": "error",
459
+ "vue/prefer-separate-static-class": "error",
460
+ "vue/no-ref-object-reactivity-loss": "error",
461
+ "vue/no-duplicate-attr-inheritance": "error",
462
+ "vue/prefer-prop-type-boolean-first": "error",
463
+ "vue/html-comment-indent": ["error", 2],
464
+ "vue/next-tick-style": ["error", "promise"],
465
+ "vue/v-for-delimiter-style": ["error", "in"],
466
+ "vue/no-restricted-v-bind": ["error", "/^v-/"],
467
+ "vue/custom-event-name-casing": ["error", "camelCase"],
468
+ "vue/define-props-declaration": ["error", "type-based"],
469
+ "vue/define-emits-declaration": ["error", "type-literal"],
470
+ "vue/prefer-true-attribute-shorthand": ["error", "always"],
471
+ "vue/component-options-name-casing": ["error", "PascalCase"],
472
+ "vue/component-api-style": ["error", ["script-setup", "composition"]],
473
+ "vue/html-button-has-type": [
474
+ "error",
475
+ {
476
+ button: true,
477
+ submit: true,
478
+ reset: true
479
+ }
480
+ ],
481
+ "vue/block-order": [
482
+ "error",
483
+ {
484
+ order: ["script", "template", "style"]
485
+ }
486
+ ],
487
+ "vue/enforce-style-attribute": [
488
+ "error",
489
+ {
490
+ allow: ["scoped", "plain"]
491
+ }
492
+ ],
493
+ "vue/block-tag-newline": [
494
+ "error",
495
+ {
496
+ singleline: "always",
497
+ multiline: "always"
498
+ }
499
+ ],
500
+ "vue/no-required-prop-with-default": [
501
+ "error",
502
+ {
503
+ autofix: true
504
+ }
505
+ ],
506
+ "vue/html-comment-content-newline": [
507
+ "error",
508
+ {
509
+ singleline: "ignore",
510
+ multiline: "always"
511
+ },
512
+ {
513
+ exceptions: ["*"]
514
+ }
515
+ ],
516
+ "vue/no-static-inline-styles": [
517
+ "error",
518
+ {
519
+ allowBinding: true
520
+ }
521
+ ],
522
+ "vue/no-deprecated-model-definition": [
523
+ "error",
524
+ {
525
+ allowVue3Compat: true
526
+ }
527
+ ],
528
+ "vue/component-name-in-template-casing": [
529
+ "error",
530
+ "PascalCase",
531
+ {
532
+ // Force auto-import components to be PascalCase
533
+ registeredComponentsOnly: false,
534
+ ignores: ["slot", "component"]
535
+ }
536
+ ],
537
+ "vue/define-macros-order": [
538
+ "error",
539
+ {
540
+ order: ["defineProps", "defineEmits", "defineOptions", "defineSlots", "defineModel"],
541
+ defineExposeLast: true
542
+ }
543
+ ],
544
+ "vue/html-comment-content-spacing": [
545
+ "error",
546
+ "always",
547
+ {
548
+ exceptions: ["-"]
549
+ }
550
+ ],
551
+ "vue/require-macro-variable-name": [
552
+ "error",
553
+ {
554
+ defineProps: "props",
555
+ defineEmits: "emits",
556
+ defineSlots: "slots",
557
+ useSlots: "slots",
558
+ useAttrs: "attrs"
559
+ }
560
+ ]
561
+ };
382
562
  var vue = (options = {}) => {
383
563
  const isVue3 = options.vueVersion !== 2;
384
564
  return [
@@ -408,13 +588,6 @@ var vue = (options = {}) => {
408
588
  processor: import_eslint_plugin_vue.default.processors[".vue"],
409
589
  rules: {
410
590
  ...isVue3 ? vue3Rules : vue2Rules,
411
- // OFF
412
- "vue/no-v-html": "off",
413
- "vue/require-prop-types": "off",
414
- "vue/require-default-prop": "off",
415
- "vue/multi-word-component-names": "off",
416
- "vue/no-v-text-v-html-on-component": "off",
417
- "vue/no-setup-props-reactivity-loss": "off",
418
591
  "vue/html-self-closing": [
419
592
  "error",
420
593
  {
@@ -427,130 +600,8 @@ var vue = (options = {}) => {
427
600
  math: "always"
428
601
  }
429
602
  ],
430
- "vue/block-tag-newline": [
431
- "error",
432
- {
433
- singleline: "always",
434
- multiline: "always"
435
- }
436
- ],
437
- "vue/component-name-in-template-casing": [
438
- "error",
439
- "PascalCase",
440
- {
441
- // Force auto-import components to be PascalCase
442
- registeredComponentsOnly: false,
443
- ignores: ["slot", "component"]
444
- }
445
- ],
446
- "vue/component-options-name-casing": ["error", "PascalCase"],
447
- "vue/custom-event-name-casing": ["error", "camelCase"],
448
- "vue/define-macros-order": [
449
- "error",
450
- {
451
- order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
452
- }
453
- ],
454
- "vue/html-comment-content-spacing": [
455
- "error",
456
- "always",
457
- {
458
- exceptions: ["-"]
459
- }
460
- ],
461
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
462
- "vue/no-useless-v-bind": "error",
463
- "vue/padding-line-between-blocks": "error",
464
- "vue/next-tick-style": ["error", "promise"],
465
- "vue/array-bracket-spacing": ["error", "never"],
466
- "vue/prefer-separate-static-class": "error",
467
- "vue/no-constant-condition": "error",
468
- "vue/prefer-true-attribute-shorthand": ["error", "always"],
469
- "vue/prefer-define-options": "error",
470
- "vue/valid-define-options": "error",
471
- // TypeScript enhancements
472
- "vue/define-emits-declaration": ["error", "type-literal"],
473
- "vue/no-unused-emit-declarations": "error",
474
603
  "vue/this-in-template": ["error", "never"],
475
- "vue/arrow-spacing": ["error", { before: true, after: true }],
476
- "vue/block-spacing": ["error", "always"],
477
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
478
- "vue/comma-dangle": ["error", "always-multiline"],
479
- "vue/comma-spacing": ["error", { before: false, after: true }],
480
- "vue/comma-style": ["error", "last"],
481
- "vue/dot-location": ["error", "property"],
482
- "vue/dot-notation": ["error", { allowKeywords: true }],
483
- "vue/eqeqeq": ["error", "smart"],
484
- "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
485
- "vue/keyword-spacing": ["error", { before: true, after: true }],
486
- "vue/no-empty-pattern": "error",
487
- "vue/no-loss-of-precision": "error",
488
- "vue/no-irregular-whitespace": "error",
489
- "vue/no-use-v-else-with-v-for": "error",
490
- "vue/require-typed-object-prop": "error",
491
- "vue/no-deprecated-delete-set": "error",
492
- "vue/no-extra-parens": ["error", "functions"],
493
- "vue/no-restricted-syntax": [
494
- "error",
495
- "DebuggerStatement",
496
- "LabeledStatement",
497
- "WithStatement"
498
- ],
499
- "vue/no-sparse-arrays": "error",
500
- "vue/no-deprecated-model-definition": [
501
- "error",
502
- {
503
- allowVue3Compat: true
504
- }
505
- ],
506
- "vue/object-curly-newline": [
507
- "error",
508
- {
509
- multiline: true,
510
- consistent: true
511
- }
512
- ],
513
- "vue/no-static-inline-styles": [
514
- "error",
515
- {
516
- allowBinding: true
517
- }
518
- ],
519
- "vue/object-curly-spacing": ["error", "always"],
520
- "vue/object-property-newline": [
521
- "error",
522
- {
523
- allowMultiplePropertiesPerLine: true
524
- }
525
- ],
526
- "vue/object-shorthand": [
527
- "error",
528
- "always",
529
- {
530
- ignoreConstructors: false,
531
- avoidQuotes: true
532
- }
533
- ],
534
- "vue/operator-linebreak": ["error", "before"],
535
- "vue/prefer-template": "error",
536
604
  "vue/prop-name-casing": ["error", "camelCase"],
537
- "vue/quote-props": ["error", "consistent-as-needed"],
538
- "vue/space-in-parens": ["error", "never"],
539
- "vue/space-infix-ops": "error",
540
- "vue/space-unary-ops": [
541
- "error",
542
- {
543
- words: true,
544
- nonwords: false
545
- }
546
- ],
547
- "vue/template-curly-spacing": "error",
548
- "vue/block-order": [
549
- "error",
550
- {
551
- order: ["script", "template", "style"]
552
- }
553
- ],
554
605
  "vue/attributes-order": [
555
606
  "error",
556
607
  {
@@ -635,6 +686,9 @@ var vue = (options = {}) => {
635
686
  multiline: 1
636
687
  }
637
688
  ],
689
+ ...disabledRules,
690
+ ...extensionRules,
691
+ ...unCategorizedRules,
638
692
  // Overrides rules
639
693
  ...options.overrides
640
694
  }
@@ -1255,6 +1309,16 @@ var imports = (options = {}) => [
1255
1309
  ];
1256
1310
 
1257
1311
  // src/configs/unicorn.ts
1312
+ var disabledRules2 = {
1313
+ "unicorn/better-regex": "off",
1314
+ "unicorn/prefer-top-level-await": "off",
1315
+ "unicorn/explicit-length-check": "off",
1316
+ "unicorn/no-array-callback-reference": "off",
1317
+ /**
1318
+ * @see https://caniuse.com/?search=globalThis
1319
+ */
1320
+ "unicorn/prefer-global-this": "off"
1321
+ };
1258
1322
  var unicorn = (options = {}) => [
1259
1323
  {
1260
1324
  name: "ntnyq/unicorn",
@@ -1262,15 +1326,6 @@ var unicorn = (options = {}) => [
1262
1326
  unicorn: import_eslint_plugin_unicorn.default
1263
1327
  },
1264
1328
  rules: {
1265
- // Disabled for now
1266
- "unicorn/better-regex": "off",
1267
- "unicorn/prefer-top-level-await": "off",
1268
- "unicorn/explicit-length-check": "off",
1269
- "unicorn/no-array-callback-reference": "off",
1270
- /**
1271
- * @see https://caniuse.com/?search=globalThis
1272
- */
1273
- "unicorn/prefer-global-this": "off",
1274
1329
  "unicorn/error-message": "error",
1275
1330
  "unicorn/escape-case": "error",
1276
1331
  "unicorn/no-new-buffer": "error",
@@ -1281,7 +1336,6 @@ var unicorn = (options = {}) => [
1281
1336
  "unicorn/no-unnecessary-await": "error",
1282
1337
  "unicorn/switch-case-braces": ["error", "avoid"],
1283
1338
  "unicorn/no-typeof-undefined": "error",
1284
- "unicorn/prefer-set-size": "error",
1285
1339
  "unicorn/prefer-regexp-test": "error",
1286
1340
  "unicorn/no-static-only-class": "error",
1287
1341
  "unicorn/no-zero-fractions": "error",
@@ -1301,6 +1355,7 @@ var unicorn = (options = {}) => [
1301
1355
  "unicorn/prefer-prototype-methods": "error",
1302
1356
  "unicorn/prefer-reflect-apply": "error",
1303
1357
  "unicorn/prefer-math-min-max": "error",
1358
+ "unicorn/prefer-structured-clone": "error",
1304
1359
  "unicorn/consistent-existence-index-check": "error",
1305
1360
  "unicorn/catch-error-name": [
1306
1361
  "error",
@@ -1311,6 +1366,7 @@ var unicorn = (options = {}) => [
1311
1366
  ],
1312
1367
  "unicorn/prefer-date-now": "error",
1313
1368
  // String
1369
+ "unicorn/prefer-code-point": "error",
1314
1370
  "unicorn/prefer-string-slice": "error",
1315
1371
  "unicorn/prefer-string-trim-start-end": "error",
1316
1372
  "unicorn/prefer-string-starts-ends-with": "error",
@@ -1332,6 +1388,11 @@ var unicorn = (options = {}) => [
1332
1388
  "unicorn/prefer-array-some": "error",
1333
1389
  "unicorn/prefer-array-flat-map": "error",
1334
1390
  "unicorn/prefer-array-index-of": "error",
1391
+ "unicorn/require-array-join-separator": "error",
1392
+ // Set
1393
+ "unicorn/prefer-set-has": "error",
1394
+ "unicorn/prefer-set-size": "error",
1395
+ ...disabledRules2,
1335
1396
  // Overrides rules
1336
1397
  ...options.overrides
1337
1398
  }