@ntnyq/eslint-config 2.7.3 → 2.8.1
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 +9 -1
- package/dist/index.cjs +43 -144
- package/dist/index.d.cts +8716 -11117
- package/dist/index.d.ts +8716 -11117
- package/dist/index.js +48 -151
- package/package.json +17 -16
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ pnpm add @ntnyq/eslint-config -D
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
Config in `eslint.config.mjs`:
|
|
16
|
+
Config in `eslint.config.{mjs,mts}`:
|
|
17
17
|
|
|
18
18
|
```js
|
|
19
19
|
import { ntnyq } from '@ntnyq/eslint-config'
|
|
@@ -21,6 +21,14 @@ import { ntnyq } from '@ntnyq/eslint-config'
|
|
|
21
21
|
export default ntnyq()
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
Config in `eslint.config.{cjs,cts}`
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
const ntnyq = require('@ntnyq/eslint-config')
|
|
28
|
+
|
|
29
|
+
module.exports = ntnyq()
|
|
30
|
+
```
|
|
31
|
+
|
|
24
32
|
## Credits
|
|
25
33
|
|
|
26
34
|
- [@sxzz/eslint-config](https://github.com/sxzz/eslint-config)
|
package/dist/index.cjs
CHANGED
|
@@ -76,12 +76,14 @@ __export(src_exports, {
|
|
|
76
76
|
parserToml: () => parserToml,
|
|
77
77
|
parserVue: () => parserVue,
|
|
78
78
|
parserYaml: () => parserYaml,
|
|
79
|
+
perfectionist: () => perfectionist,
|
|
79
80
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
80
81
|
pluginImport: () => import_eslint_plugin_import_x.default,
|
|
81
82
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
82
83
|
pluginJsonc: () => import_eslint_plugin_jsonc.default,
|
|
83
84
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
84
85
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
86
|
+
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
85
87
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
86
88
|
pluginRegexp: () => pluginRegexp,
|
|
87
89
|
pluginToml: () => import_eslint_plugin_toml.default,
|
|
@@ -243,6 +245,7 @@ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
|
243
245
|
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
244
246
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
245
247
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
248
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
246
249
|
var import_eslint_plugin_unused_imports = __toESM(require("@antfu/eslint-plugin-unused-imports"), 1);
|
|
247
250
|
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
248
251
|
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
@@ -482,10 +485,6 @@ var javascript = defineConfig([
|
|
|
482
485
|
rules: {
|
|
483
486
|
// standard v17.0.0
|
|
484
487
|
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
485
|
-
"array-bracket-spacing": ["error", "never"],
|
|
486
|
-
"arrow-spacing": ["error", { before: true, after: true }],
|
|
487
|
-
"block-spacing": ["error", "always"],
|
|
488
|
-
"brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
489
488
|
camelcase: [
|
|
490
489
|
"error",
|
|
491
490
|
{
|
|
@@ -494,60 +493,11 @@ var javascript = defineConfig([
|
|
|
494
493
|
ignoreGlobals: true
|
|
495
494
|
}
|
|
496
495
|
],
|
|
497
|
-
"comma-spacing": ["error", { before: false, after: true }],
|
|
498
|
-
"comma-style": ["error", "last"],
|
|
499
|
-
"computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
500
496
|
"constructor-super": "error",
|
|
501
497
|
curly: ["error", "multi-line"],
|
|
502
498
|
"default-case-last": "error",
|
|
503
|
-
"dot-location": ["error", "property"],
|
|
504
499
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
505
|
-
"eol-last": "error",
|
|
506
|
-
"func-call-spacing": ["error", "never"],
|
|
507
|
-
indent: [
|
|
508
|
-
"error",
|
|
509
|
-
2,
|
|
510
|
-
{
|
|
511
|
-
SwitchCase: 1,
|
|
512
|
-
VariableDeclarator: 1,
|
|
513
|
-
outerIIFEBody: 1,
|
|
514
|
-
MemberExpression: 1,
|
|
515
|
-
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
516
|
-
FunctionExpression: { parameters: 1, body: 1 },
|
|
517
|
-
CallExpression: { arguments: 1 },
|
|
518
|
-
ArrayExpression: 1,
|
|
519
|
-
ObjectExpression: 1,
|
|
520
|
-
ImportDeclaration: 1,
|
|
521
|
-
flatTernaryExpressions: false,
|
|
522
|
-
ignoreComments: false,
|
|
523
|
-
ignoredNodes: [
|
|
524
|
-
"TemplateLiteral *",
|
|
525
|
-
"JSXElement",
|
|
526
|
-
"JSXElement > *",
|
|
527
|
-
"JSXAttribute",
|
|
528
|
-
"JSXIdentifier",
|
|
529
|
-
"JSXNamespacedName",
|
|
530
|
-
"JSXMemberExpression",
|
|
531
|
-
"JSXSpreadAttribute",
|
|
532
|
-
"JSXExpressionContainer",
|
|
533
|
-
"JSXOpeningElement",
|
|
534
|
-
"JSXClosingElement",
|
|
535
|
-
"JSXFragment",
|
|
536
|
-
"JSXOpeningFragment",
|
|
537
|
-
"JSXClosingFragment",
|
|
538
|
-
"JSXText",
|
|
539
|
-
"JSXEmptyExpression",
|
|
540
|
-
"JSXSpreadChild"
|
|
541
|
-
],
|
|
542
|
-
offsetTernaryExpressions: true
|
|
543
|
-
}
|
|
544
|
-
],
|
|
545
|
-
"key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
546
|
-
"keyword-spacing": ["error", { before: true, after: true }],
|
|
547
|
-
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
548
|
-
"multiline-ternary": ["error", "always-multiline"],
|
|
549
500
|
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
|
550
|
-
"new-parens": "error",
|
|
551
501
|
"no-array-constructor": "error",
|
|
552
502
|
"no-async-promise-executor": "error",
|
|
553
503
|
"no-caller": "error",
|
|
@@ -572,9 +522,7 @@ var javascript = defineConfig([
|
|
|
572
522
|
"no-extend-native": "error",
|
|
573
523
|
"no-extra-bind": "error",
|
|
574
524
|
"no-extra-boolean-cast": "error",
|
|
575
|
-
"no-extra-parens": ["error", "functions"],
|
|
576
525
|
"no-fallthrough": "error",
|
|
577
|
-
"no-floating-decimal": "error",
|
|
578
526
|
"no-func-assign": "error",
|
|
579
527
|
"no-global-assign": "error",
|
|
580
528
|
"no-implied-eval": "error",
|
|
@@ -588,23 +536,8 @@ var javascript = defineConfig([
|
|
|
588
536
|
"no-misleading-character-class": "error",
|
|
589
537
|
"no-prototype-builtins": "error",
|
|
590
538
|
"no-useless-catch": "error",
|
|
591
|
-
"no-mixed-operators": [
|
|
592
|
-
"error",
|
|
593
|
-
{
|
|
594
|
-
groups: [
|
|
595
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
596
|
-
["&&", "||"],
|
|
597
|
-
["in", "instanceof"]
|
|
598
|
-
],
|
|
599
|
-
allowSamePrecedence: true
|
|
600
|
-
}
|
|
601
|
-
],
|
|
602
|
-
"no-mixed-spaces-and-tabs": "error",
|
|
603
|
-
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
604
539
|
"no-new": "error",
|
|
605
540
|
"no-new-func": "error",
|
|
606
|
-
"no-new-object": "error",
|
|
607
|
-
"no-new-symbol": "error",
|
|
608
541
|
"no-new-wrappers": "error",
|
|
609
542
|
"no-obj-calls": "error",
|
|
610
543
|
"no-octal": "error",
|
|
@@ -617,11 +550,9 @@ var javascript = defineConfig([
|
|
|
617
550
|
"no-sequences": "error",
|
|
618
551
|
"no-shadow-restricted-names": "error",
|
|
619
552
|
"no-sparse-arrays": "error",
|
|
620
|
-
"no-tabs": "error",
|
|
621
553
|
"no-template-curly-in-string": "error",
|
|
622
554
|
"no-this-before-super": "error",
|
|
623
555
|
"no-throw-literal": "error",
|
|
624
|
-
"no-trailing-spaces": "error",
|
|
625
556
|
"no-undef": "error",
|
|
626
557
|
"no-undef-init": "error",
|
|
627
558
|
"no-unexpected-multiline": "error",
|
|
@@ -653,23 +584,9 @@ var javascript = defineConfig([
|
|
|
653
584
|
"no-useless-constructor": "error",
|
|
654
585
|
"no-useless-rename": "error",
|
|
655
586
|
"no-useless-return": "error",
|
|
656
|
-
"no-whitespace-before-property": "error",
|
|
657
|
-
"object-curly-newline": ["error", { multiline: true, consistent: true }],
|
|
658
|
-
"object-curly-spacing": ["error", "always"],
|
|
659
|
-
"object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
660
|
-
"padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }],
|
|
661
587
|
"prefer-promise-reject-errors": "error",
|
|
662
588
|
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
663
|
-
"quote-props": ["error", "as-needed"],
|
|
664
|
-
"rest-spread-spacing": ["error", "never"],
|
|
665
|
-
semi: ["error", "never"],
|
|
666
|
-
"semi-spacing": ["error", { before: false, after: true }],
|
|
667
|
-
"space-before-blocks": ["error", "always"],
|
|
668
|
-
"space-in-parens": ["error", "never"],
|
|
669
|
-
"space-infix-ops": "error",
|
|
670
|
-
"space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
671
589
|
"symbol-description": "error",
|
|
672
|
-
"template-tag-spacing": ["error", "never"],
|
|
673
590
|
"unicode-bom": ["error", "never"],
|
|
674
591
|
"use-isnan": [
|
|
675
592
|
"error",
|
|
@@ -679,32 +596,14 @@ var javascript = defineConfig([
|
|
|
679
596
|
}
|
|
680
597
|
],
|
|
681
598
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
682
|
-
"wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
683
599
|
yoda: ["error", "never"],
|
|
684
600
|
// es6+
|
|
685
601
|
"no-var": "error",
|
|
686
602
|
"prefer-rest-params": "error",
|
|
687
603
|
"prefer-spread": "error",
|
|
688
604
|
"prefer-template": "error",
|
|
689
|
-
"template-curly-spacing": "error",
|
|
690
|
-
"generator-star-spacing": "off",
|
|
691
605
|
"no-empty-static-block": "error",
|
|
692
606
|
"no-new-native-nonconstructor": "error",
|
|
693
|
-
"arrow-parens": [
|
|
694
|
-
"error",
|
|
695
|
-
"as-needed",
|
|
696
|
-
{
|
|
697
|
-
requireForBlockBody: false
|
|
698
|
-
}
|
|
699
|
-
],
|
|
700
|
-
quotes: [
|
|
701
|
-
"error",
|
|
702
|
-
"single",
|
|
703
|
-
{
|
|
704
|
-
avoidEscape: true,
|
|
705
|
-
allowTemplateLiterals: false
|
|
706
|
-
}
|
|
707
|
-
],
|
|
708
607
|
"prefer-const": [
|
|
709
608
|
"error",
|
|
710
609
|
{
|
|
@@ -727,21 +626,6 @@ var javascript = defineConfig([
|
|
|
727
626
|
avoidQuotes: true
|
|
728
627
|
}
|
|
729
628
|
],
|
|
730
|
-
"spaced-comment": [
|
|
731
|
-
"error",
|
|
732
|
-
"always",
|
|
733
|
-
{
|
|
734
|
-
line: {
|
|
735
|
-
markers: ["/"],
|
|
736
|
-
exceptions: ["/", "#"]
|
|
737
|
-
},
|
|
738
|
-
block: {
|
|
739
|
-
markers: ["!"],
|
|
740
|
-
exceptions: ["*"],
|
|
741
|
-
balanced: true
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
],
|
|
745
629
|
// best-practice
|
|
746
630
|
eqeqeq: ["error", "smart"],
|
|
747
631
|
complexity: ["error", { max: 30 }],
|
|
@@ -750,7 +634,6 @@ var javascript = defineConfig([
|
|
|
750
634
|
"consistent-return": "off",
|
|
751
635
|
"no-alert": "error",
|
|
752
636
|
"no-case-declarations": "error",
|
|
753
|
-
"no-multi-spaces": "error",
|
|
754
637
|
"no-multi-str": "error",
|
|
755
638
|
"no-with": "error",
|
|
756
639
|
"no-void": "error",
|
|
@@ -759,12 +642,9 @@ var javascript = defineConfig([
|
|
|
759
642
|
"require-await": "off",
|
|
760
643
|
"no-return-assign": "off",
|
|
761
644
|
"one-var": ["error", "never"],
|
|
762
|
-
"operator-linebreak": ["error", "before"],
|
|
763
|
-
"comma-dangle": ["error", "always-multiline"],
|
|
764
645
|
"max-params": ["error", { max: 5 }],
|
|
765
646
|
"max-depth": ["error", { max: 5 }],
|
|
766
647
|
"max-nested-callbacks": ["error", { max: 10 }],
|
|
767
|
-
"max-statements-per-line": ["error", { max: 2 }],
|
|
768
648
|
"max-lines": [
|
|
769
649
|
"error",
|
|
770
650
|
{
|
|
@@ -789,19 +669,6 @@ var javascript = defineConfig([
|
|
|
789
669
|
variables: true
|
|
790
670
|
}
|
|
791
671
|
],
|
|
792
|
-
"max-len": [
|
|
793
|
-
"error",
|
|
794
|
-
{
|
|
795
|
-
code: 200,
|
|
796
|
-
tabWidth: 2,
|
|
797
|
-
comments: 200,
|
|
798
|
-
ignoreUrls: true,
|
|
799
|
-
ignoreStrings: true,
|
|
800
|
-
ignoreRegExpLiterals: true,
|
|
801
|
-
ignoreTemplateLiterals: true,
|
|
802
|
-
ignoreTrailingComments: true
|
|
803
|
-
}
|
|
804
|
-
],
|
|
805
672
|
"sort-imports": [
|
|
806
673
|
"error",
|
|
807
674
|
{
|
|
@@ -933,9 +800,7 @@ var typescript = defineConfig([
|
|
|
933
800
|
{
|
|
934
801
|
name: "ntnyq/ts/cjs",
|
|
935
802
|
files: [GLOB_JS],
|
|
936
|
-
rules: {
|
|
937
|
-
"@typescript-eslint/no-var-requires": "off"
|
|
938
|
-
}
|
|
803
|
+
rules: {}
|
|
939
804
|
}
|
|
940
805
|
]);
|
|
941
806
|
|
|
@@ -962,6 +827,43 @@ var unusedImports = defineConfig([
|
|
|
962
827
|
}
|
|
963
828
|
]);
|
|
964
829
|
|
|
830
|
+
// src/configs/perfectionist.ts
|
|
831
|
+
var perfectionist = defineConfig([
|
|
832
|
+
{
|
|
833
|
+
name: "ntnyq/perfectionist",
|
|
834
|
+
plugins: {
|
|
835
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
836
|
+
},
|
|
837
|
+
rules: {
|
|
838
|
+
"perfectionist/sort-imports": [
|
|
839
|
+
"error",
|
|
840
|
+
{
|
|
841
|
+
groups: [
|
|
842
|
+
"builtin",
|
|
843
|
+
"external",
|
|
844
|
+
"internal",
|
|
845
|
+
"internal-type",
|
|
846
|
+
"parent",
|
|
847
|
+
"parent-type",
|
|
848
|
+
"sibling",
|
|
849
|
+
"sibling-type",
|
|
850
|
+
"index",
|
|
851
|
+
"index-type",
|
|
852
|
+
"object",
|
|
853
|
+
"type",
|
|
854
|
+
"side-effect",
|
|
855
|
+
"side-effect-style"
|
|
856
|
+
],
|
|
857
|
+
internalPattern: ["~/**", "@/**", "#**"],
|
|
858
|
+
newlinesBetween: "ignore"
|
|
859
|
+
}
|
|
860
|
+
],
|
|
861
|
+
"perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
|
|
862
|
+
"perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
]);
|
|
866
|
+
|
|
965
867
|
// src/configs/regexp.ts
|
|
966
868
|
var regexp = defineConfig([
|
|
967
869
|
/**
|
|
@@ -1004,8 +906,6 @@ var yml = defineConfig([
|
|
|
1004
906
|
yml: import_eslint_plugin_yml.default
|
|
1005
907
|
},
|
|
1006
908
|
rules: {
|
|
1007
|
-
// Avoid conflicts with js comment
|
|
1008
|
-
"spaced-comment": "off",
|
|
1009
909
|
...import_eslint_plugin_yml.default.configs.standard.rules,
|
|
1010
910
|
...import_eslint_plugin_yml.default.configs.prettier.rules,
|
|
1011
911
|
"yml/no-empty-mapping-value": "off",
|
|
@@ -1026,8 +926,6 @@ var toml = defineConfig([
|
|
|
1026
926
|
toml: import_eslint_plugin_toml.default
|
|
1027
927
|
},
|
|
1028
928
|
rules: {
|
|
1029
|
-
// Avoid conflicts with js comment
|
|
1030
|
-
"spaced-comment": "off",
|
|
1031
929
|
"toml/comma-style": "error",
|
|
1032
930
|
"toml/keys-order": "error",
|
|
1033
931
|
"toml/no-space-dots": "error",
|
|
@@ -1333,7 +1231,6 @@ var markdown = defineConfig([
|
|
|
1333
1231
|
"@typescript-eslint/no-redeclare": "off",
|
|
1334
1232
|
"@typescript-eslint/no-namespace": "off",
|
|
1335
1233
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1336
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
1337
1234
|
"@typescript-eslint/no-extraneous-class": "off",
|
|
1338
1235
|
"@typescript-eslint/no-use-before-define": "off"
|
|
1339
1236
|
}
|
|
@@ -1707,12 +1604,14 @@ function ntnyq(config = [], {
|
|
|
1707
1604
|
parserToml,
|
|
1708
1605
|
parserVue,
|
|
1709
1606
|
parserYaml,
|
|
1607
|
+
perfectionist,
|
|
1710
1608
|
pluginComments,
|
|
1711
1609
|
pluginImport,
|
|
1712
1610
|
pluginJsdoc,
|
|
1713
1611
|
pluginJsonc,
|
|
1714
1612
|
pluginMarkdown,
|
|
1715
1613
|
pluginNode,
|
|
1614
|
+
pluginPerfectionist,
|
|
1716
1615
|
pluginPrettier,
|
|
1717
1616
|
pluginRegexp,
|
|
1718
1617
|
pluginToml,
|