@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.cjs
CHANGED
|
@@ -499,14 +499,37 @@ var unCategorizedRules = {
|
|
|
499
499
|
var vue = (options = {}) => {
|
|
500
500
|
const isVue3 = options.vueVersion !== 2;
|
|
501
501
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
502
|
+
const { files: FILES_VUE = [GLOB_VUE] } = options;
|
|
503
|
+
function getVueProcessor() {
|
|
504
|
+
const processorVueSFC = import_eslint_plugin_vue.default.processors[".vue"];
|
|
505
|
+
if (!sfcBlocks) return processorVueSFC;
|
|
506
|
+
return (0, import_eslint_merge_processors3.mergeProcessors)([
|
|
507
|
+
processorVueSFC,
|
|
508
|
+
(0, import_eslint_processor_vue_blocks.default)({
|
|
509
|
+
...sfcBlocks,
|
|
510
|
+
blocks: {
|
|
511
|
+
styles: true,
|
|
512
|
+
...sfcBlocks.blocks
|
|
513
|
+
}
|
|
514
|
+
})
|
|
515
|
+
]);
|
|
516
|
+
}
|
|
502
517
|
return [
|
|
503
518
|
{
|
|
504
519
|
name: "ntnyq/vue/setup",
|
|
505
520
|
plugins: {
|
|
506
521
|
vue: import_eslint_plugin_vue.default,
|
|
507
522
|
"@typescript-eslint": import_typescript_eslint2.plugin
|
|
508
|
-
}
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "ntnyq/vue/rules",
|
|
527
|
+
files: [
|
|
528
|
+
// File apply vue rules
|
|
529
|
+
...FILES_VUE
|
|
530
|
+
],
|
|
509
531
|
languageOptions: {
|
|
532
|
+
parser: parserVue,
|
|
510
533
|
parserOptions: {
|
|
511
534
|
sourceType: "module",
|
|
512
535
|
ecmaVersion: "latest",
|
|
@@ -516,24 +539,8 @@ var vue = (options = {}) => {
|
|
|
516
539
|
jsx: true
|
|
517
540
|
}
|
|
518
541
|
}
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
name: "ntnyq/vue/rules",
|
|
523
|
-
files: [GLOB_VUE],
|
|
524
|
-
languageOptions: {
|
|
525
|
-
parser: parserVue
|
|
526
542
|
},
|
|
527
|
-
processor:
|
|
528
|
-
import_eslint_plugin_vue.default.processors[".vue"],
|
|
529
|
-
(0, import_eslint_processor_vue_blocks.default)({
|
|
530
|
-
...sfcBlocks,
|
|
531
|
-
blocks: {
|
|
532
|
-
styles: true,
|
|
533
|
-
...sfcBlocks.blocks
|
|
534
|
-
}
|
|
535
|
-
})
|
|
536
|
-
]),
|
|
543
|
+
processor: getVueProcessor(),
|
|
537
544
|
rules: {
|
|
538
545
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
539
546
|
"vue/html-self-closing": [
|
|
@@ -879,6 +886,16 @@ var sort = (options = {}) => {
|
|
|
879
886
|
"activationEvents",
|
|
880
887
|
"contributes",
|
|
881
888
|
"categories",
|
|
889
|
+
"galleryBanner",
|
|
890
|
+
"badges",
|
|
891
|
+
"markdown",
|
|
892
|
+
"qna",
|
|
893
|
+
"sponsor",
|
|
894
|
+
"extensionPack",
|
|
895
|
+
"extensionDependencies",
|
|
896
|
+
"extensionKind",
|
|
897
|
+
"pricing",
|
|
898
|
+
"capabilities",
|
|
882
899
|
/**
|
|
883
900
|
* Package manager
|
|
884
901
|
*/
|
|
@@ -908,6 +925,20 @@ var sort = (options = {}) => {
|
|
|
908
925
|
pathPattern: "^exports.*$",
|
|
909
926
|
order: ["types", "import", "require", "default"]
|
|
910
927
|
},
|
|
928
|
+
// VSCode extension
|
|
929
|
+
{
|
|
930
|
+
order: { type: "asc" },
|
|
931
|
+
pathPattern: "^contributes.*$"
|
|
932
|
+
},
|
|
933
|
+
/**
|
|
934
|
+
* pnpm publish config
|
|
935
|
+
* @see {@link https://pnpm.io/package_json#publishconfig}
|
|
936
|
+
*/
|
|
937
|
+
{
|
|
938
|
+
order: { type: "asc" },
|
|
939
|
+
pathPattern: "^publishConfig.*$"
|
|
940
|
+
},
|
|
941
|
+
// npm scripts
|
|
911
942
|
{
|
|
912
943
|
pathPattern: "^scripts$",
|
|
913
944
|
order: { type: "asc" }
|
|
@@ -934,6 +965,18 @@ var sort = (options = {}) => {
|
|
|
934
965
|
{
|
|
935
966
|
pathPattern: "^files$",
|
|
936
967
|
order: { type: "asc" }
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
pathPattern: "^keywords$",
|
|
971
|
+
order: { type: "asc" }
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
pathPattern: "^activationEvents$",
|
|
975
|
+
order: { type: "asc" }
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
pathPattern: "^contributes.*$",
|
|
979
|
+
order: { type: "asc" }
|
|
937
980
|
}
|
|
938
981
|
]
|
|
939
982
|
}
|
|
@@ -1198,8 +1241,7 @@ var unocss = (options = {}) => [
|
|
|
1198
1241
|
},
|
|
1199
1242
|
rules: {
|
|
1200
1243
|
"unocss/order": "error",
|
|
1201
|
-
|
|
1202
|
-
"unocss/order-attributify": "off",
|
|
1244
|
+
"unocss/order-attributify": options.attributify ? "error" : "off",
|
|
1203
1245
|
// Overrides rules
|
|
1204
1246
|
...options.overrides
|
|
1205
1247
|
}
|
|
@@ -1602,14 +1644,43 @@ var comments = (options = {}) => [
|
|
|
1602
1644
|
// src/configs/markdown.ts
|
|
1603
1645
|
var markdown = (options = {}) => {
|
|
1604
1646
|
if (!Array.isArray(import_markdown.default.configs?.processor)) return [];
|
|
1647
|
+
const { files = [`${GLOB_MARKDOWN}/${GLOB_SRC}`], extensions = [] } = options;
|
|
1605
1648
|
return [
|
|
1606
1649
|
...import_markdown.default.configs.processor.map((config) => ({
|
|
1607
1650
|
...config,
|
|
1608
1651
|
name: `ntnyq/${config.name}`
|
|
1609
1652
|
})),
|
|
1653
|
+
{
|
|
1654
|
+
name: "ntnyq/markdown/processor",
|
|
1655
|
+
files,
|
|
1656
|
+
ignores: [GLOB_MARKDOWN_NESTED],
|
|
1657
|
+
processor: (0, import_eslint_merge_processors.mergeProcessors)([
|
|
1658
|
+
import_markdown.default.processors.markdown,
|
|
1659
|
+
// Just pass through processor
|
|
1660
|
+
import_eslint_merge_processors2.processorPassThrough
|
|
1661
|
+
])
|
|
1662
|
+
},
|
|
1663
|
+
{
|
|
1664
|
+
name: "ntnyq/markdown/parser",
|
|
1665
|
+
files,
|
|
1666
|
+
languageOptions: {
|
|
1667
|
+
parser: parserPlain
|
|
1668
|
+
}
|
|
1669
|
+
},
|
|
1610
1670
|
{
|
|
1611
1671
|
name: "ntnyq/markdown/disabled/code-blocks",
|
|
1612
|
-
files: [
|
|
1672
|
+
files: [
|
|
1673
|
+
...files,
|
|
1674
|
+
// Extension block support
|
|
1675
|
+
...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
1676
|
+
],
|
|
1677
|
+
languageOptions: {
|
|
1678
|
+
parserOptions: {
|
|
1679
|
+
ecmaFeatures: {
|
|
1680
|
+
impliedStrict: true
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
},
|
|
1613
1684
|
rules: {
|
|
1614
1685
|
"no-undef": "off",
|
|
1615
1686
|
"no-alert": "off",
|
|
@@ -1741,222 +1812,220 @@ var gitignore = (options = {}) => {
|
|
|
1741
1812
|
// src/configs/javascript.ts
|
|
1742
1813
|
var import_js = __toESM(require("@eslint/js"), 1);
|
|
1743
1814
|
var import_globals2 = __toESM(require("globals"), 1);
|
|
1744
|
-
var
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
"
|
|
1751
|
-
"error",
|
|
1752
|
-
{
|
|
1753
|
-
max: 1e3,
|
|
1754
|
-
skipComments: true,
|
|
1755
|
-
skipBlankLines: true
|
|
1756
|
-
}
|
|
1757
|
-
],
|
|
1758
|
-
"max-lines-per-function": [
|
|
1759
|
-
"error",
|
|
1760
|
-
{
|
|
1761
|
-
max: 200,
|
|
1762
|
-
skipComments: true,
|
|
1763
|
-
skipBlankLines: true
|
|
1764
|
-
}
|
|
1765
|
-
]
|
|
1766
|
-
};
|
|
1767
|
-
return [
|
|
1815
|
+
var strictRules = {
|
|
1816
|
+
complexity: ["error", { max: 30 }],
|
|
1817
|
+
"max-params": ["error", { max: 5 }],
|
|
1818
|
+
"max-depth": ["error", { max: 5 }],
|
|
1819
|
+
"max-nested-callbacks": ["error", { max: 10 }],
|
|
1820
|
+
"max-lines": [
|
|
1821
|
+
"error",
|
|
1768
1822
|
{
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1823
|
+
max: 1e3,
|
|
1824
|
+
skipComments: true,
|
|
1825
|
+
skipBlankLines: true
|
|
1826
|
+
}
|
|
1827
|
+
],
|
|
1828
|
+
"max-lines-per-function": [
|
|
1829
|
+
"error",
|
|
1772
1830
|
{
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
...import_globals2.default.browser,
|
|
1777
|
-
...import_globals2.default.es2021,
|
|
1778
|
-
...import_globals2.default.node
|
|
1779
|
-
},
|
|
1780
|
-
sourceType: "module"
|
|
1781
|
-
},
|
|
1782
|
-
rules: {
|
|
1783
|
-
"require-await": "off",
|
|
1784
|
-
"no-return-assign": "off",
|
|
1785
|
-
"no-useless-escape": "off",
|
|
1786
|
-
"consistent-return": "off",
|
|
1787
|
-
// disabled in favor of `perfectionist/sort-named-imports`
|
|
1788
|
-
"sort-imports": "off",
|
|
1789
|
-
// standard v17.0.0
|
|
1790
|
-
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
1791
|
-
camelcase: [
|
|
1792
|
-
"error",
|
|
1793
|
-
{
|
|
1794
|
-
allow: ["^UNSAFE_"],
|
|
1795
|
-
properties: "never",
|
|
1796
|
-
ignoreGlobals: true
|
|
1797
|
-
}
|
|
1798
|
-
],
|
|
1799
|
-
"constructor-super": "error",
|
|
1800
|
-
curly: ["error", "multi-line"],
|
|
1801
|
-
"default-case-last": "error",
|
|
1802
|
-
"dot-notation": ["error", { allowKeywords: true }],
|
|
1803
|
-
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
|
1804
|
-
"no-array-constructor": "error",
|
|
1805
|
-
"no-async-promise-executor": "error",
|
|
1806
|
-
"no-caller": "error",
|
|
1807
|
-
"no-class-assign": "error",
|
|
1808
|
-
"no-compare-neg-zero": "error",
|
|
1809
|
-
"no-cond-assign": "error",
|
|
1810
|
-
"no-const-assign": "error",
|
|
1811
|
-
"no-constant-condition": ["error", { checkLoops: false }],
|
|
1812
|
-
"no-control-regex": "error",
|
|
1813
|
-
"no-debugger": "error",
|
|
1814
|
-
"no-delete-var": "error",
|
|
1815
|
-
"no-dupe-args": "error",
|
|
1816
|
-
"no-dupe-class-members": "error",
|
|
1817
|
-
"no-dupe-keys": "error",
|
|
1818
|
-
"no-duplicate-case": "error",
|
|
1819
|
-
"no-useless-backreference": "error",
|
|
1820
|
-
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
1821
|
-
"no-empty-character-class": "error",
|
|
1822
|
-
"no-empty-pattern": "error",
|
|
1823
|
-
"no-eval": "error",
|
|
1824
|
-
"no-ex-assign": "error",
|
|
1825
|
-
"no-extend-native": "error",
|
|
1826
|
-
"no-extra-bind": "error",
|
|
1827
|
-
"no-extra-boolean-cast": "error",
|
|
1828
|
-
"no-fallthrough": "error",
|
|
1829
|
-
"no-func-assign": "error",
|
|
1830
|
-
"no-global-assign": "error",
|
|
1831
|
-
"no-implied-eval": "error",
|
|
1832
|
-
"no-import-assign": "error",
|
|
1833
|
-
"no-invalid-regexp": "error",
|
|
1834
|
-
"no-irregular-whitespace": "error",
|
|
1835
|
-
"no-iterator": "error",
|
|
1836
|
-
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
1837
|
-
"no-lone-blocks": "error",
|
|
1838
|
-
"no-loss-of-precision": "error",
|
|
1839
|
-
"no-misleading-character-class": "error",
|
|
1840
|
-
"no-prototype-builtins": "error",
|
|
1841
|
-
"no-useless-catch": "error",
|
|
1842
|
-
"no-new": "error",
|
|
1843
|
-
"no-new-func": "error",
|
|
1844
|
-
"no-new-wrappers": "error",
|
|
1845
|
-
"no-obj-calls": "error",
|
|
1846
|
-
"no-octal": "error",
|
|
1847
|
-
"no-octal-escape": "error",
|
|
1848
|
-
"no-proto": "error",
|
|
1849
|
-
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
1850
|
-
"no-regex-spaces": "error",
|
|
1851
|
-
"no-self-assign": ["error", { props: true }],
|
|
1852
|
-
"no-self-compare": "error",
|
|
1853
|
-
"no-sequences": "error",
|
|
1854
|
-
"no-shadow-restricted-names": "error",
|
|
1855
|
-
"no-sparse-arrays": "error",
|
|
1856
|
-
"no-template-curly-in-string": "error",
|
|
1857
|
-
"no-this-before-super": "error",
|
|
1858
|
-
"no-throw-literal": "error",
|
|
1859
|
-
"no-undef": "error",
|
|
1860
|
-
"no-undef-init": "error",
|
|
1861
|
-
"no-unexpected-multiline": "error",
|
|
1862
|
-
"no-unmodified-loop-condition": "error",
|
|
1863
|
-
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
1864
|
-
"no-unreachable": "error",
|
|
1865
|
-
"no-unreachable-loop": "error",
|
|
1866
|
-
"no-unsafe-finally": "error",
|
|
1867
|
-
"no-unsafe-negation": "error",
|
|
1868
|
-
"no-unused-expressions": [
|
|
1869
|
-
"error",
|
|
1870
|
-
{
|
|
1871
|
-
allowShortCircuit: true,
|
|
1872
|
-
allowTernary: true,
|
|
1873
|
-
allowTaggedTemplates: true
|
|
1874
|
-
}
|
|
1875
|
-
],
|
|
1876
|
-
"no-unused-vars": [
|
|
1877
|
-
"error",
|
|
1878
|
-
{
|
|
1879
|
-
args: "none",
|
|
1880
|
-
caughtErrors: "none",
|
|
1881
|
-
ignoreRestSiblings: true,
|
|
1882
|
-
vars: "all"
|
|
1883
|
-
}
|
|
1884
|
-
],
|
|
1885
|
-
"no-useless-call": "error",
|
|
1886
|
-
"no-useless-computed-key": "error",
|
|
1887
|
-
"no-useless-constructor": "error",
|
|
1888
|
-
"no-useless-rename": "error",
|
|
1889
|
-
"no-useless-return": "error",
|
|
1890
|
-
"prefer-promise-reject-errors": "error",
|
|
1891
|
-
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
1892
|
-
"symbol-description": "error",
|
|
1893
|
-
"unicode-bom": ["error", "never"],
|
|
1894
|
-
"use-isnan": [
|
|
1895
|
-
"error",
|
|
1896
|
-
{
|
|
1897
|
-
enforceForSwitchCase: true,
|
|
1898
|
-
enforceForIndexOf: true
|
|
1899
|
-
}
|
|
1900
|
-
],
|
|
1901
|
-
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
1902
|
-
yoda: ["error", "never"],
|
|
1903
|
-
// es6+
|
|
1904
|
-
"no-var": "error",
|
|
1905
|
-
"prefer-rest-params": "error",
|
|
1906
|
-
"prefer-spread": "error",
|
|
1907
|
-
"prefer-template": "error",
|
|
1908
|
-
"no-empty-static-block": "error",
|
|
1909
|
-
"no-new-native-nonconstructor": "error",
|
|
1910
|
-
"prefer-const": [
|
|
1911
|
-
"error",
|
|
1912
|
-
{
|
|
1913
|
-
destructuring: "all",
|
|
1914
|
-
ignoreReadBeforeAssign: true
|
|
1915
|
-
}
|
|
1916
|
-
],
|
|
1917
|
-
"prefer-arrow-callback": [
|
|
1918
|
-
"error",
|
|
1919
|
-
{
|
|
1920
|
-
allowNamedFunctions: false,
|
|
1921
|
-
allowUnboundThis: true
|
|
1922
|
-
}
|
|
1923
|
-
],
|
|
1924
|
-
"object-shorthand": [
|
|
1925
|
-
"error",
|
|
1926
|
-
"always",
|
|
1927
|
-
{
|
|
1928
|
-
ignoreConstructors: false,
|
|
1929
|
-
avoidQuotes: true
|
|
1930
|
-
}
|
|
1931
|
-
],
|
|
1932
|
-
// best-practice
|
|
1933
|
-
eqeqeq: ["error", "smart"],
|
|
1934
|
-
"array-callback-return": "error",
|
|
1935
|
-
"block-scoped-var": "error",
|
|
1936
|
-
"no-alert": "error",
|
|
1937
|
-
"no-case-declarations": "error",
|
|
1938
|
-
"no-multi-str": "error",
|
|
1939
|
-
"no-with": "error",
|
|
1940
|
-
"no-void": "error",
|
|
1941
|
-
"vars-on-top": "error",
|
|
1942
|
-
"one-var": ["error", "never"],
|
|
1943
|
-
"no-use-before-define": [
|
|
1944
|
-
"error",
|
|
1945
|
-
{
|
|
1946
|
-
functions: false,
|
|
1947
|
-
classes: false,
|
|
1948
|
-
variables: true,
|
|
1949
|
-
allowNamedExports: false
|
|
1950
|
-
}
|
|
1951
|
-
],
|
|
1952
|
-
// Strict rules
|
|
1953
|
-
...options.strict ? strictRules : {},
|
|
1954
|
-
// Overrides rules
|
|
1955
|
-
...options.overrides
|
|
1956
|
-
}
|
|
1831
|
+
max: 200,
|
|
1832
|
+
skipComments: true,
|
|
1833
|
+
skipBlankLines: true
|
|
1957
1834
|
}
|
|
1958
|
-
]
|
|
1835
|
+
]
|
|
1959
1836
|
};
|
|
1837
|
+
var javascript = (options = {}) => [
|
|
1838
|
+
{
|
|
1839
|
+
...import_js.default.configs.recommended,
|
|
1840
|
+
name: "ntnyq/js/recommended"
|
|
1841
|
+
},
|
|
1842
|
+
{
|
|
1843
|
+
name: "ntnyq/js/core",
|
|
1844
|
+
languageOptions: {
|
|
1845
|
+
globals: {
|
|
1846
|
+
...import_globals2.default.browser,
|
|
1847
|
+
...import_globals2.default.es2021,
|
|
1848
|
+
...import_globals2.default.node
|
|
1849
|
+
},
|
|
1850
|
+
sourceType: "module"
|
|
1851
|
+
},
|
|
1852
|
+
rules: {
|
|
1853
|
+
"require-await": "off",
|
|
1854
|
+
"no-return-assign": "off",
|
|
1855
|
+
"no-useless-escape": "off",
|
|
1856
|
+
"consistent-return": "off",
|
|
1857
|
+
// disabled in favor of `perfectionist/sort-named-imports`
|
|
1858
|
+
"sort-imports": "off",
|
|
1859
|
+
// standard v17.0.0
|
|
1860
|
+
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
1861
|
+
camelcase: [
|
|
1862
|
+
"error",
|
|
1863
|
+
{
|
|
1864
|
+
allow: ["^UNSAFE_"],
|
|
1865
|
+
properties: "never",
|
|
1866
|
+
ignoreGlobals: true
|
|
1867
|
+
}
|
|
1868
|
+
],
|
|
1869
|
+
"constructor-super": "error",
|
|
1870
|
+
curly: ["error", "multi-line"],
|
|
1871
|
+
"default-case-last": "error",
|
|
1872
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
1873
|
+
"new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
|
|
1874
|
+
"no-array-constructor": "error",
|
|
1875
|
+
"no-async-promise-executor": "error",
|
|
1876
|
+
"no-caller": "error",
|
|
1877
|
+
"no-class-assign": "error",
|
|
1878
|
+
"no-compare-neg-zero": "error",
|
|
1879
|
+
"no-cond-assign": "error",
|
|
1880
|
+
"no-const-assign": "error",
|
|
1881
|
+
"no-constant-condition": ["error", { checkLoops: false }],
|
|
1882
|
+
"no-control-regex": "error",
|
|
1883
|
+
"no-debugger": "error",
|
|
1884
|
+
"no-delete-var": "error",
|
|
1885
|
+
"no-dupe-args": "error",
|
|
1886
|
+
"no-dupe-class-members": "error",
|
|
1887
|
+
"no-dupe-keys": "error",
|
|
1888
|
+
"no-duplicate-case": "error",
|
|
1889
|
+
"no-useless-backreference": "error",
|
|
1890
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
1891
|
+
"no-empty-character-class": "error",
|
|
1892
|
+
"no-empty-pattern": "error",
|
|
1893
|
+
"no-eval": "error",
|
|
1894
|
+
"no-ex-assign": "error",
|
|
1895
|
+
"no-extend-native": "error",
|
|
1896
|
+
"no-extra-bind": "error",
|
|
1897
|
+
"no-extra-boolean-cast": "error",
|
|
1898
|
+
"no-fallthrough": "error",
|
|
1899
|
+
"no-func-assign": "error",
|
|
1900
|
+
"no-global-assign": "error",
|
|
1901
|
+
"no-implied-eval": "error",
|
|
1902
|
+
"no-import-assign": "error",
|
|
1903
|
+
"no-invalid-regexp": "error",
|
|
1904
|
+
"no-irregular-whitespace": "error",
|
|
1905
|
+
"no-iterator": "error",
|
|
1906
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
1907
|
+
"no-lone-blocks": "error",
|
|
1908
|
+
"no-loss-of-precision": "error",
|
|
1909
|
+
"no-misleading-character-class": "error",
|
|
1910
|
+
"no-prototype-builtins": "error",
|
|
1911
|
+
"no-useless-catch": "error",
|
|
1912
|
+
"no-new": "error",
|
|
1913
|
+
"no-new-func": "error",
|
|
1914
|
+
"no-new-wrappers": "error",
|
|
1915
|
+
"no-obj-calls": "error",
|
|
1916
|
+
"no-octal": "error",
|
|
1917
|
+
"no-octal-escape": "error",
|
|
1918
|
+
"no-proto": "error",
|
|
1919
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
1920
|
+
"no-regex-spaces": "error",
|
|
1921
|
+
"no-self-assign": ["error", { props: true }],
|
|
1922
|
+
"no-self-compare": "error",
|
|
1923
|
+
"no-sequences": "error",
|
|
1924
|
+
"no-shadow-restricted-names": "error",
|
|
1925
|
+
"no-sparse-arrays": "error",
|
|
1926
|
+
"no-template-curly-in-string": "error",
|
|
1927
|
+
"no-this-before-super": "error",
|
|
1928
|
+
"no-throw-literal": "error",
|
|
1929
|
+
"no-undef": "error",
|
|
1930
|
+
"no-undef-init": "error",
|
|
1931
|
+
"no-unexpected-multiline": "error",
|
|
1932
|
+
"no-unmodified-loop-condition": "error",
|
|
1933
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
1934
|
+
"no-unreachable": "error",
|
|
1935
|
+
"no-unreachable-loop": "error",
|
|
1936
|
+
"no-unsafe-finally": "error",
|
|
1937
|
+
"no-unsafe-negation": "error",
|
|
1938
|
+
"no-unused-expressions": [
|
|
1939
|
+
"error",
|
|
1940
|
+
{
|
|
1941
|
+
allowShortCircuit: true,
|
|
1942
|
+
allowTernary: true,
|
|
1943
|
+
allowTaggedTemplates: true
|
|
1944
|
+
}
|
|
1945
|
+
],
|
|
1946
|
+
"no-unused-vars": [
|
|
1947
|
+
"error",
|
|
1948
|
+
{
|
|
1949
|
+
args: "none",
|
|
1950
|
+
caughtErrors: "none",
|
|
1951
|
+
ignoreRestSiblings: true,
|
|
1952
|
+
vars: "all"
|
|
1953
|
+
}
|
|
1954
|
+
],
|
|
1955
|
+
"no-useless-call": "error",
|
|
1956
|
+
"no-useless-computed-key": "error",
|
|
1957
|
+
"no-useless-constructor": "error",
|
|
1958
|
+
"no-useless-rename": "error",
|
|
1959
|
+
"no-useless-return": "error",
|
|
1960
|
+
"prefer-promise-reject-errors": "error",
|
|
1961
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
1962
|
+
"symbol-description": "error",
|
|
1963
|
+
"unicode-bom": ["error", "never"],
|
|
1964
|
+
"use-isnan": [
|
|
1965
|
+
"error",
|
|
1966
|
+
{
|
|
1967
|
+
enforceForSwitchCase: true,
|
|
1968
|
+
enforceForIndexOf: true
|
|
1969
|
+
}
|
|
1970
|
+
],
|
|
1971
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
1972
|
+
yoda: ["error", "never"],
|
|
1973
|
+
// es6+
|
|
1974
|
+
"no-var": "error",
|
|
1975
|
+
"prefer-rest-params": "error",
|
|
1976
|
+
"prefer-spread": "error",
|
|
1977
|
+
"prefer-template": "error",
|
|
1978
|
+
"no-empty-static-block": "error",
|
|
1979
|
+
"no-new-native-nonconstructor": "error",
|
|
1980
|
+
"prefer-const": [
|
|
1981
|
+
"error",
|
|
1982
|
+
{
|
|
1983
|
+
destructuring: "all",
|
|
1984
|
+
ignoreReadBeforeAssign: true
|
|
1985
|
+
}
|
|
1986
|
+
],
|
|
1987
|
+
"prefer-arrow-callback": [
|
|
1988
|
+
"error",
|
|
1989
|
+
{
|
|
1990
|
+
allowNamedFunctions: false,
|
|
1991
|
+
allowUnboundThis: true
|
|
1992
|
+
}
|
|
1993
|
+
],
|
|
1994
|
+
"object-shorthand": [
|
|
1995
|
+
"error",
|
|
1996
|
+
"always",
|
|
1997
|
+
{
|
|
1998
|
+
ignoreConstructors: false,
|
|
1999
|
+
avoidQuotes: true
|
|
2000
|
+
}
|
|
2001
|
+
],
|
|
2002
|
+
// best-practice
|
|
2003
|
+
eqeqeq: ["error", "smart"],
|
|
2004
|
+
"array-callback-return": "error",
|
|
2005
|
+
"block-scoped-var": "error",
|
|
2006
|
+
"no-alert": "error",
|
|
2007
|
+
"no-case-declarations": "error",
|
|
2008
|
+
"no-multi-str": "error",
|
|
2009
|
+
"no-with": "error",
|
|
2010
|
+
"no-void": "error",
|
|
2011
|
+
"vars-on-top": "error",
|
|
2012
|
+
"one-var": ["error", "never"],
|
|
2013
|
+
"no-use-before-define": [
|
|
2014
|
+
"error",
|
|
2015
|
+
{
|
|
2016
|
+
functions: false,
|
|
2017
|
+
classes: false,
|
|
2018
|
+
variables: true,
|
|
2019
|
+
allowNamedExports: false
|
|
2020
|
+
}
|
|
2021
|
+
],
|
|
2022
|
+
// Strict rules
|
|
2023
|
+
...options.strict ? strictRules : {},
|
|
2024
|
+
// Overrides rules
|
|
2025
|
+
...options.overrides
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
];
|
|
1960
2029
|
var jsx = () => [
|
|
1961
2030
|
{
|
|
1962
2031
|
name: "ntnyq/jsx",
|
|
@@ -2010,30 +2079,38 @@ var recommendedRules = import_typescript_eslint3.configs.recommended.reduce((rul
|
|
|
2010
2079
|
var typescript = (options = {}) => {
|
|
2011
2080
|
const enableTypeAwareLint = !!options?.tsconfigPath;
|
|
2012
2081
|
const {
|
|
2082
|
+
extensions = [],
|
|
2013
2083
|
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
2014
2084
|
ignoresTypeAware = [GLOB_ASTRO, `${GLOB_MARKDOWN}/**`],
|
|
2015
2085
|
overridesTypeAwareRules = {},
|
|
2016
2086
|
parserOptions = {}
|
|
2017
2087
|
} = options;
|
|
2018
|
-
|
|
2088
|
+
const files = options.files ?? [
|
|
2089
|
+
GLOB_TS,
|
|
2090
|
+
GLOB_TSX,
|
|
2091
|
+
// Enable typescript in these exts
|
|
2092
|
+
...extensions.map((ext) => `**/*.${ext}`)
|
|
2093
|
+
];
|
|
2094
|
+
function createParserConfig(enableTypeAware = false, files2 = [], ignores2 = []) {
|
|
2095
|
+
const typescriptParserOptions = {
|
|
2096
|
+
extraFileExtensions: extensions.map((ext) => `.${ext}`),
|
|
2097
|
+
sourceType: "module",
|
|
2098
|
+
...enableTypeAware ? {
|
|
2099
|
+
projectService: {
|
|
2100
|
+
allowDefaultProject: ["./*.js"],
|
|
2101
|
+
defaultProject: options.tsconfigPath
|
|
2102
|
+
},
|
|
2103
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
2104
|
+
} : {},
|
|
2105
|
+
...parserOptions
|
|
2106
|
+
};
|
|
2019
2107
|
const parserConfig = {
|
|
2020
2108
|
name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
|
|
2021
|
-
files,
|
|
2109
|
+
files: files2,
|
|
2022
2110
|
ignores: [...ignores2],
|
|
2023
2111
|
languageOptions: {
|
|
2024
2112
|
parser: parserTypeScript,
|
|
2025
|
-
parserOptions:
|
|
2026
|
-
// extraFileExtensions: [''],
|
|
2027
|
-
sourceType: "module",
|
|
2028
|
-
...enableTypeAware ? {
|
|
2029
|
-
projectService: {
|
|
2030
|
-
allowDefaultProject: ["./*.js"],
|
|
2031
|
-
defaultProject: options.tsconfigPath
|
|
2032
|
-
},
|
|
2033
|
-
tsconfigRootDir: import_node_process2.default.cwd()
|
|
2034
|
-
} : {},
|
|
2035
|
-
...parserOptions
|
|
2036
|
-
}
|
|
2113
|
+
parserOptions: typescriptParserOptions
|
|
2037
2114
|
}
|
|
2038
2115
|
};
|
|
2039
2116
|
return parserConfig;
|
|
@@ -2047,12 +2124,12 @@ var typescript = (options = {}) => {
|
|
|
2047
2124
|
}
|
|
2048
2125
|
},
|
|
2049
2126
|
...enableTypeAwareLint ? [
|
|
2050
|
-
createParserConfig(false,
|
|
2127
|
+
createParserConfig(false, files),
|
|
2051
2128
|
createParserConfig(true, filesTypeAware, ignoresTypeAware)
|
|
2052
|
-
] : [createParserConfig(false,
|
|
2129
|
+
] : [createParserConfig(false, files)],
|
|
2053
2130
|
{
|
|
2054
2131
|
name: "ntnyq/ts/rules",
|
|
2055
|
-
files
|
|
2132
|
+
files,
|
|
2056
2133
|
rules: {
|
|
2057
2134
|
...recommendedRules,
|
|
2058
2135
|
// Disabled in favor of ts rules
|
|
@@ -2297,7 +2374,18 @@ var unusedImports = (options = {}) => [
|
|
|
2297
2374
|
// src/core.ts
|
|
2298
2375
|
async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
2299
2376
|
const configs2 = [];
|
|
2300
|
-
|
|
2377
|
+
const {
|
|
2378
|
+
markdown: enableMarkdown = true,
|
|
2379
|
+
gitignore: enableGitIgnore = true,
|
|
2380
|
+
vue: enableVue = hasVue,
|
|
2381
|
+
unocss: enableUnoCSS = hasUnoCSS,
|
|
2382
|
+
typescript: enableTypeScript = hasTypeScript,
|
|
2383
|
+
extensions: supportedExtensions = []
|
|
2384
|
+
} = options;
|
|
2385
|
+
if (enableVue) {
|
|
2386
|
+
supportedExtensions.push("vue");
|
|
2387
|
+
}
|
|
2388
|
+
if (enableGitIgnore) {
|
|
2301
2389
|
configs2.push(
|
|
2302
2390
|
...gitignore({
|
|
2303
2391
|
...resolveSubOptions(options, "gitignore")
|
|
@@ -2350,14 +2438,24 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2350
2438
|
})
|
|
2351
2439
|
);
|
|
2352
2440
|
}
|
|
2353
|
-
if (
|
|
2441
|
+
if (enableTypeScript) {
|
|
2354
2442
|
configs2.push(
|
|
2355
2443
|
...typescript({
|
|
2356
2444
|
...resolveSubOptions(options, "typescript"),
|
|
2445
|
+
extensions: supportedExtensions,
|
|
2357
2446
|
overrides: getOverrides(options, "typescript")
|
|
2358
2447
|
})
|
|
2359
2448
|
);
|
|
2360
2449
|
}
|
|
2450
|
+
if (enableVue) {
|
|
2451
|
+
configs2.push(
|
|
2452
|
+
...vue({
|
|
2453
|
+
...resolveSubOptions(options, "vue"),
|
|
2454
|
+
typescript: !!enableTypeScript,
|
|
2455
|
+
overrides: getOverrides(options, "vue")
|
|
2456
|
+
})
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2361
2459
|
if (options.yml ?? true) {
|
|
2362
2460
|
configs2.push(
|
|
2363
2461
|
...yml({
|
|
@@ -2386,14 +2484,6 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2386
2484
|
})
|
|
2387
2485
|
);
|
|
2388
2486
|
}
|
|
2389
|
-
if (options.vue ?? hasVue) {
|
|
2390
|
-
configs2.push(
|
|
2391
|
-
...vue({
|
|
2392
|
-
...resolveSubOptions(options, "vue"),
|
|
2393
|
-
overrides: getOverrides(options, "vue")
|
|
2394
|
-
})
|
|
2395
|
-
);
|
|
2396
|
-
}
|
|
2397
2487
|
if (options.test ?? hasVitest) {
|
|
2398
2488
|
configs2.push(
|
|
2399
2489
|
...test({
|
|
@@ -2404,16 +2494,17 @@ async function defineESLintConfig(options = {}, ...userConfigs) {
|
|
|
2404
2494
|
})
|
|
2405
2495
|
);
|
|
2406
2496
|
}
|
|
2407
|
-
if (
|
|
2497
|
+
if (enableUnoCSS) {
|
|
2408
2498
|
configs2.push(
|
|
2409
2499
|
...unocss({
|
|
2410
2500
|
overrides: getOverrides(options, "unocss")
|
|
2411
2501
|
})
|
|
2412
2502
|
);
|
|
2413
2503
|
}
|
|
2414
|
-
if (
|
|
2504
|
+
if (enableMarkdown) {
|
|
2415
2505
|
configs2.push(
|
|
2416
2506
|
...markdown({
|
|
2507
|
+
extensions: supportedExtensions,
|
|
2417
2508
|
overrides: getOverrides(options, "markdown")
|
|
2418
2509
|
})
|
|
2419
2510
|
);
|