@ntnyq/eslint-config 2.0.0-beta.27 → 2.0.0-beta.28

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
@@ -5,9 +5,9 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all2) => {
9
- for (var name in all2)
10
- __defProp(target, name, { get: all2[name], enumerable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
11
  };
12
12
  var __copyProps = (to, from, except, desc) => {
13
13
  if (from && typeof from === "object" || typeof from === "function") {
@@ -52,12 +52,10 @@ __export(src_exports, {
52
52
  GLOB_TSX: () => GLOB_TSX,
53
53
  GLOB_VUE: () => GLOB_VUE,
54
54
  GLOB_YAML: () => GLOB_YAML,
55
- all: () => all,
56
- basic: () => basic,
57
55
  comments: () => comments,
58
- common: () => common,
59
56
  getVueVersion: () => getVueVersion,
60
57
  hasTypeScript: () => hasTypeScript,
58
+ hasUnoCSS: () => hasUnoCSS,
61
59
  hasVue: () => hasVue,
62
60
  ignores: () => ignores,
63
61
  imports: () => imports,
@@ -81,6 +79,12 @@ __export(src_exports, {
81
79
  pluginUnoCSS: () => import_eslint_plugin.default,
82
80
  pluginVue: () => import_eslint_plugin_vue.default,
83
81
  pluginYaml: () => import_eslint_plugin_yml.default,
82
+ presetAll: () => presetAll,
83
+ presetBasic: () => presetBasic,
84
+ presetCommon: () => presetCommon,
85
+ presetJavaScript: () => presetJavaScript,
86
+ presetJsonc: () => presetJsonc,
87
+ presetLanguageExtensions: () => presetLanguageExtensions,
84
88
  prettier: () => prettier,
85
89
  sortPackageJson: () => sortPackageJson,
86
90
  sortTsConfig: () => sortTsConfig,
@@ -98,6 +102,7 @@ module.exports = __toCommonJS(src_exports);
98
102
  var import_local_pkg = require("local-pkg");
99
103
  var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
100
104
  var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli");
105
+ var hasUnoCSS = (0, import_local_pkg.isPackageExists)("unocss") || (0, import_local_pkg.isPackageExists)("@unocss/webpack") || (0, import_local_pkg.isPackageExists)("@unocss/nuxt");
101
106
 
102
107
  // src/globs.ts
103
108
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -1391,34 +1396,39 @@ var ignores = (0, import_eslint_define_config14.defineFlatConfig)([
1391
1396
  ]);
1392
1397
 
1393
1398
  // src/presets.ts
1394
- var basic = (0, import_eslint_define_config15.defineFlatConfig)([
1399
+ var presetJavaScript = [
1395
1400
  ...ignores,
1396
1401
  ...javascript,
1397
1402
  ...jsx,
1398
1403
  ...node,
1399
- ...typescript,
1400
1404
  ...imports,
1401
1405
  ...unicorn,
1402
1406
  ...comments
1403
- ]);
1404
- var common = (0, import_eslint_define_config15.defineFlatConfig)([
1405
- ...basic,
1406
- ...yml,
1407
- ...jsonc,
1408
- ...sortPackageJson,
1409
- ...sortTsConfig,
1410
- ...prettier,
1411
- ...markdown
1412
- ]);
1413
- var all = (0, import_eslint_define_config15.defineFlatConfig)([...common, ...vue, ...unocss]);
1414
- function ntnyq(config = [], { vue: enableVue = false, unocss: enableUnoCSS = false } = {}) {
1415
- const configs = (0, import_eslint_define_config15.defineFlatConfig)([...common]);
1407
+ ];
1408
+ var presetBasic = [...presetJavaScript, ...typescript];
1409
+ var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
1410
+ var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
1411
+ var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
1412
+ var presetAll = [...presetCommon, ...vue, ...unocss];
1413
+ function ntnyq(config = [], {
1414
+ vue: enableVue = hasVue,
1415
+ unocss: enableUnoCSS = hasUnoCSS,
1416
+ prettier: enablePrettier = true,
1417
+ markdown: enableMarkdown = true
1418
+ } = {}) {
1419
+ const configs = (0, import_eslint_define_config15.defineFlatConfig)([...presetBasic, ...yml, ...presetJsonc]);
1416
1420
  if (enableVue) {
1417
1421
  configs.push(...vue);
1418
1422
  }
1419
1423
  if (enableUnoCSS) {
1420
1424
  configs.push(...unocss);
1421
1425
  }
1426
+ if (enablePrettier) {
1427
+ configs.push(...prettier);
1428
+ }
1429
+ if (enableMarkdown) {
1430
+ configs.push(...markdown);
1431
+ }
1422
1432
  if (Object.keys(config).length > 0) {
1423
1433
  configs.push(...Array.isArray(config) ? config : [config]);
1424
1434
  }
@@ -1448,12 +1458,10 @@ function ntnyq(config = [], { vue: enableVue = false, unocss: enableUnoCSS = fal
1448
1458
  GLOB_TSX,
1449
1459
  GLOB_VUE,
1450
1460
  GLOB_YAML,
1451
- all,
1452
- basic,
1453
1461
  comments,
1454
- common,
1455
1462
  getVueVersion,
1456
1463
  hasTypeScript,
1464
+ hasUnoCSS,
1457
1465
  hasVue,
1458
1466
  ignores,
1459
1467
  imports,
@@ -1477,6 +1485,12 @@ function ntnyq(config = [], { vue: enableVue = false, unocss: enableUnoCSS = fal
1477
1485
  pluginUnoCSS,
1478
1486
  pluginVue,
1479
1487
  pluginYaml,
1488
+ presetAll,
1489
+ presetBasic,
1490
+ presetCommon,
1491
+ presetJavaScript,
1492
+ presetJsonc,
1493
+ presetLanguageExtensions,
1480
1494
  prettier,
1481
1495
  sortPackageJson,
1482
1496
  sortTsConfig,
package/dist/index.d.cts CHANGED
@@ -21,6 +21,7 @@ export { default as tseslint } from 'typescript-eslint';
21
21
 
22
22
  declare const hasTypeScript: boolean;
23
23
  declare const hasVue: boolean;
24
+ declare const hasUnoCSS: boolean;
24
25
 
25
26
  /**
26
27
  * @file globs constants
@@ -53,20 +54,34 @@ declare const GLOB_EXCLUDE: string[];
53
54
  */
54
55
 
55
56
  /**
56
- * only js and ts
57
+ * JavaScript preset
57
58
  */
58
- declare const basic: FlatESLintConfig[];
59
- declare const common: FlatESLintConfig[];
59
+ declare const presetJavaScript: FlatESLintConfig[];
60
60
  /**
61
- * all supported framework
61
+ * JavaScript & TypeScript
62
62
  */
63
- declare const all: FlatESLintConfig[];
63
+ declare const presetBasic: FlatESLintConfig[];
64
+ /**
65
+ * JSON and sort json keys
66
+ */
67
+ declare const presetJsonc: FlatESLintConfig[];
68
+ /**
69
+ * JSON YAML Markdown
70
+ */
71
+ declare const presetLanguageExtensions: FlatESLintConfig[];
72
+ declare const presetCommon: FlatESLintConfig[];
73
+ /**
74
+ * All supported framework
75
+ */
76
+ declare const presetAll: FlatESLintConfig[];
64
77
  /**
65
78
  * custom framework support
66
79
  */
67
- declare function ntnyq(config?: FlatESLintConfig | FlatESLintConfig[], { vue: enableVue, unocss: enableUnoCSS }?: {
80
+ declare function ntnyq(config?: FlatESLintConfig | FlatESLintConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
68
81
  vue?: boolean | undefined;
69
82
  unocss?: boolean | undefined;
83
+ prettier?: boolean | undefined;
84
+ markdown?: boolean | undefined;
70
85
  }): FlatESLintConfig[];
71
86
 
72
87
  declare function getVueVersion(): number;
@@ -112,4 +127,4 @@ type InteropDefault<T> = T extends {
112
127
  } ? U : T;
113
128
  declare function interopDefault<T>(m: T): InteropDefault<T>;
114
129
 
115
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, all, basic, comments, common, getVueVersion, hasTypeScript, hasVue, ignores, imports, interopDefault, javascript, jsonc, jsx, markdown, node, ntnyq, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
130
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, comments, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { default as tseslint } from 'typescript-eslint';
21
21
 
22
22
  declare const hasTypeScript: boolean;
23
23
  declare const hasVue: boolean;
24
+ declare const hasUnoCSS: boolean;
24
25
 
25
26
  /**
26
27
  * @file globs constants
@@ -53,20 +54,34 @@ declare const GLOB_EXCLUDE: string[];
53
54
  */
54
55
 
55
56
  /**
56
- * only js and ts
57
+ * JavaScript preset
57
58
  */
58
- declare const basic: FlatESLintConfig[];
59
- declare const common: FlatESLintConfig[];
59
+ declare const presetJavaScript: FlatESLintConfig[];
60
60
  /**
61
- * all supported framework
61
+ * JavaScript & TypeScript
62
62
  */
63
- declare const all: FlatESLintConfig[];
63
+ declare const presetBasic: FlatESLintConfig[];
64
+ /**
65
+ * JSON and sort json keys
66
+ */
67
+ declare const presetJsonc: FlatESLintConfig[];
68
+ /**
69
+ * JSON YAML Markdown
70
+ */
71
+ declare const presetLanguageExtensions: FlatESLintConfig[];
72
+ declare const presetCommon: FlatESLintConfig[];
73
+ /**
74
+ * All supported framework
75
+ */
76
+ declare const presetAll: FlatESLintConfig[];
64
77
  /**
65
78
  * custom framework support
66
79
  */
67
- declare function ntnyq(config?: FlatESLintConfig | FlatESLintConfig[], { vue: enableVue, unocss: enableUnoCSS }?: {
80
+ declare function ntnyq(config?: FlatESLintConfig | FlatESLintConfig[], { vue: enableVue, unocss: enableUnoCSS, prettier: enablePrettier, markdown: enableMarkdown, }?: {
68
81
  vue?: boolean | undefined;
69
82
  unocss?: boolean | undefined;
83
+ prettier?: boolean | undefined;
84
+ markdown?: boolean | undefined;
70
85
  }): FlatESLintConfig[];
71
86
 
72
87
  declare function getVueVersion(): number;
@@ -112,4 +127,4 @@ type InteropDefault<T> = T extends {
112
127
  } ? U : T;
113
128
  declare function interopDefault<T>(m: T): InteropDefault<T>;
114
129
 
115
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, all, basic, comments, common, getVueVersion, hasTypeScript, hasVue, ignores, imports, interopDefault, javascript, jsonc, jsx, markdown, node, ntnyq, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
130
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropDefault, comments, getVueVersion, hasTypeScript, hasUnoCSS, hasVue, ignores, imports, interopDefault, javascript, jsonc, jsx, markdown, node, ntnyq, presetAll, presetBasic, presetCommon, presetJavaScript, presetJsonc, presetLanguageExtensions, prettier, sortPackageJson, sortTsConfig, typescript, typescriptCore, unicorn, unocss, vue, yml };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { isPackageExists } from "local-pkg";
3
3
  var hasTypeScript = isPackageExists("typescript");
4
4
  var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli");
5
+ var hasUnoCSS = isPackageExists("unocss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
5
6
 
6
7
  // src/globs.ts
7
8
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -1295,34 +1296,39 @@ var ignores = defineFlatConfig14([
1295
1296
  ]);
1296
1297
 
1297
1298
  // src/presets.ts
1298
- var basic = defineFlatConfig15([
1299
+ var presetJavaScript = [
1299
1300
  ...ignores,
1300
1301
  ...javascript,
1301
1302
  ...jsx,
1302
1303
  ...node,
1303
- ...typescript,
1304
1304
  ...imports,
1305
1305
  ...unicorn,
1306
1306
  ...comments
1307
- ]);
1308
- var common = defineFlatConfig15([
1309
- ...basic,
1310
- ...yml,
1311
- ...jsonc,
1312
- ...sortPackageJson,
1313
- ...sortTsConfig,
1314
- ...prettier,
1315
- ...markdown
1316
- ]);
1317
- var all = defineFlatConfig15([...common, ...vue, ...unocss]);
1318
- function ntnyq(config = [], { vue: enableVue = false, unocss: enableUnoCSS = false } = {}) {
1319
- const configs = defineFlatConfig15([...common]);
1307
+ ];
1308
+ var presetBasic = [...presetJavaScript, ...typescript];
1309
+ var presetJsonc = [...jsonc, ...sortPackageJson, ...sortTsConfig];
1310
+ var presetLanguageExtensions = [...presetJsonc, ...yml, ...markdown];
1311
+ var presetCommon = [...presetBasic, ...presetLanguageExtensions, ...prettier];
1312
+ var presetAll = [...presetCommon, ...vue, ...unocss];
1313
+ function ntnyq(config = [], {
1314
+ vue: enableVue = hasVue,
1315
+ unocss: enableUnoCSS = hasUnoCSS,
1316
+ prettier: enablePrettier = true,
1317
+ markdown: enableMarkdown = true
1318
+ } = {}) {
1319
+ const configs = defineFlatConfig15([...presetBasic, ...yml, ...presetJsonc]);
1320
1320
  if (enableVue) {
1321
1321
  configs.push(...vue);
1322
1322
  }
1323
1323
  if (enableUnoCSS) {
1324
1324
  configs.push(...unocss);
1325
1325
  }
1326
+ if (enablePrettier) {
1327
+ configs.push(...prettier);
1328
+ }
1329
+ if (enableMarkdown) {
1330
+ configs.push(...markdown);
1331
+ }
1326
1332
  if (Object.keys(config).length > 0) {
1327
1333
  configs.push(...Array.isArray(config) ? config : [config]);
1328
1334
  }
@@ -1351,12 +1357,10 @@ export {
1351
1357
  GLOB_TSX,
1352
1358
  GLOB_VUE,
1353
1359
  GLOB_YAML,
1354
- all,
1355
- basic,
1356
1360
  comments,
1357
- common,
1358
1361
  getVueVersion,
1359
1362
  hasTypeScript,
1363
+ hasUnoCSS,
1360
1364
  hasVue,
1361
1365
  ignores,
1362
1366
  imports,
@@ -1380,6 +1384,12 @@ export {
1380
1384
  default4 as pluginUnoCSS,
1381
1385
  default3 as pluginVue,
1382
1386
  default9 as pluginYaml,
1387
+ presetAll,
1388
+ presetBasic,
1389
+ presetCommon,
1390
+ presetJavaScript,
1391
+ presetJsonc,
1392
+ presetLanguageExtensions,
1383
1393
  prettier,
1384
1394
  sortPackageJson,
1385
1395
  sortTsConfig,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.27",
4
+ "version": "2.0.0-beta.28",
5
5
  "description": "ESLint flat config of ntnyq",
6
6
  "keywords": [
7
7
  "eslint",