@ntnyq/eslint-config 3.4.0 → 3.5.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 +3 -2
- package/dist/index.cjs +353 -262
- package/dist/index.d.cts +61 -12
- package/dist/index.d.ts +61 -12
- package/dist/index.js +353 -262
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -358,14 +358,37 @@ var unCategorizedRules = {
|
|
|
358
358
|
var vue = (options = {}) => {
|
|
359
359
|
const isVue3 = options.vueVersion !== 2;
|
|
360
360
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
361
|
+
const { files: FILES_VUE = [GLOB_VUE] } = options;
|
|
362
|
+
function getVueProcessor() {
|
|
363
|
+
const processorVueSFC = default3.processors[".vue"];
|
|
364
|
+
if (!sfcBlocks) return processorVueSFC;
|
|
365
|
+
return mergeProcessors2([
|
|
366
|
+
processorVueSFC,
|
|
367
|
+
default22({
|
|
368
|
+
...sfcBlocks,
|
|
369
|
+
blocks: {
|
|
370
|
+
styles: true,
|
|
371
|
+
...sfcBlocks.blocks
|
|
372
|
+
}
|
|
373
|
+
})
|
|
374
|
+
]);
|
|
375
|
+
}
|
|
361
376
|
return [
|
|
362
377
|
{
|
|
363
378
|
name: "ntnyq/vue/setup",
|
|
364
379
|
plugins: {
|
|
365
380
|
vue: default3,
|
|
366
381
|
"@typescript-eslint": plugin
|
|
367
|
-
}
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
name: "ntnyq/vue/rules",
|
|
386
|
+
files: [
|
|
387
|
+
// File apply vue rules
|
|
388
|
+
...FILES_VUE
|
|
389
|
+
],
|
|
368
390
|
languageOptions: {
|
|
391
|
+
parser: parserVue,
|
|
369
392
|
parserOptions: {
|
|
370
393
|
sourceType: "module",
|
|
371
394
|
ecmaVersion: "latest",
|
|
@@ -375,24 +398,8 @@ var vue = (options = {}) => {
|
|
|
375
398
|
jsx: true
|
|
376
399
|
}
|
|
377
400
|
}
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
{
|
|
381
|
-
name: "ntnyq/vue/rules",
|
|
382
|
-
files: [GLOB_VUE],
|
|
383
|
-
languageOptions: {
|
|
384
|
-
parser: parserVue
|
|
385
401
|
},
|
|
386
|
-
processor:
|
|
387
|
-
default3.processors[".vue"],
|
|
388
|
-
default22({
|
|
389
|
-
...sfcBlocks,
|
|
390
|
-
blocks: {
|
|
391
|
-
styles: true,
|
|
392
|
-
...sfcBlocks.blocks
|
|
393
|
-
}
|
|
394
|
-
})
|
|
395
|
-
]),
|
|
402
|
+
processor: getVueProcessor(),
|
|
396
403
|
rules: {
|
|
397
404
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
398
405
|
"vue/html-self-closing": [
|
|
@@ -738,6 +745,16 @@ var sort = (options = {}) => {
|
|
|
738
745
|
"activationEvents",
|
|
739
746
|
"contributes",
|
|
740
747
|
"categories",
|
|
748
|
+
"galleryBanner",
|
|
749
|
+
"badges",
|
|
750
|
+
"markdown",
|
|
751
|
+
"qna",
|
|
752
|
+
"sponsor",
|
|
753
|
+
"extensionPack",
|
|
754
|
+
"extensionDependencies",
|
|
755
|
+
"extensionKind",
|
|
756
|
+
"pricing",
|
|
757
|
+
"capabilities",
|
|
741
758
|
/**
|
|
742
759
|
* Package manager
|
|
743
760
|
*/
|
|
@@ -767,6 +784,20 @@ var sort = (options = {}) => {
|
|
|
767
784
|
pathPattern: "^exports.*$",
|
|
768
785
|
order: ["types", "import", "require", "default"]
|
|
769
786
|
},
|
|
787
|
+
// VSCode extension
|
|
788
|
+
{
|
|
789
|
+
order: { type: "asc" },
|
|
790
|
+
pathPattern: "^contributes.*$"
|
|
791
|
+
},
|
|
792
|
+
/**
|
|
793
|
+
* pnpm publish config
|
|
794
|
+
* @see {@link https://pnpm.io/package_json#publishconfig}
|
|
795
|
+
*/
|
|
796
|
+
{
|
|
797
|
+
order: { type: "asc" },
|
|
798
|
+
pathPattern: "^publishConfig.*$"
|
|
799
|
+
},
|
|
800
|
+
// npm scripts
|
|
770
801
|
{
|
|
771
802
|
pathPattern: "^scripts$",
|
|
772
803
|
order: { type: "asc" }
|
|
@@ -793,6 +824,18 @@ var sort = (options = {}) => {
|
|
|
793
824
|
{
|
|
794
825
|
pathPattern: "^files$",
|
|
795
826
|
order: { type: "asc" }
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
pathPattern: "^keywords$",
|
|
830
|
+
order: { type: "asc" }
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
pathPattern: "^activationEvents$",
|
|
834
|
+
order: { type: "asc" }
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
pathPattern: "^contributes.*$",
|
|
838
|
+
order: { type: "asc" }
|
|
796
839
|
}
|
|
797
840
|
]
|
|
798
841
|
}
|
|
@@ -1057,8 +1100,7 @@ var unocss = (options = {}) => [
|
|
|
1057
1100
|
},
|
|
1058
1101
|
rules: {
|
|
1059
1102
|
"unocss/order": "error",
|
|
1060
|
-
|
|
1061
|
-
"unocss/order-attributify": "off",
|
|
1103
|
+
"unocss/order-attributify": options.attributify ? "error" : "off",
|
|
1062
1104
|
// Overrides rules
|
|
1063
1105
|
...options.overrides
|
|
1064
1106
|
}
|
|
@@ -1461,14 +1503,43 @@ var comments = (options = {}) => [
|
|
|
1461
1503
|
// src/configs/markdown.ts
|
|
1462
1504
|
var markdown = (options = {}) => {
|
|
1463
1505
|
if (!Array.isArray(default7.configs?.processor)) return [];
|
|
1506
|
+
const { files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`], extensions = [] } = options;
|
|
1464
1507
|
return [
|
|
1465
1508
|
...default7.configs.processor.map((config) => ({
|
|
1466
1509
|
...config,
|
|
1467
1510
|
name: `ntnyq/${config.name}`
|
|
1468
1511
|
})),
|
|
1512
|
+
{
|
|
1513
|
+
name: "ntnyq/markdown/processor",
|
|
1514
|
+
files,
|
|
1515
|
+
ignores: [GLOB_MARKDOWN_NESTED],
|
|
1516
|
+
processor: mergeProcessors([
|
|
1517
|
+
default7.processors.markdown,
|
|
1518
|
+
// Just pass through processor
|
|
1519
|
+
processorPassThrough
|
|
1520
|
+
])
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
name: "ntnyq/markdown/parser",
|
|
1524
|
+
files,
|
|
1525
|
+
languageOptions: {
|
|
1526
|
+
parser: parserPlain
|
|
1527
|
+
}
|
|
1528
|
+
},
|
|
1469
1529
|
{
|
|
1470
1530
|
name: "ntnyq/markdown/disabled/code-blocks",
|
|
1471
|
-
files: [
|
|
1531
|
+
files: [
|
|
1532
|
+
...files,
|
|
1533
|
+
// Extension block support
|
|
1534
|
+
...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
1535
|
+
],
|
|
1536
|
+
languageOptions: {
|
|
1537
|
+
parserOptions: {
|
|
1538
|
+
ecmaFeatures: {
|
|
1539
|
+
impliedStrict: true
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1472
1543
|
rules: {
|
|
1473
1544
|
"no-undef": "off",
|
|
1474
1545
|
"no-alert": "off",
|
|
@@ -1600,222 +1671,220 @@ var gitignore = (options = {}) => {
|
|
|
1600
1671
|
// src/configs/javascript.ts
|
|
1601
1672
|
import jsConfig from "@eslint/js";
|
|
1602
1673
|
import globals2 from "globals";
|
|
1603
|
-
var
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
"
|
|
1610
|
-
"error",
|
|
1611
|
-
{
|
|
1612
|
-
max: 1e3,
|
|
1613
|
-
skipComments: true,
|
|
1614
|
-
skipBlankLines: true
|
|
1615
|
-
}
|
|
1616
|
-
],
|
|
1617
|
-
"max-lines-per-function": [
|
|
1618
|
-
"error",
|
|
1619
|
-
{
|
|
1620
|
-
max: 200,
|
|
1621
|
-
skipComments: true,
|
|
1622
|
-
skipBlankLines: true
|
|
1623
|
-
}
|
|
1624
|
-
]
|
|
1625
|
-
};
|
|
1626
|
-
return [
|
|
1674
|
+
var strictRules = {
|
|
1675
|
+
complexity: ["error", { max: 30 }],
|
|
1676
|
+
"max-params": ["error", { max: 5 }],
|
|
1677
|
+
"max-depth": ["error", { max: 5 }],
|
|
1678
|
+
"max-nested-callbacks": ["error", { max: 10 }],
|
|
1679
|
+
"max-lines": [
|
|
1680
|
+
"error",
|
|
1627
1681
|
{
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1682
|
+
max: 1e3,
|
|
1683
|
+
skipComments: true,
|
|
1684
|
+
skipBlankLines: true
|
|
1685
|
+
}
|
|
1686
|
+
],
|
|
1687
|
+
"max-lines-per-function": [
|
|
1688
|
+
"error",
|
|
1631
1689
|
{
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
...globals2.browser,
|
|
1636
|
-
...globals2.es2021,
|
|
1637
|
-
...globals2.node
|
|
1638
|
-
},
|
|
1639
|
-
sourceType: "module"
|
|
1640
|
-
},
|
|
1641
|
-
rules: {
|
|
1642
|
-
"require-await": "off",
|
|
1643
|
-
"no-return-assign": "off",
|
|
1644
|
-
"no-useless-escape": "off",
|
|
1645
|
-
"consistent-return": "off",
|
|
1646
|
-
// disabled in favor of `perfectionist/sort-named-imports`
|
|
1647
|
-
"sort-imports": "off",
|
|
1648
|
-
// standard v17.0.0
|
|
1649
|
-
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
1650
|
-
camelcase: [
|
|
1651
|
-
"error",
|
|
1652
|
-
{
|
|
1653
|
-
allow: ["^UNSAFE_"],
|
|
1654
|
-
properties: "never",
|
|
1655
|
-
ignoreGlobals: true
|
|
1656
|
-
}
|
|
1657
|
-
],
|
|
1658
|
-
"constructor-super": "error",
|
|
1659
|
-
curly: ["error", "multi-line"],
|
|
1660
|
-
"default-case-last": "error",
|
|
1661
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
1662
|
-
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
|
1663
|
-
"no-array-constructor": "error",
|
|
1664
|
-
"no-async-promise-executor": "error",
|
|
1665
|
-
"no-caller": "error",
|
|
1666
|
-
"no-class-assign": "error",
|
|
1667
|
-
"no-compare-neg-zero": "error",
|
|
1668
|
-
"no-cond-assign": "error",
|
|
1669
|
-
"no-const-assign": "error",
|
|
1670
|
-
"no-constant-condition": ["error", { checkLoops: false }],
|
|
1671
|
-
"no-control-regex": "error",
|
|
1672
|
-
"no-debugger": "error",
|
|
1673
|
-
"no-delete-var": "error",
|
|
1674
|
-
"no-dupe-args": "error",
|
|
1675
|
-
"no-dupe-class-members": "error",
|
|
1676
|
-
"no-dupe-keys": "error",
|
|
1677
|
-
"no-duplicate-case": "error",
|
|
1678
|
-
"no-useless-backreference": "error",
|
|
1679
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
1680
|
-
"no-empty-character-class": "error",
|
|
1681
|
-
"no-empty-pattern": "error",
|
|
1682
|
-
"no-eval": "error",
|
|
1683
|
-
"no-ex-assign": "error",
|
|
1684
|
-
"no-extend-native": "error",
|
|
1685
|
-
"no-extra-bind": "error",
|
|
1686
|
-
"no-extra-boolean-cast": "error",
|
|
1687
|
-
"no-fallthrough": "error",
|
|
1688
|
-
"no-func-assign": "error",
|
|
1689
|
-
"no-global-assign": "error",
|
|
1690
|
-
"no-implied-eval": "error",
|
|
1691
|
-
"no-import-assign": "error",
|
|
1692
|
-
"no-invalid-regexp": "error",
|
|
1693
|
-
"no-irregular-whitespace": "error",
|
|
1694
|
-
"no-iterator": "error",
|
|
1695
|
-
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
1696
|
-
"no-lone-blocks": "error",
|
|
1697
|
-
"no-loss-of-precision": "error",
|
|
1698
|
-
"no-misleading-character-class": "error",
|
|
1699
|
-
"no-prototype-builtins": "error",
|
|
1700
|
-
"no-useless-catch": "error",
|
|
1701
|
-
"no-new": "error",
|
|
1702
|
-
"no-new-func": "error",
|
|
1703
|
-
"no-new-wrappers": "error",
|
|
1704
|
-
"no-obj-calls": "error",
|
|
1705
|
-
"no-octal": "error",
|
|
1706
|
-
"no-octal-escape": "error",
|
|
1707
|
-
"no-proto": "error",
|
|
1708
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
1709
|
-
"no-regex-spaces": "error",
|
|
1710
|
-
"no-self-assign": ["error", { props: true }],
|
|
1711
|
-
"no-self-compare": "error",
|
|
1712
|
-
"no-sequences": "error",
|
|
1713
|
-
"no-shadow-restricted-names": "error",
|
|
1714
|
-
"no-sparse-arrays": "error",
|
|
1715
|
-
"no-template-curly-in-string": "error",
|
|
1716
|
-
"no-this-before-super": "error",
|
|
1717
|
-
"no-throw-literal": "error",
|
|
1718
|
-
"no-undef": "error",
|
|
1719
|
-
"no-undef-init": "error",
|
|
1720
|
-
"no-unexpected-multiline": "error",
|
|
1721
|
-
"no-unmodified-loop-condition": "error",
|
|
1722
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
1723
|
-
"no-unreachable": "error",
|
|
1724
|
-
"no-unreachable-loop": "error",
|
|
1725
|
-
"no-unsafe-finally": "error",
|
|
1726
|
-
"no-unsafe-negation": "error",
|
|
1727
|
-
"no-unused-expressions": [
|
|
1728
|
-
"error",
|
|
1729
|
-
{
|
|
1730
|
-
allowShortCircuit: true,
|
|
1731
|
-
allowTernary: true,
|
|
1732
|
-
allowTaggedTemplates: true
|
|
1733
|
-
}
|
|
1734
|
-
],
|
|
1735
|
-
"no-unused-vars": [
|
|
1736
|
-
"error",
|
|
1737
|
-
{
|
|
1738
|
-
args: "none",
|
|
1739
|
-
caughtErrors: "none",
|
|
1740
|
-
ignoreRestSiblings: true,
|
|
1741
|
-
vars: "all"
|
|
1742
|
-
}
|
|
1743
|
-
],
|
|
1744
|
-
"no-useless-call": "error",
|
|
1745
|
-
"no-useless-computed-key": "error",
|
|
1746
|
-
"no-useless-constructor": "error",
|
|
1747
|
-
"no-useless-rename": "error",
|
|
1748
|
-
"no-useless-return": "error",
|
|
1749
|
-
"prefer-promise-reject-errors": "error",
|
|
1750
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
1751
|
-
"symbol-description": "error",
|
|
1752
|
-
"unicode-bom": ["error", "never"],
|
|
1753
|
-
"use-isnan": [
|
|
1754
|
-
"error",
|
|
1755
|
-
{
|
|
1756
|
-
enforceForSwitchCase: true,
|
|
1757
|
-
enforceForIndexOf: true
|
|
1758
|
-
}
|
|
1759
|
-
],
|
|
1760
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
1761
|
-
yoda: ["error", "never"],
|
|
1762
|
-
// es6+
|
|
1763
|
-
"no-var": "error",
|
|
1764
|
-
"prefer-rest-params": "error",
|
|
1765
|
-
"prefer-spread": "error",
|
|
1766
|
-
"prefer-template": "error",
|
|
1767
|
-
"no-empty-static-block": "error",
|
|
1768
|
-
"no-new-native-nonconstructor": "error",
|
|
1769
|
-
"prefer-const": [
|
|
1770
|
-
"error",
|
|
1771
|
-
{
|
|
1772
|
-
destructuring: "all",
|
|
1773
|
-
ignoreReadBeforeAssign: true
|
|
1774
|
-
}
|
|
1775
|
-
],
|
|
1776
|
-
"prefer-arrow-callback": [
|
|
1777
|
-
"error",
|
|
1778
|
-
{
|
|
1779
|
-
allowNamedFunctions: false,
|
|
1780
|
-
allowUnboundThis: true
|
|
1781
|
-
}
|
|
1782
|
-
],
|
|
1783
|
-
"object-shorthand": [
|
|
1784
|
-
"error",
|
|
1785
|
-
"always",
|
|
1786
|
-
{
|
|
1787
|
-
ignoreConstructors: false,
|
|
1788
|
-
avoidQuotes: true
|
|
1789
|
-
}
|
|
1790
|
-
],
|
|
1791
|
-
// best-practice
|
|
1792
|
-
eqeqeq: ["error", "smart"],
|
|
1793
|
-
"array-callback-return": "error",
|
|
1794
|
-
"block-scoped-var": "error",
|
|
1795
|
-
"no-alert": "error",
|
|
1796
|
-
"no-case-declarations": "error",
|
|
1797
|
-
"no-multi-str": "error",
|
|
1798
|
-
"no-with": "error",
|
|
1799
|
-
"no-void": "error",
|
|
1800
|
-
"vars-on-top": "error",
|
|
1801
|
-
"one-var": ["error", "never"],
|
|
1802
|
-
"no-use-before-define": [
|
|
1803
|
-
"error",
|
|
1804
|
-
{
|
|
1805
|
-
functions: false,
|
|
1806
|
-
classes: false,
|
|
1807
|
-
variables: true,
|
|
1808
|
-
allowNamedExports: false
|
|
1809
|
-
}
|
|
1810
|
-
],
|
|
1811
|
-
// Strict rules
|
|
1812
|
-
...options.strict ? strictRules : {},
|
|
1813
|
-
// Overrides rules
|
|
1814
|
-
...options.overrides
|
|
1815
|
-
}
|
|
1690
|
+
max: 200,
|
|
1691
|
+
skipComments: true,
|
|
1692
|
+
skipBlankLines: true
|
|
1816
1693
|
}
|
|
1817
|
-
]
|
|
1694
|
+
]
|
|
1818
1695
|
};
|
|
1696
|
+
var javascript = (options = {}) => [
|
|
1697
|
+
{
|
|
1698
|
+
...jsConfig.configs.recommended,
|
|
1699
|
+
name: "ntnyq/js/recommended"
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
name: "ntnyq/js/core",
|
|
1703
|
+
languageOptions: {
|
|
1704
|
+
globals: {
|
|
1705
|
+
...globals2.browser,
|
|
1706
|
+
...globals2.es2021,
|
|
1707
|
+
...globals2.node
|
|
1708
|
+
},
|
|
1709
|
+
sourceType: "module"
|
|
1710
|
+
},
|
|
1711
|
+
rules: {
|
|
1712
|
+
"require-await": "off",
|
|
1713
|
+
"no-return-assign": "off",
|
|
1714
|
+
"no-useless-escape": "off",
|
|
1715
|
+
"consistent-return": "off",
|
|
1716
|
+
// disabled in favor of `perfectionist/sort-named-imports`
|
|
1717
|
+
"sort-imports": "off",
|
|
1718
|
+
// standard v17.0.0
|
|
1719
|
+
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
1720
|
+
camelcase: [
|
|
1721
|
+
"error",
|
|
1722
|
+
{
|
|
1723
|
+
allow: ["^UNSAFE_"],
|
|
1724
|
+
properties: "never",
|
|
1725
|
+
ignoreGlobals: true
|
|
1726
|
+
}
|
|
1727
|
+
],
|
|
1728
|
+
"constructor-super": "error",
|
|
1729
|
+
curly: ["error", "multi-line"],
|
|
1730
|
+
"default-case-last": "error",
|
|
1731
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
1732
|
+
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
|
1733
|
+
"no-array-constructor": "error",
|
|
1734
|
+
"no-async-promise-executor": "error",
|
|
1735
|
+
"no-caller": "error",
|
|
1736
|
+
"no-class-assign": "error",
|
|
1737
|
+
"no-compare-neg-zero": "error",
|
|
1738
|
+
"no-cond-assign": "error",
|
|
1739
|
+
"no-const-assign": "error",
|
|
1740
|
+
"no-constant-condition": ["error", { checkLoops: false }],
|
|
1741
|
+
"no-control-regex": "error",
|
|
1742
|
+
"no-debugger": "error",
|
|
1743
|
+
"no-delete-var": "error",
|
|
1744
|
+
"no-dupe-args": "error",
|
|
1745
|
+
"no-dupe-class-members": "error",
|
|
1746
|
+
"no-dupe-keys": "error",
|
|
1747
|
+
"no-duplicate-case": "error",
|
|
1748
|
+
"no-useless-backreference": "error",
|
|
1749
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
1750
|
+
"no-empty-character-class": "error",
|
|
1751
|
+
"no-empty-pattern": "error",
|
|
1752
|
+
"no-eval": "error",
|
|
1753
|
+
"no-ex-assign": "error",
|
|
1754
|
+
"no-extend-native": "error",
|
|
1755
|
+
"no-extra-bind": "error",
|
|
1756
|
+
"no-extra-boolean-cast": "error",
|
|
1757
|
+
"no-fallthrough": "error",
|
|
1758
|
+
"no-func-assign": "error",
|
|
1759
|
+
"no-global-assign": "error",
|
|
1760
|
+
"no-implied-eval": "error",
|
|
1761
|
+
"no-import-assign": "error",
|
|
1762
|
+
"no-invalid-regexp": "error",
|
|
1763
|
+
"no-irregular-whitespace": "error",
|
|
1764
|
+
"no-iterator": "error",
|
|
1765
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
1766
|
+
"no-lone-blocks": "error",
|
|
1767
|
+
"no-loss-of-precision": "error",
|
|
1768
|
+
"no-misleading-character-class": "error",
|
|
1769
|
+
"no-prototype-builtins": "error",
|
|
1770
|
+
"no-useless-catch": "error",
|
|
1771
|
+
"no-new": "error",
|
|
1772
|
+
"no-new-func": "error",
|
|
1773
|
+
"no-new-wrappers": "error",
|
|
1774
|
+
"no-obj-calls": "error",
|
|
1775
|
+
"no-octal": "error",
|
|
1776
|
+
"no-octal-escape": "error",
|
|
1777
|
+
"no-proto": "error",
|
|
1778
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
1779
|
+
"no-regex-spaces": "error",
|
|
1780
|
+
"no-self-assign": ["error", { props: true }],
|
|
1781
|
+
"no-self-compare": "error",
|
|
1782
|
+
"no-sequences": "error",
|
|
1783
|
+
"no-shadow-restricted-names": "error",
|
|
1784
|
+
"no-sparse-arrays": "error",
|
|
1785
|
+
"no-template-curly-in-string": "error",
|
|
1786
|
+
"no-this-before-super": "error",
|
|
1787
|
+
"no-throw-literal": "error",
|
|
1788
|
+
"no-undef": "error",
|
|
1789
|
+
"no-undef-init": "error",
|
|
1790
|
+
"no-unexpected-multiline": "error",
|
|
1791
|
+
"no-unmodified-loop-condition": "error",
|
|
1792
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
1793
|
+
"no-unreachable": "error",
|
|
1794
|
+
"no-unreachable-loop": "error",
|
|
1795
|
+
"no-unsafe-finally": "error",
|
|
1796
|
+
"no-unsafe-negation": "error",
|
|
1797
|
+
"no-unused-expressions": [
|
|
1798
|
+
"error",
|
|
1799
|
+
{
|
|
1800
|
+
allowShortCircuit: true,
|
|
1801
|
+
allowTernary: true,
|
|
1802
|
+
allowTaggedTemplates: true
|
|
1803
|
+
}
|
|
1804
|
+
],
|
|
1805
|
+
"no-unused-vars": [
|
|
1806
|
+
"error",
|
|
1807
|
+
{
|
|
1808
|
+
args: "none",
|
|
1809
|
+
caughtErrors: "none",
|
|
1810
|
+
ignoreRestSiblings: true,
|
|
1811
|
+
vars: "all"
|
|
1812
|
+
}
|
|
1813
|
+
],
|
|
1814
|
+
"no-useless-call": "error",
|
|
1815
|
+
"no-useless-computed-key": "error",
|
|
1816
|
+
"no-useless-constructor": "error",
|
|
1817
|
+
"no-useless-rename": "error",
|
|
1818
|
+
"no-useless-return": "error",
|
|
1819
|
+
"prefer-promise-reject-errors": "error",
|
|
1820
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
1821
|
+
"symbol-description": "error",
|
|
1822
|
+
"unicode-bom": ["error", "never"],
|
|
1823
|
+
"use-isnan": [
|
|
1824
|
+
"error",
|
|
1825
|
+
{
|
|
1826
|
+
enforceForSwitchCase: true,
|
|
1827
|
+
enforceForIndexOf: true
|
|
1828
|
+
}
|
|
1829
|
+
],
|
|
1830
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
1831
|
+
yoda: ["error", "never"],
|
|
1832
|
+
// es6+
|
|
1833
|
+
"no-var": "error",
|
|
1834
|
+
"prefer-rest-params": "error",
|
|
1835
|
+
"prefer-spread": "error",
|
|
1836
|
+
"prefer-template": "error",
|
|
1837
|
+
"no-empty-static-block": "error",
|
|
1838
|
+
"no-new-native-nonconstructor": "error",
|
|
1839
|
+
"prefer-const": [
|
|
1840
|
+
"error",
|
|
1841
|
+
{
|
|
1842
|
+
destructuring: "all",
|
|
1843
|
+
ignoreReadBeforeAssign: true
|
|
1844
|
+
}
|
|
1845
|
+
],
|
|
1846
|
+
"prefer-arrow-callback": [
|
|
1847
|
+
"error",
|
|
1848
|
+
{
|
|
1849
|
+
allowNamedFunctions: false,
|
|
1850
|
+
allowUnboundThis: true
|
|
1851
|
+
}
|
|
1852
|
+
],
|
|
1853
|
+
"object-shorthand": [
|
|
1854
|
+
"error",
|
|
1855
|
+
"always",
|
|
1856
|
+
{
|
|
1857
|
+
ignoreConstructors: false,
|
|
1858
|
+
avoidQuotes: true
|
|
1859
|
+
}
|
|
1860
|
+
],
|
|
1861
|
+
// best-practice
|
|
1862
|
+
eqeqeq: ["error", "smart"],
|
|
1863
|
+
"array-callback-return": "error",
|
|
1864
|
+
"block-scoped-var": "error",
|
|
1865
|
+
"no-alert": "error",
|
|
1866
|
+
"no-case-declarations": "error",
|
|
1867
|
+
"no-multi-str": "error",
|
|
1868
|
+
"no-with": "error",
|
|
1869
|
+
"no-void": "error",
|
|
1870
|
+
"vars-on-top": "error",
|
|
1871
|
+
"one-var": ["error", "never"],
|
|
1872
|
+
"no-use-before-define": [
|
|
1873
|
+
"error",
|
|
1874
|
+
{
|
|
1875
|
+
functions: false,
|
|
1876
|
+
classes: false,
|
|
1877
|
+
variables: true,
|
|
1878
|
+
allowNamedExports: false
|
|
1879
|
+
}
|
|
1880
|
+
],
|
|
1881
|
+
// Strict rules
|
|
1882
|
+
...options.strict ? strictRules : {},
|
|
1883
|
+
// Overrides rules
|
|
1884
|
+
...options.overrides
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
];
|
|
1819
1888
|
var jsx = () => [
|
|
1820
1889
|
{
|
|
1821
1890
|
name: "ntnyq/jsx",
|
|
@@ -1869,30 +1938,38 @@ var recommendedRules = configs.recommended.reduce((rules, config) => {
|
|
|
1869
1938
|
var typescript = (options = {}) => {
|
|
1870
1939
|
const enableTypeAwareLint = !!options?.tsconfigPath;
|
|
1871
1940
|
const {
|
|
1941
|
+
extensions = [],
|
|
1872
1942
|
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
1873
1943
|
ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
|
|
1874
1944
|
overridesTypeAwareRules = {},
|
|
1875
1945
|
parserOptions = {}
|
|
1876
1946
|
} = options;
|
|
1877
|
-
|
|
1947
|
+
const files = options.files ?? [
|
|
1948
|
+
GLOB_TS,
|
|
1949
|
+
GLOB_TSX,
|
|
1950
|
+
// Enable typescript in these exts
|
|
1951
|
+
...extensions.map((ext) => `**/*.${ext}`)
|
|
1952
|
+
];
|
|
1953
|
+
function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
|
|
1954
|
+
const typescriptParserOptions = {
|
|
1955
|
+
extraFileExtensions: extensions.map((ext) => `.${ext}`),
|
|
1956
|
+
sourceType: "module",
|
|
1957
|
+
...enableTypeAware ? {
|
|
1958
|
+
projectService: {
|
|
1959
|
+
allowDefaultProject: ["./*.js"],
|
|
1960
|
+
defaultProject: options.tsconfigPath
|
|
1961
|
+
},
|
|
1962
|
+
tsconfigRootDir: process2.cwd()
|
|
1963
|
+
} : {},
|
|
1964
|
+
...parserOptions
|
|
1965
|
+
};
|
|
1878
1966
|
const parserConfig = {
|
|
1879
1967
|
name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
|
|
1880
|
-
files,
|
|
1968
|
+
files: files2,
|
|
1881
1969
|
ignores: [...ignores2],
|
|
1882
1970
|
languageOptions: {
|
|
1883
1971
|
parser: parserTypeScript,
|
|
1884
|
-
parserOptions:
|
|
1885
|
-
// extraFileExtensions: [''],
|
|
1886
|
-
sourceType: "module",
|
|
1887
|
-
...enableTypeAware ? {
|
|
1888
|
-
projectService: {
|
|
1889
|
-
allowDefaultProject: ["./*.js"],
|
|
1890
|
-
defaultProject: options.tsconfigPath
|
|
1891
|
-
},
|
|
1892
|
-
tsconfigRootDir: process2.cwd()
|
|
1893
|
-
} : {},
|
|
1894
|
-
...parserOptions
|
|
1895
|
-
}
|
|
1972
|
+
parserOptions: typescriptParserOptions
|
|
1896
1973
|
}
|
|
1897
1974
|
};
|
|
1898
1975
|
return parserConfig;
|
|
@@ -1906,12 +1983,12 @@ var typescript = (options = {}) => {
|
|
|
1906
1983
|
}
|
|
1907
1984
|
},
|
|
1908
1985
|
...enableTypeAwareLint ? [
|
|
1909
|
-
createParserConfig(false,
|
|
1986
|
+
createParserConfig(false, files),
|
|
1910
1987
|
createParserConfig(true, filesTypeAware, ignoresTypeAware)
|
|
1911
|
-
] : [createParserConfig(false,
|
|
1988
|
+
] : [createParserConfig(false, files)],
|
|
1912
1989
|
{
|
|
1913
1990
|
name: "ntnyq/ts/rules",
|
|
1914
|
-
files
|
|
1991
|
+
files,
|
|
1915
1992
|
rules: {
|
|
1916
1993
|
...recommendedRules,
|
|
1917
1994
|
// Disabled in favor of ts rules
|
|
@@ -2156,7 +2233,18 @@ var unusedImports = (options = {}) => [
|
|
|
2156
2233
|
// src/core.ts
|
|
2157
2234
|
async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2158
2235
|
const configs2 = [];
|
|
2159
|
-
|
|
2236
|
+
const {
|
|
2237
|
+
markdown: enableMarkdown = true,
|
|
2238
|
+
gitignore: enableGitIgnore = true,
|
|
2239
|
+
vue: enableVue = hasVue,
|
|
2240
|
+
unocss: enableUnoCSS = hasUnoCSS,
|
|
2241
|
+
typescript: enableTypeScript = hasTypeScript,
|
|
2242
|
+
extensions: supportedExtensions = []
|
|
2243
|
+
} = options;
|
|
2244
|
+
if (enableVue) {
|
|
2245
|
+
supportedExtensions.push("vue");
|
|
2246
|
+
}
|
|
2247
|
+
if (enableGitIgnore) {
|
|
2160
2248
|
configs2.push(
|
|
2161
2249
|
...gitignore({
|
|
2162
2250
|
...resolveSubOptions(options, "gitignore")
|
|
@@ -2209,14 +2297,24 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2209
2297
|
})
|
|
2210
2298
|
);
|
|
2211
2299
|
}
|
|
2212
|
-
if (
|
|
2300
|
+
if (enableTypeScript) {
|
|
2213
2301
|
configs2.push(
|
|
2214
2302
|
...typescript({
|
|
2215
2303
|
...resolveSubOptions(options, "typescript"),
|
|
2304
|
+
extensions: supportedExtensions,
|
|
2216
2305
|
overrides: getOverrides(options, "typescript")
|
|
2217
2306
|
})
|
|
2218
2307
|
);
|
|
2219
2308
|
}
|
|
2309
|
+
if (enableVue) {
|
|
2310
|
+
configs2.push(
|
|
2311
|
+
...vue({
|
|
2312
|
+
...resolveSubOptions(options, "vue"),
|
|
2313
|
+
typescript: !!enableTypeScript,
|
|
2314
|
+
overrides: getOverrides(options, "vue")
|
|
2315
|
+
})
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2220
2318
|
if (options.yml ?? true) {
|
|
2221
2319
|
configs2.push(
|
|
2222
2320
|
...yml({
|
|
@@ -2245,14 +2343,6 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2245
2343
|
})
|
|
2246
2344
|
);
|
|
2247
2345
|
}
|
|
2248
|
-
if (options.vue ?? hasVue) {
|
|
2249
|
-
configs2.push(
|
|
2250
|
-
...vue({
|
|
2251
|
-
...resolveSubOptions(options, "vue"),
|
|
2252
|
-
overrides: getOverrides(options, "vue")
|
|
2253
|
-
})
|
|
2254
|
-
);
|
|
2255
|
-
}
|
|
2256
2346
|
if (options.test ?? hasVitest) {
|
|
2257
2347
|
configs2.push(
|
|
2258
2348
|
...test({
|
|
@@ -2263,16 +2353,17 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2263
2353
|
})
|
|
2264
2354
|
);
|
|
2265
2355
|
}
|
|
2266
|
-
if (
|
|
2356
|
+
if (enableUnoCSS) {
|
|
2267
2357
|
configs2.push(
|
|
2268
2358
|
...unocss({
|
|
2269
2359
|
overrides: getOverrides(options, "unocss")
|
|
2270
2360
|
})
|
|
2271
2361
|
);
|
|
2272
2362
|
}
|
|
2273
|
-
if (
|
|
2363
|
+
if (enableMarkdown) {
|
|
2274
2364
|
configs2.push(
|
|
2275
2365
|
...markdown({
|
|
2366
|
+
extensions: supportedExtensions,
|
|
2276
2367
|
overrides: getOverrides(options, "markdown")
|
|
2277
2368
|
})
|
|
2278
2369
|
);
|