@ntnyq/eslint-config 2.5.2 → 2.6.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/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ __export(src_exports, {
49
49
  GLOB_SRC: () => GLOB_SRC,
50
50
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
51
51
  GLOB_STYLE: () => GLOB_STYLE,
52
+ GLOB_TOML: () => GLOB_TOML,
52
53
  GLOB_TS: () => GLOB_TS,
53
54
  GLOB_TSX: () => GLOB_TSX,
54
55
  GLOB_VUE: () => GLOB_VUE,
@@ -67,10 +68,12 @@ __export(src_exports, {
67
68
  jsdoc: () => jsdoc,
68
69
  jsonc: () => jsonc,
69
70
  jsx: () => jsx,
71
+ loadPlugin: () => loadPlugin,
70
72
  markdown: () => markdown,
71
73
  node: () => node,
72
74
  ntnyq: () => ntnyq,
73
75
  parserJsonc: () => parserJsonc,
76
+ parserToml: () => parserToml,
74
77
  parserVue: () => parserVue,
75
78
  parserYaml: () => parserYaml,
76
79
  pluginComments: () => import_eslint_plugin_eslint_comments.default,
@@ -81,6 +84,7 @@ __export(src_exports, {
81
84
  pluginNode: () => import_eslint_plugin_n.default,
82
85
  pluginPrettier: () => import_eslint_plugin_prettier.default,
83
86
  pluginRegexp: () => pluginRegexp,
87
+ pluginToml: () => import_eslint_plugin_toml.default,
84
88
  pluginUnicorn: () => import_eslint_plugin_unicorn.default,
85
89
  pluginUnoCSS: () => import_eslint_plugin.default,
86
90
  pluginVue: () => import_eslint_plugin_vue.default,
@@ -95,6 +99,7 @@ __export(src_exports, {
95
99
  regexp: () => regexp,
96
100
  sortPackageJson: () => sortPackageJson,
97
101
  sortTsConfig: () => sortTsConfig,
102
+ toml: () => toml,
98
103
  tseslint: () => import_typescript_eslint.default,
99
104
  typescript: () => typescript,
100
105
  typescriptCore: () => typescriptCore,
@@ -105,7 +110,7 @@ __export(src_exports, {
105
110
  });
106
111
  module.exports = __toCommonJS(src_exports);
107
112
 
108
- // src/env.ts
113
+ // src/utils/env.ts
109
114
  var import_node_process = __toESM(require("process"), 1);
110
115
  var import_node_path = require("path");
111
116
  var import_local_pkg = require("local-pkg");
@@ -115,7 +120,22 @@ var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pk
115
120
  });
116
121
  var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/postcss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
117
122
 
118
- // src/types.ts
123
+ // src/utils/interopDefault.ts
124
+ async function interopDefault(mod) {
125
+ const resolved = await mod;
126
+ return resolved.default || resolved;
127
+ }
128
+
129
+ // src/utils/loadPlugin.ts
130
+ async function loadPlugin(name) {
131
+ const mod = await import(name).catch((err) => {
132
+ console.error(err);
133
+ throw new Error(`Failed to load ESLint plugin '${name}'. Please install it!.`);
134
+ });
135
+ return interopDefault(mod);
136
+ }
137
+
138
+ // src/utils/defineConfig.ts
119
139
  function defineConfig(configs = []) {
120
140
  return configs;
121
141
  }
@@ -138,6 +158,7 @@ var GLOB_JSONC = "**/*.jsonc";
138
158
  var GLOB_VUE = "**/*.vue";
139
159
  var GLOB_MARKDOWN = "**/*.md";
140
160
  var GLOB_YAML = "**/*.y?(a)ml";
161
+ var GLOB_TOML = "**/*.toml";
141
162
  var GLOB_HTML = "**/*.htm?(l)";
142
163
  var GLOB_ALL_SRC = [
143
164
  GLOB_SRC,
@@ -147,6 +168,7 @@ var GLOB_ALL_SRC = [
147
168
  GLOB_MARKDOWN,
148
169
  GLOB_VUE,
149
170
  GLOB_YAML,
171
+ GLOB_TOML,
150
172
  GLOB_HTML
151
173
  ];
152
174
  var GLOB_NODE_MODULES = "**/node_modules/**";
@@ -186,6 +208,7 @@ var GLOB_EXCLUDE = [
186
208
  "**/?(.)cache",
187
209
  "**/.eslintcache",
188
210
  "**/.stylelintcache",
211
+ "**/.eslint-config-inspector",
189
212
  "**/.vite-inspect",
190
213
  "**/.nuxt",
191
214
  "**/.wxt",
@@ -193,6 +216,7 @@ var GLOB_EXCLUDE = [
193
216
  "**/.tsup",
194
217
  "**/.nitro",
195
218
  "**/.vercel",
219
+ "**/.wrangler",
196
220
  "**/.changeset",
197
221
  "**/.npmrc",
198
222
  "**/.yarnrc"
@@ -207,26 +231,24 @@ var ignores = defineConfig([
207
231
  ]);
208
232
 
209
233
  // src/plugins.ts
234
+ var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
235
+ var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
210
236
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
211
237
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
238
+ var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
239
+ var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
240
+ var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
241
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
212
242
  var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
213
243
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
244
+ var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
214
245
  var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
215
246
  var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
216
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
217
- var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
218
- var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
219
- var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
220
- var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
221
- var pluginRegexp = __toESM(require("eslint-plugin-regexp"), 1);
222
- var import_typescript_eslint = __toESM(require("typescript-eslint"), 1);
247
+ var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
248
+ var parserToml = __toESM(require("toml-eslint-parser"), 1);
223
249
  var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
224
250
  var parserVue = __toESM(require("vue-eslint-parser"), 1);
225
251
  var parserJsonc = __toESM(require("jsonc-eslint-parser"), 1);
226
- // @__NO_SIDE_EFFECTS__
227
- function interopDefault(m) {
228
- return m.default || m;
229
- }
230
252
 
231
253
  // src/configs/node.ts
232
254
  var node = defineConfig([
@@ -417,11 +439,11 @@ var comments = defineConfig([
417
439
  {
418
440
  name: "ntnyq/eslint-comments",
419
441
  plugins: {
420
- "eslint-comments": import_eslint_plugin_eslint_comments.default
442
+ "@eslint-community/eslint-comments": import_eslint_plugin_eslint_comments.default
421
443
  },
422
444
  rules: {
423
445
  ...import_eslint_plugin_eslint_comments.default.configs.recommended.rules,
424
- "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
446
+ "@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
425
447
  }
426
448
  }
427
449
  ]);
@@ -845,7 +867,8 @@ var typescriptCore = import_typescript_eslint.default.config({
845
867
  "@typescript-eslint/no-empty-object-type": [
846
868
  "error",
847
869
  {
848
- allowInterfaces: "always"
870
+ allowInterfaces: "always",
871
+ allowObjectTypes: "always"
849
872
  }
850
873
  ],
851
874
  "@typescript-eslint/consistent-type-assertions": [
@@ -930,7 +953,7 @@ var unocss = defineConfig([
930
953
 
931
954
  // src/configs/command.ts
932
955
  var import_config = __toESM(require("eslint-plugin-command/config"), 1);
933
- var command = defineConfig([(0, import_config.default)({})]);
956
+ var command = defineConfig([(0, import_config.default)()]);
934
957
 
935
958
  // src/configs/yml.ts
936
959
  var yml = defineConfig([
@@ -952,6 +975,41 @@ var yml = defineConfig([
952
975
  }
953
976
  ]);
954
977
 
978
+ // src/configs/toml.ts
979
+ var toml = defineConfig([
980
+ {
981
+ name: "ntnyq/toml",
982
+ files: [GLOB_TOML],
983
+ languageOptions: {
984
+ parser: parserToml
985
+ },
986
+ plugins: {
987
+ toml: import_eslint_plugin_toml.default
988
+ },
989
+ rules: {
990
+ "toml/comma-style": "error",
991
+ "toml/keys-order": "error",
992
+ "toml/no-space-dots": "error",
993
+ "toml/no-unreadable-number-separator": "error",
994
+ "toml/precision-of-fractional-seconds": "error",
995
+ "toml/precision-of-integer": "error",
996
+ "toml/tables-order": "error",
997
+ "toml/indent": ["error", 2],
998
+ "toml/vue-custom-block/no-parsing-error": "error",
999
+ "toml/array-bracket-newline": "error",
1000
+ "toml/array-bracket-spacing": "error",
1001
+ "toml/array-element-newline": "error",
1002
+ "toml/inline-table-curly-spacing": "error",
1003
+ "toml/key-spacing": "error",
1004
+ "toml/padding-line-between-pairs": "error",
1005
+ "toml/padding-line-between-tables": "error",
1006
+ "toml/quoted-keys": "error",
1007
+ "toml/spaced-comment": "error",
1008
+ "toml/table-bracket-spacing": "error"
1009
+ }
1010
+ }
1011
+ ]);
1012
+
955
1013
  // src/configs/sort.ts
956
1014
  var sortPackageJson = defineConfig([
957
1015
  {
@@ -1214,8 +1272,6 @@ var jsonc = defineConfig([
1214
1272
 
1215
1273
  // src/configs/markdown.ts
1216
1274
  var markdown = defineConfig([
1217
- // TODO: Add config name for markdown plugin
1218
- // wait for https://github.com/eslint/eslint-plugin-markdown/pull/256
1219
1275
  ...import_eslint_plugin_markdown.default.configs.recommended,
1220
1276
  {
1221
1277
  name: "ntnyq/markdown/extensions",
@@ -1523,7 +1579,7 @@ var presetJavaScript = [
1523
1579
  ];
1524
1580
  var presetBasic = [...presetJavaScript, ...typescript];
1525
1581
  var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
1526
- var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
1582
+ var presetLanguageExtensions = [...presetJsonc, ...yml, ...toml, ...markdown];
1527
1583
  var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
1528
1584
  var presetAll = [...presetCommon, ...vue, ...unocss];
1529
1585
  function ntnyq(config = [], {
@@ -1533,7 +1589,7 @@ function ntnyq(config = [], {
1533
1589
  markdown: enableMarkdown = true,
1534
1590
  command: enableCommand = true
1535
1591
  } = {}) {
1536
- const configs = defineConfig([...presetBasic, ...yml, ...presetJsonc]);
1592
+ const configs = defineConfig([...presetBasic, ...yml, ...toml, ...presetJsonc]);
1537
1593
  if (enableVue) {
1538
1594
  configs.push(...vue);
1539
1595
  }
@@ -1575,6 +1631,7 @@ function ntnyq(config = [], {
1575
1631
  GLOB_SRC,
1576
1632
  GLOB_SRC_EXT,
1577
1633
  GLOB_STYLE,
1634
+ GLOB_TOML,
1578
1635
  GLOB_TS,
1579
1636
  GLOB_TSX,
1580
1637
  GLOB_VUE,
@@ -1593,10 +1650,12 @@ function ntnyq(config = [], {
1593
1650
  jsdoc,
1594
1651
  jsonc,
1595
1652
  jsx,
1653
+ loadPlugin,
1596
1654
  markdown,
1597
1655
  node,
1598
1656
  ntnyq,
1599
1657
  parserJsonc,
1658
+ parserToml,
1600
1659
  parserVue,
1601
1660
  parserYaml,
1602
1661
  pluginComments,
@@ -1607,6 +1666,7 @@ function ntnyq(config = [], {
1607
1666
  pluginNode,
1608
1667
  pluginPrettier,
1609
1668
  pluginRegexp,
1669
+ pluginToml,
1610
1670
  pluginUnicorn,
1611
1671
  pluginUnoCSS,
1612
1672
  pluginVue,
@@ -1621,6 +1681,7 @@ function ntnyq(config = [], {
1621
1681
  regexp,
1622
1682
  sortPackageJson,
1623
1683
  sortTsConfig,
1684
+ toml,
1624
1685
  tseslint,
1625
1686
  typescript,
1626
1687
  typescriptCore,