@ntnyq/eslint-config 3.4.0 → 3.5.0

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
@@ -9,10 +9,11 @@
9
9
 
10
10
  ## Features
11
11
 
12
- - Opinionable: single quotes, no semi
12
+ - Opinionable: single quotes, no semi, trailing comma, etc.
13
13
  - Designed to work alongside with [Prettier](https://prettier.io)
14
14
  - Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
15
- - Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, etc.
15
+ - Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML etc.
16
+ - Strict but provides useful rules to guard your codebase
16
17
  - [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.5.0+
17
18
 
18
19
  ## Install
package/dist/index.cjs CHANGED
@@ -879,6 +879,16 @@ var sort = (options = {}) => {
879
879
  "activationEvents",
880
880
  "contributes",
881
881
  "categories",
882
+ "galleryBanner",
883
+ "badges",
884
+ "markdown",
885
+ "qna",
886
+ "sponsor",
887
+ "extensionPack",
888
+ "extensionDependencies",
889
+ "extensionKind",
890
+ "pricing",
891
+ "capabilities",
882
892
  /**
883
893
  * Package manager
884
894
  */
@@ -908,6 +918,20 @@ var sort = (options = {}) => {
908
918
  pathPattern: "^exports.*$",
909
919
  order: ["types", "import", "require", "default"]
910
920
  },
921
+ // VSCode extension
922
+ {
923
+ order: { type: "asc" },
924
+ pathPattern: "^contributes.*$"
925
+ },
926
+ /**
927
+ * pnpm publish config
928
+ * @see {@link https://pnpm.io/package_json#publishconfig}
929
+ */
930
+ {
931
+ order: { type: "asc" },
932
+ pathPattern: "^publishConfig.*$"
933
+ },
934
+ // npm scripts
911
935
  {
912
936
  pathPattern: "^scripts$",
913
937
  order: { type: "asc" }
@@ -934,6 +958,18 @@ var sort = (options = {}) => {
934
958
  {
935
959
  pathPattern: "^files$",
936
960
  order: { type: "asc" }
961
+ },
962
+ {
963
+ pathPattern: "^keywords$",
964
+ order: { type: "asc" }
965
+ },
966
+ {
967
+ pathPattern: "^activationEvents$",
968
+ order: { type: "asc" }
969
+ },
970
+ {
971
+ pathPattern: "^contributes.*$",
972
+ order: { type: "asc" }
937
973
  }
938
974
  ]
939
975
  }
@@ -1198,8 +1234,7 @@ var unocss = (options = {}) => [
1198
1234
  },
1199
1235
  rules: {
1200
1236
  "unocss/order": "error",
1201
- // We don't use this
1202
- "unocss/order-attributify": "off",
1237
+ "unocss/order-attributify": options.attributify ? "error" : "off",
1203
1238
  // Overrides rules
1204
1239
  ...options.overrides
1205
1240
  }
@@ -1741,222 +1776,220 @@ var gitignore = (options = {}) => {
1741
1776
  // src/configs/javascript.ts
1742
1777
  var import_js = __toESM(require("@eslint/js"), 1);
1743
1778
  var import_globals2 = __toESM(require("globals"), 1);
1744
- var javascript = (options = {}) => {
1745
- const strictRules = {
1746
- complexity: ["error", { max: 30 }],
1747
- "max-params": ["error", { max: 5 }],
1748
- "max-depth": ["error", { max: 5 }],
1749
- "max-nested-callbacks": ["error", { max: 10 }],
1750
- "max-lines": [
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 [
1779
+ var strictRules = {
1780
+ complexity: ["error", { max: 30 }],
1781
+ "max-params": ["error", { max: 5 }],
1782
+ "max-depth": ["error", { max: 5 }],
1783
+ "max-nested-callbacks": ["error", { max: 10 }],
1784
+ "max-lines": [
1785
+ "error",
1768
1786
  {
1769
- ...import_js.default.configs.recommended,
1770
- name: "ntnyq/js/recommended"
1771
- },
1787
+ max: 1e3,
1788
+ skipComments: true,
1789
+ skipBlankLines: true
1790
+ }
1791
+ ],
1792
+ "max-lines-per-function": [
1793
+ "error",
1772
1794
  {
1773
- name: "ntnyq/js/core",
1774
- languageOptions: {
1775
- globals: {
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
- }
1795
+ max: 200,
1796
+ skipComments: true,
1797
+ skipBlankLines: true
1957
1798
  }
1958
- ];
1799
+ ]
1959
1800
  };
1801
+ var javascript = (options = {}) => [
1802
+ {
1803
+ ...import_js.default.configs.recommended,
1804
+ name: "ntnyq/js/recommended"
1805
+ },
1806
+ {
1807
+ name: "ntnyq/js/core",
1808
+ languageOptions: {
1809
+ globals: {
1810
+ ...import_globals2.default.browser,
1811
+ ...import_globals2.default.es2021,
1812
+ ...import_globals2.default.node
1813
+ },
1814
+ sourceType: "module"
1815
+ },
1816
+ rules: {
1817
+ "require-await": "off",
1818
+ "no-return-assign": "off",
1819
+ "no-useless-escape": "off",
1820
+ "consistent-return": "off",
1821
+ // disabled in favor of `perfectionist/sort-named-imports`
1822
+ "sort-imports": "off",
1823
+ // standard v17.0.0
1824
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
1825
+ camelcase: [
1826
+ "error",
1827
+ {
1828
+ allow: ["^UNSAFE_"],
1829
+ properties: "never",
1830
+ ignoreGlobals: true
1831
+ }
1832
+ ],
1833
+ "constructor-super": "error",
1834
+ curly: ["error", "multi-line"],
1835
+ "default-case-last": "error",
1836
+ "dot-notation": ["error", { allowKeywords: true }],
1837
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
1838
+ "no-array-constructor": "error",
1839
+ "no-async-promise-executor": "error",
1840
+ "no-caller": "error",
1841
+ "no-class-assign": "error",
1842
+ "no-compare-neg-zero": "error",
1843
+ "no-cond-assign": "error",
1844
+ "no-const-assign": "error",
1845
+ "no-constant-condition": ["error", { checkLoops: false }],
1846
+ "no-control-regex": "error",
1847
+ "no-debugger": "error",
1848
+ "no-delete-var": "error",
1849
+ "no-dupe-args": "error",
1850
+ "no-dupe-class-members": "error",
1851
+ "no-dupe-keys": "error",
1852
+ "no-duplicate-case": "error",
1853
+ "no-useless-backreference": "error",
1854
+ "no-empty": ["error", { allowEmptyCatch: true }],
1855
+ "no-empty-character-class": "error",
1856
+ "no-empty-pattern": "error",
1857
+ "no-eval": "error",
1858
+ "no-ex-assign": "error",
1859
+ "no-extend-native": "error",
1860
+ "no-extra-bind": "error",
1861
+ "no-extra-boolean-cast": "error",
1862
+ "no-fallthrough": "error",
1863
+ "no-func-assign": "error",
1864
+ "no-global-assign": "error",
1865
+ "no-implied-eval": "error",
1866
+ "no-import-assign": "error",
1867
+ "no-invalid-regexp": "error",
1868
+ "no-irregular-whitespace": "error",
1869
+ "no-iterator": "error",
1870
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
1871
+ "no-lone-blocks": "error",
1872
+ "no-loss-of-precision": "error",
1873
+ "no-misleading-character-class": "error",
1874
+ "no-prototype-builtins": "error",
1875
+ "no-useless-catch": "error",
1876
+ "no-new": "error",
1877
+ "no-new-func": "error",
1878
+ "no-new-wrappers": "error",
1879
+ "no-obj-calls": "error",
1880
+ "no-octal": "error",
1881
+ "no-octal-escape": "error",
1882
+ "no-proto": "error",
1883
+ "no-redeclare": ["error", { builtinGlobals: false }],
1884
+ "no-regex-spaces": "error",
1885
+ "no-self-assign": ["error", { props: true }],
1886
+ "no-self-compare": "error",
1887
+ "no-sequences": "error",
1888
+ "no-shadow-restricted-names": "error",
1889
+ "no-sparse-arrays": "error",
1890
+ "no-template-curly-in-string": "error",
1891
+ "no-this-before-super": "error",
1892
+ "no-throw-literal": "error",
1893
+ "no-undef": "error",
1894
+ "no-undef-init": "error",
1895
+ "no-unexpected-multiline": "error",
1896
+ "no-unmodified-loop-condition": "error",
1897
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1898
+ "no-unreachable": "error",
1899
+ "no-unreachable-loop": "error",
1900
+ "no-unsafe-finally": "error",
1901
+ "no-unsafe-negation": "error",
1902
+ "no-unused-expressions": [
1903
+ "error",
1904
+ {
1905
+ allowShortCircuit: true,
1906
+ allowTernary: true,
1907
+ allowTaggedTemplates: true
1908
+ }
1909
+ ],
1910
+ "no-unused-vars": [
1911
+ "error",
1912
+ {
1913
+ args: "none",
1914
+ caughtErrors: "none",
1915
+ ignoreRestSiblings: true,
1916
+ vars: "all"
1917
+ }
1918
+ ],
1919
+ "no-useless-call": "error",
1920
+ "no-useless-computed-key": "error",
1921
+ "no-useless-constructor": "error",
1922
+ "no-useless-rename": "error",
1923
+ "no-useless-return": "error",
1924
+ "prefer-promise-reject-errors": "error",
1925
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1926
+ "symbol-description": "error",
1927
+ "unicode-bom": ["error", "never"],
1928
+ "use-isnan": [
1929
+ "error",
1930
+ {
1931
+ enforceForSwitchCase: true,
1932
+ enforceForIndexOf: true
1933
+ }
1934
+ ],
1935
+ "valid-typeof": ["error", { requireStringLiterals: true }],
1936
+ yoda: ["error", "never"],
1937
+ // es6+
1938
+ "no-var": "error",
1939
+ "prefer-rest-params": "error",
1940
+ "prefer-spread": "error",
1941
+ "prefer-template": "error",
1942
+ "no-empty-static-block": "error",
1943
+ "no-new-native-nonconstructor": "error",
1944
+ "prefer-const": [
1945
+ "error",
1946
+ {
1947
+ destructuring: "all",
1948
+ ignoreReadBeforeAssign: true
1949
+ }
1950
+ ],
1951
+ "prefer-arrow-callback": [
1952
+ "error",
1953
+ {
1954
+ allowNamedFunctions: false,
1955
+ allowUnboundThis: true
1956
+ }
1957
+ ],
1958
+ "object-shorthand": [
1959
+ "error",
1960
+ "always",
1961
+ {
1962
+ ignoreConstructors: false,
1963
+ avoidQuotes: true
1964
+ }
1965
+ ],
1966
+ // best-practice
1967
+ eqeqeq: ["error", "smart"],
1968
+ "array-callback-return": "error",
1969
+ "block-scoped-var": "error",
1970
+ "no-alert": "error",
1971
+ "no-case-declarations": "error",
1972
+ "no-multi-str": "error",
1973
+ "no-with": "error",
1974
+ "no-void": "error",
1975
+ "vars-on-top": "error",
1976
+ "one-var": ["error", "never"],
1977
+ "no-use-before-define": [
1978
+ "error",
1979
+ {
1980
+ functions: false,
1981
+ classes: false,
1982
+ variables: true,
1983
+ allowNamedExports: false
1984
+ }
1985
+ ],
1986
+ // Strict rules
1987
+ ...options.strict ? strictRules : {},
1988
+ // Overrides rules
1989
+ ...options.overrides
1990
+ }
1991
+ }
1992
+ ];
1960
1993
  var jsx = () => [
1961
1994
  {
1962
1995
  name: "ntnyq/jsx",
@@ -2016,24 +2049,25 @@ var typescript = (options = {}) => {
2016
2049
  parserOptions = {}
2017
2050
  } = options;
2018
2051
  function createParserConfig(enableTypeAware = false, files = [], ignores2 = []) {
2052
+ const typescriptParserOptions = {
2053
+ // extraFileExtensions: [''],
2054
+ sourceType: "module",
2055
+ ...enableTypeAware ? {
2056
+ projectService: {
2057
+ allowDefaultProject: ["./*.js"],
2058
+ defaultProject: options.tsconfigPath
2059
+ },
2060
+ tsconfigRootDir: import_node_process2.default.cwd()
2061
+ } : {},
2062
+ ...parserOptions
2063
+ };
2019
2064
  const parserConfig = {
2020
2065
  name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
2021
2066
  files,
2022
2067
  ignores: [...ignores2],
2023
2068
  languageOptions: {
2024
2069
  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
- }
2070
+ parserOptions: typescriptParserOptions
2037
2071
  }
2038
2072
  };
2039
2073
  return parserConfig;
package/dist/index.d.cts CHANGED
@@ -4,8 +4,9 @@ import { ESLintPluginCommandOptions } from 'eslint-plugin-command/types';
4
4
  import { Options } from 'eslint-processor-vue-blocks';
5
5
  export { default as processorVueBlocks } from 'eslint-processor-vue-blocks';
6
6
  import { Linter } from 'eslint';
7
+ import { ConfigWithExtends } from 'typescript-eslint';
8
+ export { plugin as pluginTypeScript, configs as typescriptConfigs } from 'typescript-eslint';
7
9
  import { RequiredOptions, BuiltInParserName } from 'prettier';
8
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
9
10
  import * as eslintPluginRegexp from 'eslint-plugin-regexp';
10
11
  export { eslintPluginRegexp as pluginRegexp };
11
12
  export { default as pluginNode } from 'eslint-plugin-n';
@@ -17,7 +18,6 @@ export { default as pluginMarkdown } from '@eslint/markdown';
17
18
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
18
19
  export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
19
20
  export { default as pluginJsonc } from 'eslint-plugin-jsonc';
20
- export { plugin as pluginTypeScript, configs as typescriptConfigs } from 'typescript-eslint';
21
21
  export { default as pluginFormat } from 'eslint-plugin-format';
22
22
  export { default as pluginUnoCSS } from '@unocss/eslint-plugin';
23
23
  export { default as pluginVitest } from '@vitest/eslint-plugin';
@@ -42,8 +42,20 @@ export { jsoncEslintParser as parserJsonc };
42
42
  /**
43
43
  * @file Type Utils
44
44
  */
45
+ /**
46
+ * Array or not
47
+ */
45
48
  type Arrayable<T> = T | T[];
49
+ /**
50
+ * Promise or not
51
+ */
46
52
  type Awaitable<T> = T | Promise<T>;
53
+ /**
54
+ * Make types human readable
55
+ */
56
+ type Pretty<T> = {
57
+ [P in keyof T]: T[P];
58
+ } & {};
47
59
  /**
48
60
  * A literal type that supports custom further strings but preserves autocompletion in IDEs.
49
61
  *
@@ -14646,9 +14658,13 @@ type ESLintParser = Linter.Parser;
14646
14658
  */
14647
14659
  type ESLintProcessor = Linter.Processor;
14648
14660
  /**
14649
- * Parser options
14661
+ * ESLint parserOptions
14650
14662
  */
14651
14663
  type ESLintParserOptions = Linter.ParserOptions;
14664
+ /**
14665
+ * TypeScript ESLint parserOptions
14666
+ */
14667
+ type TSESLintParserOptions = Pretty<Required<Required<ConfigWithExtends>['languageOptions']>['parserOptions']>;
14652
14668
 
14653
14669
  /**
14654
14670
  * @file Config options
@@ -14679,6 +14695,12 @@ type ConfigCommandOptions = ESLintPluginCommandOptions;
14679
14695
  interface ConfigJsdocOptions extends OptionsOverrides {
14680
14696
  }
14681
14697
  interface ConfigUnoCSSOptions extends OptionsOverrides {
14698
+ /**
14699
+ * Enable attributify sort order
14700
+ *
14701
+ * @default false
14702
+ */
14703
+ attributify?: boolean;
14682
14704
  }
14683
14705
  interface ConfigUnicornOptions extends OptionsOverrides {
14684
14706
  }
@@ -14757,7 +14779,7 @@ interface ConfigTypeScriptOptions extends OptionsOverrides {
14757
14779
  /**
14758
14780
  * Additional parser options
14759
14781
  */
14760
- parserOptions?: Partial<ESLintParserOptions>;
14782
+ parserOptions?: TSESLintParserOptions;
14761
14783
  /**
14762
14784
  * Glob patterns for files that should be type aware.
14763
14785
  * @default ['**\/*.{ts,tsx}']
@@ -14977,12 +14999,24 @@ declare function resolveSubOptions<K extends keyof ConfigOptions>(options: Confi
14977
14999
 
14978
15000
  declare function mergePrettierOptions(options?: PrettierOptions, overrides?: PrettierOptions): PrettierOptions;
14979
15001
 
15002
+ /**
15003
+ * @file ESLint parsers
15004
+ */
15005
+
14980
15006
  /**
14981
15007
  * With meta
14982
15008
  */
14983
15009
  declare const parserTypeScript: {
14984
- meta?: { [K in keyof _typescript_eslint_utils_ts_eslint.Parser.ParserMeta]?: _typescript_eslint_utils_ts_eslint.Parser.ParserMeta[K] | undefined; };
14985
- parseForESLint(text: string, options?: unknown): { [k in keyof _typescript_eslint_utils_ts_eslint.Parser.ParseResult]: unknown; };
15010
+ meta?: {
15011
+ name?: string | undefined;
15012
+ version?: string | undefined;
15013
+ };
15014
+ parseForESLint(text: string, options?: unknown): {
15015
+ ast: unknown;
15016
+ scopeManager?: unknown;
15017
+ services?: unknown;
15018
+ visitorKeys?: unknown;
15019
+ };
14986
15020
  };
14987
15021
 
14988
15022
  /**
@@ -15061,4 +15095,4 @@ declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConf
15061
15095
  */
15062
15096
  declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
15063
15097
 
15064
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
15098
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.d.ts CHANGED
@@ -4,8 +4,9 @@ import { ESLintPluginCommandOptions } from 'eslint-plugin-command/types';
4
4
  import { Options } from 'eslint-processor-vue-blocks';
5
5
  export { default as processorVueBlocks } from 'eslint-processor-vue-blocks';
6
6
  import { Linter } from 'eslint';
7
+ import { ConfigWithExtends } from 'typescript-eslint';
8
+ export { plugin as pluginTypeScript, configs as typescriptConfigs } from 'typescript-eslint';
7
9
  import { RequiredOptions, BuiltInParserName } from 'prettier';
8
- import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
9
10
  import * as eslintPluginRegexp from 'eslint-plugin-regexp';
10
11
  export { eslintPluginRegexp as pluginRegexp };
11
12
  export { default as pluginNode } from 'eslint-plugin-n';
@@ -17,7 +18,6 @@ export { default as pluginMarkdown } from '@eslint/markdown';
17
18
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
18
19
  export { default as pluginJsdoc } from 'eslint-plugin-jsdoc';
19
20
  export { default as pluginJsonc } from 'eslint-plugin-jsonc';
20
- export { plugin as pluginTypeScript, configs as typescriptConfigs } from 'typescript-eslint';
21
21
  export { default as pluginFormat } from 'eslint-plugin-format';
22
22
  export { default as pluginUnoCSS } from '@unocss/eslint-plugin';
23
23
  export { default as pluginVitest } from '@vitest/eslint-plugin';
@@ -42,8 +42,20 @@ export { jsoncEslintParser as parserJsonc };
42
42
  /**
43
43
  * @file Type Utils
44
44
  */
45
+ /**
46
+ * Array or not
47
+ */
45
48
  type Arrayable<T> = T | T[];
49
+ /**
50
+ * Promise or not
51
+ */
46
52
  type Awaitable<T> = T | Promise<T>;
53
+ /**
54
+ * Make types human readable
55
+ */
56
+ type Pretty<T> = {
57
+ [P in keyof T]: T[P];
58
+ } & {};
47
59
  /**
48
60
  * A literal type that supports custom further strings but preserves autocompletion in IDEs.
49
61
  *
@@ -14646,9 +14658,13 @@ type ESLintParser = Linter.Parser;
14646
14658
  */
14647
14659
  type ESLintProcessor = Linter.Processor;
14648
14660
  /**
14649
- * Parser options
14661
+ * ESLint parserOptions
14650
14662
  */
14651
14663
  type ESLintParserOptions = Linter.ParserOptions;
14664
+ /**
14665
+ * TypeScript ESLint parserOptions
14666
+ */
14667
+ type TSESLintParserOptions = Pretty<Required<Required<ConfigWithExtends>['languageOptions']>['parserOptions']>;
14652
14668
 
14653
14669
  /**
14654
14670
  * @file Config options
@@ -14679,6 +14695,12 @@ type ConfigCommandOptions = ESLintPluginCommandOptions;
14679
14695
  interface ConfigJsdocOptions extends OptionsOverrides {
14680
14696
  }
14681
14697
  interface ConfigUnoCSSOptions extends OptionsOverrides {
14698
+ /**
14699
+ * Enable attributify sort order
14700
+ *
14701
+ * @default false
14702
+ */
14703
+ attributify?: boolean;
14682
14704
  }
14683
14705
  interface ConfigUnicornOptions extends OptionsOverrides {
14684
14706
  }
@@ -14757,7 +14779,7 @@ interface ConfigTypeScriptOptions extends OptionsOverrides {
14757
14779
  /**
14758
14780
  * Additional parser options
14759
14781
  */
14760
- parserOptions?: Partial<ESLintParserOptions>;
14782
+ parserOptions?: TSESLintParserOptions;
14761
14783
  /**
14762
14784
  * Glob patterns for files that should be type aware.
14763
14785
  * @default ['**\/*.{ts,tsx}']
@@ -14977,12 +14999,24 @@ declare function resolveSubOptions<K extends keyof ConfigOptions>(options: Confi
14977
14999
 
14978
15000
  declare function mergePrettierOptions(options?: PrettierOptions, overrides?: PrettierOptions): PrettierOptions;
14979
15001
 
15002
+ /**
15003
+ * @file ESLint parsers
15004
+ */
15005
+
14980
15006
  /**
14981
15007
  * With meta
14982
15008
  */
14983
15009
  declare const parserTypeScript: {
14984
- meta?: { [K in keyof _typescript_eslint_utils_ts_eslint.Parser.ParserMeta]?: _typescript_eslint_utils_ts_eslint.Parser.ParserMeta[K] | undefined; };
14985
- parseForESLint(text: string, options?: unknown): { [k in keyof _typescript_eslint_utils_ts_eslint.Parser.ParseResult]: unknown; };
15010
+ meta?: {
15011
+ name?: string | undefined;
15012
+ version?: string | undefined;
15013
+ };
15014
+ parseForESLint(text: string, options?: unknown): {
15015
+ ast: unknown;
15016
+ scopeManager?: unknown;
15017
+ services?: unknown;
15018
+ visitorKeys?: unknown;
15019
+ };
14986
15020
  };
14987
15021
 
14988
15022
  /**
@@ -15061,4 +15095,4 @@ declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConf
15061
15095
  */
15062
15096
  declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
15063
15097
 
15064
- export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
15098
+ export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigFormatOptions, type ConfigGitHubActionOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigNtnyqOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigSortOptions, type ConfigStylisticOptions, type ConfigTestOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVueOptions, type ConfigYmlOptions, DEFAULT_PRETTIER_OPTIONS, type ESLintConfig, type ESLintParser, type ESLintParserOptions, type ESLintProcessor, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type PerfectionistSortOrder, type PerfectionistSortType, type PrettierOptions, type Pretty, type ResolvedOptions, type RuleOptions, type TSESLintParserOptions, type TypedConfigItem, antfu, command, comments, defineESLintConfig, format, getOverrides, githubAction, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, mergePrettierOptions, node, ntnyq, parserPlain, parserTypeScript, perfectionist, prettier, regexp, resolveSubOptions, sort, specials, stylistic, test, toArray, toml, typescript, unicorn, unocss, unusedImports, vitest, vue, yml };
package/dist/index.js CHANGED
@@ -738,6 +738,16 @@ var sort = (options = {}) => {
738
738
  "activationEvents",
739
739
  "contributes",
740
740
  "categories",
741
+ "galleryBanner",
742
+ "badges",
743
+ "markdown",
744
+ "qna",
745
+ "sponsor",
746
+ "extensionPack",
747
+ "extensionDependencies",
748
+ "extensionKind",
749
+ "pricing",
750
+ "capabilities",
741
751
  /**
742
752
  * Package manager
743
753
  */
@@ -767,6 +777,20 @@ var sort = (options = {}) => {
767
777
  pathPattern: "^exports.*$",
768
778
  order: ["types", "import", "require", "default"]
769
779
  },
780
+ // VSCode extension
781
+ {
782
+ order: { type: "asc" },
783
+ pathPattern: "^contributes.*$"
784
+ },
785
+ /**
786
+ * pnpm publish config
787
+ * @see {@link https://pnpm.io/package_json#publishconfig}
788
+ */
789
+ {
790
+ order: { type: "asc" },
791
+ pathPattern: "^publishConfig.*$"
792
+ },
793
+ // npm scripts
770
794
  {
771
795
  pathPattern: "^scripts$",
772
796
  order: { type: "asc" }
@@ -793,6 +817,18 @@ var sort = (options = {}) => {
793
817
  {
794
818
  pathPattern: "^files$",
795
819
  order: { type: "asc" }
820
+ },
821
+ {
822
+ pathPattern: "^keywords$",
823
+ order: { type: "asc" }
824
+ },
825
+ {
826
+ pathPattern: "^activationEvents$",
827
+ order: { type: "asc" }
828
+ },
829
+ {
830
+ pathPattern: "^contributes.*$",
831
+ order: { type: "asc" }
796
832
  }
797
833
  ]
798
834
  }
@@ -1057,8 +1093,7 @@ var unocss = (options = {}) => [
1057
1093
  },
1058
1094
  rules: {
1059
1095
  "unocss/order": "error",
1060
- // We don't use this
1061
- "unocss/order-attributify": "off",
1096
+ "unocss/order-attributify": options.attributify ? "error" : "off",
1062
1097
  // Overrides rules
1063
1098
  ...options.overrides
1064
1099
  }
@@ -1600,222 +1635,220 @@ var gitignore = (options = {}) => {
1600
1635
  // src/configs/javascript.ts
1601
1636
  import jsConfig from "@eslint/js";
1602
1637
  import globals2 from "globals";
1603
- var javascript = (options = {}) => {
1604
- const strictRules = {
1605
- complexity: ["error", { max: 30 }],
1606
- "max-params": ["error", { max: 5 }],
1607
- "max-depth": ["error", { max: 5 }],
1608
- "max-nested-callbacks": ["error", { max: 10 }],
1609
- "max-lines": [
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 [
1638
+ var strictRules = {
1639
+ complexity: ["error", { max: 30 }],
1640
+ "max-params": ["error", { max: 5 }],
1641
+ "max-depth": ["error", { max: 5 }],
1642
+ "max-nested-callbacks": ["error", { max: 10 }],
1643
+ "max-lines": [
1644
+ "error",
1627
1645
  {
1628
- ...jsConfig.configs.recommended,
1629
- name: "ntnyq/js/recommended"
1630
- },
1646
+ max: 1e3,
1647
+ skipComments: true,
1648
+ skipBlankLines: true
1649
+ }
1650
+ ],
1651
+ "max-lines-per-function": [
1652
+ "error",
1631
1653
  {
1632
- name: "ntnyq/js/core",
1633
- languageOptions: {
1634
- globals: {
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
- }
1654
+ max: 200,
1655
+ skipComments: true,
1656
+ skipBlankLines: true
1816
1657
  }
1817
- ];
1658
+ ]
1818
1659
  };
1660
+ var javascript = (options = {}) => [
1661
+ {
1662
+ ...jsConfig.configs.recommended,
1663
+ name: "ntnyq/js/recommended"
1664
+ },
1665
+ {
1666
+ name: "ntnyq/js/core",
1667
+ languageOptions: {
1668
+ globals: {
1669
+ ...globals2.browser,
1670
+ ...globals2.es2021,
1671
+ ...globals2.node
1672
+ },
1673
+ sourceType: "module"
1674
+ },
1675
+ rules: {
1676
+ "require-await": "off",
1677
+ "no-return-assign": "off",
1678
+ "no-useless-escape": "off",
1679
+ "consistent-return": "off",
1680
+ // disabled in favor of `perfectionist/sort-named-imports`
1681
+ "sort-imports": "off",
1682
+ // standard v17.0.0
1683
+ "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
1684
+ camelcase: [
1685
+ "error",
1686
+ {
1687
+ allow: ["^UNSAFE_"],
1688
+ properties: "never",
1689
+ ignoreGlobals: true
1690
+ }
1691
+ ],
1692
+ "constructor-super": "error",
1693
+ curly: ["error", "multi-line"],
1694
+ "default-case-last": "error",
1695
+ "dot-notation": ["error", { allowKeywords: true }],
1696
+ "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }],
1697
+ "no-array-constructor": "error",
1698
+ "no-async-promise-executor": "error",
1699
+ "no-caller": "error",
1700
+ "no-class-assign": "error",
1701
+ "no-compare-neg-zero": "error",
1702
+ "no-cond-assign": "error",
1703
+ "no-const-assign": "error",
1704
+ "no-constant-condition": ["error", { checkLoops: false }],
1705
+ "no-control-regex": "error",
1706
+ "no-debugger": "error",
1707
+ "no-delete-var": "error",
1708
+ "no-dupe-args": "error",
1709
+ "no-dupe-class-members": "error",
1710
+ "no-dupe-keys": "error",
1711
+ "no-duplicate-case": "error",
1712
+ "no-useless-backreference": "error",
1713
+ "no-empty": ["error", { allowEmptyCatch: true }],
1714
+ "no-empty-character-class": "error",
1715
+ "no-empty-pattern": "error",
1716
+ "no-eval": "error",
1717
+ "no-ex-assign": "error",
1718
+ "no-extend-native": "error",
1719
+ "no-extra-bind": "error",
1720
+ "no-extra-boolean-cast": "error",
1721
+ "no-fallthrough": "error",
1722
+ "no-func-assign": "error",
1723
+ "no-global-assign": "error",
1724
+ "no-implied-eval": "error",
1725
+ "no-import-assign": "error",
1726
+ "no-invalid-regexp": "error",
1727
+ "no-irregular-whitespace": "error",
1728
+ "no-iterator": "error",
1729
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
1730
+ "no-lone-blocks": "error",
1731
+ "no-loss-of-precision": "error",
1732
+ "no-misleading-character-class": "error",
1733
+ "no-prototype-builtins": "error",
1734
+ "no-useless-catch": "error",
1735
+ "no-new": "error",
1736
+ "no-new-func": "error",
1737
+ "no-new-wrappers": "error",
1738
+ "no-obj-calls": "error",
1739
+ "no-octal": "error",
1740
+ "no-octal-escape": "error",
1741
+ "no-proto": "error",
1742
+ "no-redeclare": ["error", { builtinGlobals: false }],
1743
+ "no-regex-spaces": "error",
1744
+ "no-self-assign": ["error", { props: true }],
1745
+ "no-self-compare": "error",
1746
+ "no-sequences": "error",
1747
+ "no-shadow-restricted-names": "error",
1748
+ "no-sparse-arrays": "error",
1749
+ "no-template-curly-in-string": "error",
1750
+ "no-this-before-super": "error",
1751
+ "no-throw-literal": "error",
1752
+ "no-undef": "error",
1753
+ "no-undef-init": "error",
1754
+ "no-unexpected-multiline": "error",
1755
+ "no-unmodified-loop-condition": "error",
1756
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
1757
+ "no-unreachable": "error",
1758
+ "no-unreachable-loop": "error",
1759
+ "no-unsafe-finally": "error",
1760
+ "no-unsafe-negation": "error",
1761
+ "no-unused-expressions": [
1762
+ "error",
1763
+ {
1764
+ allowShortCircuit: true,
1765
+ allowTernary: true,
1766
+ allowTaggedTemplates: true
1767
+ }
1768
+ ],
1769
+ "no-unused-vars": [
1770
+ "error",
1771
+ {
1772
+ args: "none",
1773
+ caughtErrors: "none",
1774
+ ignoreRestSiblings: true,
1775
+ vars: "all"
1776
+ }
1777
+ ],
1778
+ "no-useless-call": "error",
1779
+ "no-useless-computed-key": "error",
1780
+ "no-useless-constructor": "error",
1781
+ "no-useless-rename": "error",
1782
+ "no-useless-return": "error",
1783
+ "prefer-promise-reject-errors": "error",
1784
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
1785
+ "symbol-description": "error",
1786
+ "unicode-bom": ["error", "never"],
1787
+ "use-isnan": [
1788
+ "error",
1789
+ {
1790
+ enforceForSwitchCase: true,
1791
+ enforceForIndexOf: true
1792
+ }
1793
+ ],
1794
+ "valid-typeof": ["error", { requireStringLiterals: true }],
1795
+ yoda: ["error", "never"],
1796
+ // es6+
1797
+ "no-var": "error",
1798
+ "prefer-rest-params": "error",
1799
+ "prefer-spread": "error",
1800
+ "prefer-template": "error",
1801
+ "no-empty-static-block": "error",
1802
+ "no-new-native-nonconstructor": "error",
1803
+ "prefer-const": [
1804
+ "error",
1805
+ {
1806
+ destructuring: "all",
1807
+ ignoreReadBeforeAssign: true
1808
+ }
1809
+ ],
1810
+ "prefer-arrow-callback": [
1811
+ "error",
1812
+ {
1813
+ allowNamedFunctions: false,
1814
+ allowUnboundThis: true
1815
+ }
1816
+ ],
1817
+ "object-shorthand": [
1818
+ "error",
1819
+ "always",
1820
+ {
1821
+ ignoreConstructors: false,
1822
+ avoidQuotes: true
1823
+ }
1824
+ ],
1825
+ // best-practice
1826
+ eqeqeq: ["error", "smart"],
1827
+ "array-callback-return": "error",
1828
+ "block-scoped-var": "error",
1829
+ "no-alert": "error",
1830
+ "no-case-declarations": "error",
1831
+ "no-multi-str": "error",
1832
+ "no-with": "error",
1833
+ "no-void": "error",
1834
+ "vars-on-top": "error",
1835
+ "one-var": ["error", "never"],
1836
+ "no-use-before-define": [
1837
+ "error",
1838
+ {
1839
+ functions: false,
1840
+ classes: false,
1841
+ variables: true,
1842
+ allowNamedExports: false
1843
+ }
1844
+ ],
1845
+ // Strict rules
1846
+ ...options.strict ? strictRules : {},
1847
+ // Overrides rules
1848
+ ...options.overrides
1849
+ }
1850
+ }
1851
+ ];
1819
1852
  var jsx = () => [
1820
1853
  {
1821
1854
  name: "ntnyq/jsx",
@@ -1875,24 +1908,25 @@ var typescript = (options = {}) => {
1875
1908
  parserOptions = {}
1876
1909
  } = options;
1877
1910
  function createParserConfig(enableTypeAware = false, files = [], ignores2 = []) {
1911
+ const typescriptParserOptions = {
1912
+ // extraFileExtensions: [''],
1913
+ sourceType: "module",
1914
+ ...enableTypeAware ? {
1915
+ projectService: {
1916
+ allowDefaultProject: ["./*.js"],
1917
+ defaultProject: options.tsconfigPath
1918
+ },
1919
+ tsconfigRootDir: process2.cwd()
1920
+ } : {},
1921
+ ...parserOptions
1922
+ };
1878
1923
  const parserConfig = {
1879
1924
  name: `ntnyq/ts/${enableTypeAware ? "parser-type-aware" : "parser"}`,
1880
1925
  files,
1881
1926
  ignores: [...ignores2],
1882
1927
  languageOptions: {
1883
1928
  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
- }
1929
+ parserOptions: typescriptParserOptions
1896
1930
  }
1897
1931
  };
1898
1932
  return parserConfig;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.4.0",
4
+ "version": "3.5.0",
5
5
  "packageManager": "pnpm@9.14.2",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
@@ -87,7 +87,7 @@
87
87
  "local-pkg": "^0.5.1",
88
88
  "prettier": "^3.3.3",
89
89
  "toml-eslint-parser": "^0.10.0",
90
- "typescript-eslint": "^8.15.0",
90
+ "typescript-eslint": "^8.16.0",
91
91
  "vue-eslint-parser": "^9.4.3",
92
92
  "yaml-eslint-parser": "^1.2.3"
93
93
  },