@lincy/eslint-config 3.0.9 → 3.0.11

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
@@ -80,6 +80,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
80
80
 
81
81
  // src/factory.ts
82
82
  var import_node_process2 = __toESM(require("process"), 1);
83
+ var import_node_fs = __toESM(require("fs"), 1);
83
84
 
84
85
  // node_modules/.pnpm/local-pkg@0.4.3/node_modules/local-pkg/index.mjs
85
86
  var import_path = require("path");
@@ -137,6 +138,9 @@ function searchPackageJSON(dir) {
137
138
  return packageJsonPath;
138
139
  }
139
140
 
141
+ // src/factory.ts
142
+ var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
143
+
140
144
  // src/flags.ts
141
145
  var OFF = 0;
142
146
 
@@ -276,9 +280,6 @@ function javascript(options = {}) {
276
280
  "array-callback-return": "error",
277
281
  "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
278
282
  "block-scoped-var": "error",
279
- "camelcase": OFF,
280
- "complexity": OFF,
281
- "consistent-return": OFF,
282
283
  "constructor-super": "error",
283
284
  "default-case-last": "error",
284
285
  "dot-notation": ["error", { allowKeywords: true }],
@@ -287,7 +288,7 @@ function javascript(options = {}) {
287
288
  "max-statements-per-line": ["error", { max: 1 }],
288
289
  "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
289
290
  "new-parens": "error",
290
- "no-alert": "warn",
291
+ "no-alert": "error",
291
292
  "no-array-constructor": "error",
292
293
  "no-async-promise-executor": "error",
293
294
  "no-caller": "error",
@@ -346,7 +347,6 @@ function javascript(options = {}) {
346
347
  "no-obj-calls": "error",
347
348
  "no-octal": "error",
348
349
  "no-octal-escape": "error",
349
- "no-param-reassign": OFF,
350
350
  "no-proto": "error",
351
351
  "no-prototype-builtins": "error",
352
352
  "no-redeclare": ["error", { builtinGlobals: false }],
@@ -370,8 +370,6 @@ function javascript(options = {}) {
370
370
  "LabeledStatement",
371
371
  "WithStatement"
372
372
  ],
373
- "no-return-assign": OFF,
374
- "no-return-await": OFF,
375
373
  "no-self-assign": ["error", { props: true }],
376
374
  "no-self-compare": "error",
377
375
  "no-sequences": "error",
@@ -406,7 +404,6 @@ function javascript(options = {}) {
406
404
  "no-useless-catch": "error",
407
405
  "no-useless-computed-key": "error",
408
406
  "no-useless-constructor": "error",
409
- "no-useless-escape": OFF,
410
407
  "no-useless-rename": "error",
411
408
  "no-useless-return": "error",
412
409
  "no-var": "error",
@@ -442,7 +439,6 @@ function javascript(options = {}) {
442
439
  "prefer-spread": "error",
443
440
  "prefer-template": "error",
444
441
  "quote-props": ["error", "consistent-as-needed"],
445
- "require-await": OFF,
446
442
  "sort-imports": [
447
443
  "error",
448
444
  {
@@ -457,7 +453,7 @@ function javascript(options = {}) {
457
453
  "unicode-bom": ["error", "never"],
458
454
  "unused-imports/no-unused-imports": options.isInEditor ? OFF : "error",
459
455
  "unused-imports/no-unused-vars": [
460
- "warn",
456
+ "error",
461
457
  { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
462
458
  ],
463
459
  "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
@@ -468,7 +464,7 @@ function javascript(options = {}) {
468
464
  }
469
465
  },
470
466
  {
471
- files: ["scripts/**/*.*", "cli.*"],
467
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
472
468
  rules: {
473
469
  "no-console": OFF
474
470
  }
@@ -818,6 +814,7 @@ var javascriptStylistic = [
818
814
  style: import_eslint_plugin_js.default
819
815
  },
820
816
  rules: {
817
+ "antfu/consistent-list-newline": "error",
821
818
  "antfu/if-newline": "error",
822
819
  "comma-dangle": ["error", "always-multiline"],
823
820
  "curly": ["error", "multi-or-nest", "consistent"],
@@ -1017,7 +1014,6 @@ function typescript(options) {
1017
1014
  "no-redeclare": OFF,
1018
1015
  "no-use-before-define": OFF,
1019
1016
  "no-useless-constructor": OFF,
1020
- // TS
1021
1017
  "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1022
1018
  "ts/ban-ts-ignore": OFF,
1023
1019
  "ts/consistent-indexed-object-style": OFF,
@@ -1028,22 +1024,23 @@ function typescript(options) {
1028
1024
  "ts/explicit-module-boundary-types": OFF,
1029
1025
  "ts/naming-convention": OFF,
1030
1026
  "ts/no-dupe-class-members": "error",
1027
+ "ts/no-dynamic-delete": OFF,
1031
1028
  "ts/no-empty-function": OFF,
1032
1029
  "ts/no-empty-interface": OFF,
1033
1030
  "ts/no-explicit-any": OFF,
1034
1031
  "ts/no-extra-parens": ["error", "functions"],
1035
1032
  "ts/no-invalid-this": "error",
1036
- "ts/no-loss-of-precision": "error",
1037
1033
  "ts/no-invalid-void-type": OFF,
1034
+ "ts/no-loss-of-precision": "error",
1038
1035
  "ts/no-non-null-assertion": OFF,
1039
1036
  "ts/no-redeclare": "error",
1040
1037
  "ts/no-require-imports": "error",
1041
- "ts/unified-signatures": OFF,
1042
1038
  "ts/no-unused-vars": OFF,
1043
1039
  "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
1044
1040
  "ts/parameter-properties": OFF,
1045
1041
  "ts/prefer-ts-expect-error": "error",
1046
- "ts/triple-slash-reference": OFF
1042
+ "ts/triple-slash-reference": OFF,
1043
+ "ts/unified-signatures": OFF
1047
1044
  }
1048
1045
  },
1049
1046
  {
@@ -1097,7 +1094,6 @@ function typescriptWithLanguageServer(options) {
1097
1094
  "dot-notation": OFF,
1098
1095
  "no-implied-eval": OFF,
1099
1096
  "no-throw-literal": OFF,
1100
- "require-await": OFF,
1101
1097
  "ts/await-thenable": "error",
1102
1098
  "ts/dot-notation": ["error", { allowKeywords: true }],
1103
1099
  "ts/no-floating-promises": "error",
@@ -1111,7 +1107,6 @@ function typescriptWithLanguageServer(options) {
1111
1107
  "ts/no-unsafe-call": "error",
1112
1108
  "ts/no-unsafe-member-access": "error",
1113
1109
  "ts/no-unsafe-return": "error",
1114
- "ts/require-await": "error",
1115
1110
  "ts/restrict-plus-operands": "error",
1116
1111
  "ts/restrict-template-expressions": "error",
1117
1112
  "ts/unbound-method": "error"
@@ -1194,6 +1189,7 @@ function vue(options = {}) {
1194
1189
  ...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
1195
1190
  ...import_eslint_plugin_vue.default.configs.recommended.rules
1196
1191
  },
1192
+ "node/prefer-global/process": OFF,
1197
1193
  "vue/array-bracket-spacing": ["error", "never"],
1198
1194
  "vue/arrow-spacing": ["error", { after: true, before: true }],
1199
1195
  "vue/block-order": ["error", {
@@ -1218,24 +1214,24 @@ function vue(options = {}) {
1218
1214
  "vue/dot-location": ["error", "property"],
1219
1215
  "vue/dot-notation": ["error", { allowKeywords: true }],
1220
1216
  "vue/eqeqeq": ["error", "smart"],
1217
+ "vue/html-comment-content-spacing": ["error", "always", {
1218
+ exceptions: ["-"]
1219
+ }],
1221
1220
  "vue/html-indent": ["error", 4, {
1221
+ alignAttributesVertically: true,
1222
1222
  attribute: 1,
1223
1223
  baseIndent: 1,
1224
1224
  closeBracket: 0,
1225
- alignAttributesVertically: true,
1226
1225
  ignores: []
1227
1226
  }],
1228
- "vue/html-comment-content-spacing": ["error", "always", {
1229
- exceptions: ["-"]
1230
- }],
1231
1227
  "vue/html-self-closing": ["error", {
1232
1228
  html: {
1233
- void: "never",
1229
+ component: "any",
1234
1230
  normal: "any",
1235
- component: "any"
1231
+ void: "never"
1236
1232
  },
1237
- svg: "always",
1238
- math: "always"
1233
+ math: "always",
1234
+ svg: "always"
1239
1235
  }],
1240
1236
  "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1241
1237
  "vue/keyword-spacing": ["error", { after: true, before: true }],
@@ -1254,7 +1250,6 @@ function vue(options = {}) {
1254
1250
  "WithStatement"
1255
1251
  ],
1256
1252
  "vue/no-restricted-v-bind": ["error", "/^v-/"],
1257
- // reactivity transform
1258
1253
  "vue/no-setup-props-reactivity-loss": OFF,
1259
1254
  "vue/no-sparse-arrays": "error",
1260
1255
  "vue/no-unused-refs": "error",
@@ -1279,11 +1274,11 @@ function vue(options = {}) {
1279
1274
  "vue/quote-props": ["error", "consistent-as-needed"],
1280
1275
  "vue/require-default-prop": OFF,
1281
1276
  "vue/require-prop-types": OFF,
1277
+ "vue/singleline-html-element-content-newline": "off",
1282
1278
  "vue/space-in-parens": ["error", "never"],
1283
1279
  "vue/space-infix-ops": "error",
1284
1280
  "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1285
- "vue/template-curly-spacing": "error",
1286
- "vue/singleline-html-element-content-newline": "off"
1281
+ "vue/template-curly-spacing": "error"
1287
1282
  }
1288
1283
  }
1289
1284
  ];
@@ -1325,12 +1320,32 @@ function test(options = {}) {
1325
1320
  }
1326
1321
 
1327
1322
  // src/factory.ts
1323
+ var flatConfigProps = [
1324
+ "files",
1325
+ "ignores",
1326
+ "languageOptions",
1327
+ "linterOptions",
1328
+ "processor",
1329
+ "plugins",
1330
+ "rules",
1331
+ "settings"
1332
+ ];
1328
1333
  function lincy(options = {}, ...userConfigs) {
1329
1334
  const isInEditor = options.isInEditor ?? !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE) && !import_node_process2.default.env.CI);
1330
1335
  const enableVue = options.vue ?? (isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli"));
1331
1336
  const enableTypeScript = options.typescript ?? isPackageExists("typescript");
1332
1337
  const enableStylistic = options.stylistic ?? true;
1333
- const configs = [
1338
+ const enableGitignore = options.gitignore ?? true;
1339
+ const configs = [];
1340
+ if (enableGitignore) {
1341
+ if (typeof enableGitignore !== "boolean") {
1342
+ configs.push([(0, import_eslint_config_flat_gitignore.default)(enableGitignore)]);
1343
+ } else {
1344
+ if (import_node_fs.default.existsSync(".gitignore"))
1345
+ configs.push([(0, import_eslint_config_flat_gitignore.default)()]);
1346
+ }
1347
+ }
1348
+ configs.push(
1334
1349
  ignores,
1335
1350
  javascript({ isInEditor }),
1336
1351
  comments,
@@ -1338,7 +1353,7 @@ function lincy(options = {}, ...userConfigs) {
1338
1353
  jsdoc,
1339
1354
  imports,
1340
1355
  unicorn
1341
- ];
1356
+ );
1342
1357
  const componentExts = [];
1343
1358
  if (enableVue)
1344
1359
  componentExts.push("vue");
@@ -1370,6 +1385,13 @@ function lincy(options = {}, ...userConfigs) {
1370
1385
  configs.push(yml);
1371
1386
  if (options.markdown ?? true)
1372
1387
  configs.push(markdown({ componentExts }));
1388
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
1389
+ if (key in options)
1390
+ acc[key] = options[key];
1391
+ return acc;
1392
+ }, {});
1393
+ if (Object.keys(fusedConfig).length)
1394
+ configs.push([fusedConfig]);
1373
1395
  return combine(
1374
1396
  ...configs,
1375
1397
  ...userConfigs
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
+ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
2
3
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
3
4
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
4
5
  export { default as pluginImport } from 'eslint-plugin-i';
@@ -39,6 +40,15 @@ interface OptionsIsInEditor {
39
40
  isInEditor?: boolean;
40
41
  }
41
42
  interface OptionsConfig {
43
+ /**
44
+ * Enable gitignore support.
45
+ *
46
+ * Passing an object to configure the options.
47
+ *
48
+ * @see https://github.com/antfu/eslint-config-flat-gitignore
49
+ * @default true
50
+ */
51
+ gitignore?: boolean | FlatGitignoreOptions;
42
52
  /**
43
53
  * Enable TypeScript support.
44
54
  *
@@ -93,7 +103,7 @@ interface OptionsConfig {
93
103
  /**
94
104
  * Construct an array of ESLint flat config items.
95
105
  */
96
- declare function lincy(options?: OptionsConfig, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
106
+ declare function lincy(options?: OptionsConfig & FlatESLintConfigItem, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
97
107
 
98
108
  declare const comments: FlatESLintConfigItem[];
99
109
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
+ import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
2
3
  export { default as pluginAntfu } from 'eslint-plugin-antfu';
3
4
  export { default as pluginComments } from 'eslint-plugin-eslint-comments';
4
5
  export { default as pluginImport } from 'eslint-plugin-i';
@@ -39,6 +40,15 @@ interface OptionsIsInEditor {
39
40
  isInEditor?: boolean;
40
41
  }
41
42
  interface OptionsConfig {
43
+ /**
44
+ * Enable gitignore support.
45
+ *
46
+ * Passing an object to configure the options.
47
+ *
48
+ * @see https://github.com/antfu/eslint-config-flat-gitignore
49
+ * @default true
50
+ */
51
+ gitignore?: boolean | FlatGitignoreOptions;
42
52
  /**
43
53
  * Enable TypeScript support.
44
54
  *
@@ -93,7 +103,7 @@ interface OptionsConfig {
93
103
  /**
94
104
  * Construct an array of ESLint flat config items.
95
105
  */
96
- declare function lincy(options?: OptionsConfig, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
106
+ declare function lincy(options?: OptionsConfig & FlatESLintConfigItem, ...userConfigs: (FlatESLintConfigItem | FlatESLintConfigItem[])[]): FlatESLintConfigItem[];
97
107
 
98
108
  declare const comments: FlatESLintConfigItem[];
99
109
 
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/factory.ts
2
2
  import process2 from "process";
3
+ import fs2 from "fs";
3
4
 
4
5
  // node_modules/.pnpm/local-pkg@0.4.3/node_modules/local-pkg/index.mjs
5
6
  import { dirname, join } from "path";
@@ -57,6 +58,9 @@ function searchPackageJSON(dir) {
57
58
  return packageJsonPath;
58
59
  }
59
60
 
61
+ // src/factory.ts
62
+ import gitignore from "eslint-config-flat-gitignore";
63
+
60
64
  // src/flags.ts
61
65
  var OFF = 0;
62
66
 
@@ -196,9 +200,6 @@ function javascript(options = {}) {
196
200
  "array-callback-return": "error",
197
201
  "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
198
202
  "block-scoped-var": "error",
199
- "camelcase": OFF,
200
- "complexity": OFF,
201
- "consistent-return": OFF,
202
203
  "constructor-super": "error",
203
204
  "default-case-last": "error",
204
205
  "dot-notation": ["error", { allowKeywords: true }],
@@ -207,7 +208,7 @@ function javascript(options = {}) {
207
208
  "max-statements-per-line": ["error", { max: 1 }],
208
209
  "new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
209
210
  "new-parens": "error",
210
- "no-alert": "warn",
211
+ "no-alert": "error",
211
212
  "no-array-constructor": "error",
212
213
  "no-async-promise-executor": "error",
213
214
  "no-caller": "error",
@@ -266,7 +267,6 @@ function javascript(options = {}) {
266
267
  "no-obj-calls": "error",
267
268
  "no-octal": "error",
268
269
  "no-octal-escape": "error",
269
- "no-param-reassign": OFF,
270
270
  "no-proto": "error",
271
271
  "no-prototype-builtins": "error",
272
272
  "no-redeclare": ["error", { builtinGlobals: false }],
@@ -290,8 +290,6 @@ function javascript(options = {}) {
290
290
  "LabeledStatement",
291
291
  "WithStatement"
292
292
  ],
293
- "no-return-assign": OFF,
294
- "no-return-await": OFF,
295
293
  "no-self-assign": ["error", { props: true }],
296
294
  "no-self-compare": "error",
297
295
  "no-sequences": "error",
@@ -326,7 +324,6 @@ function javascript(options = {}) {
326
324
  "no-useless-catch": "error",
327
325
  "no-useless-computed-key": "error",
328
326
  "no-useless-constructor": "error",
329
- "no-useless-escape": OFF,
330
327
  "no-useless-rename": "error",
331
328
  "no-useless-return": "error",
332
329
  "no-var": "error",
@@ -362,7 +359,6 @@ function javascript(options = {}) {
362
359
  "prefer-spread": "error",
363
360
  "prefer-template": "error",
364
361
  "quote-props": ["error", "consistent-as-needed"],
365
- "require-await": OFF,
366
362
  "sort-imports": [
367
363
  "error",
368
364
  {
@@ -377,7 +373,7 @@ function javascript(options = {}) {
377
373
  "unicode-bom": ["error", "never"],
378
374
  "unused-imports/no-unused-imports": options.isInEditor ? OFF : "error",
379
375
  "unused-imports/no-unused-vars": [
380
- "warn",
376
+ "error",
381
377
  { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
382
378
  ],
383
379
  "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
@@ -388,7 +384,7 @@ function javascript(options = {}) {
388
384
  }
389
385
  },
390
386
  {
391
- files: ["scripts/**/*.*", "cli.*"],
387
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
392
388
  rules: {
393
389
  "no-console": OFF
394
390
  }
@@ -738,6 +734,7 @@ var javascriptStylistic = [
738
734
  style: default9
739
735
  },
740
736
  rules: {
737
+ "antfu/consistent-list-newline": "error",
741
738
  "antfu/if-newline": "error",
742
739
  "comma-dangle": ["error", "always-multiline"],
743
740
  "curly": ["error", "multi-or-nest", "consistent"],
@@ -937,7 +934,6 @@ function typescript(options) {
937
934
  "no-redeclare": OFF,
938
935
  "no-use-before-define": OFF,
939
936
  "no-useless-constructor": OFF,
940
- // TS
941
937
  "ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
942
938
  "ts/ban-ts-ignore": OFF,
943
939
  "ts/consistent-indexed-object-style": OFF,
@@ -948,22 +944,23 @@ function typescript(options) {
948
944
  "ts/explicit-module-boundary-types": OFF,
949
945
  "ts/naming-convention": OFF,
950
946
  "ts/no-dupe-class-members": "error",
947
+ "ts/no-dynamic-delete": OFF,
951
948
  "ts/no-empty-function": OFF,
952
949
  "ts/no-empty-interface": OFF,
953
950
  "ts/no-explicit-any": OFF,
954
951
  "ts/no-extra-parens": ["error", "functions"],
955
952
  "ts/no-invalid-this": "error",
956
- "ts/no-loss-of-precision": "error",
957
953
  "ts/no-invalid-void-type": OFF,
954
+ "ts/no-loss-of-precision": "error",
958
955
  "ts/no-non-null-assertion": OFF,
959
956
  "ts/no-redeclare": "error",
960
957
  "ts/no-require-imports": "error",
961
- "ts/unified-signatures": OFF,
962
958
  "ts/no-unused-vars": OFF,
963
959
  "ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
964
960
  "ts/parameter-properties": OFF,
965
961
  "ts/prefer-ts-expect-error": "error",
966
- "ts/triple-slash-reference": OFF
962
+ "ts/triple-slash-reference": OFF,
963
+ "ts/unified-signatures": OFF
967
964
  }
968
965
  },
969
966
  {
@@ -1017,7 +1014,6 @@ function typescriptWithLanguageServer(options) {
1017
1014
  "dot-notation": OFF,
1018
1015
  "no-implied-eval": OFF,
1019
1016
  "no-throw-literal": OFF,
1020
- "require-await": OFF,
1021
1017
  "ts/await-thenable": "error",
1022
1018
  "ts/dot-notation": ["error", { allowKeywords: true }],
1023
1019
  "ts/no-floating-promises": "error",
@@ -1031,7 +1027,6 @@ function typescriptWithLanguageServer(options) {
1031
1027
  "ts/no-unsafe-call": "error",
1032
1028
  "ts/no-unsafe-member-access": "error",
1033
1029
  "ts/no-unsafe-return": "error",
1034
- "ts/require-await": "error",
1035
1030
  "ts/restrict-plus-operands": "error",
1036
1031
  "ts/restrict-template-expressions": "error",
1037
1032
  "ts/unbound-method": "error"
@@ -1114,6 +1109,7 @@ function vue(options = {}) {
1114
1109
  ...default14.configs["strongly-recommended"].rules,
1115
1110
  ...default14.configs.recommended.rules
1116
1111
  },
1112
+ "node/prefer-global/process": OFF,
1117
1113
  "vue/array-bracket-spacing": ["error", "never"],
1118
1114
  "vue/arrow-spacing": ["error", { after: true, before: true }],
1119
1115
  "vue/block-order": ["error", {
@@ -1138,24 +1134,24 @@ function vue(options = {}) {
1138
1134
  "vue/dot-location": ["error", "property"],
1139
1135
  "vue/dot-notation": ["error", { allowKeywords: true }],
1140
1136
  "vue/eqeqeq": ["error", "smart"],
1137
+ "vue/html-comment-content-spacing": ["error", "always", {
1138
+ exceptions: ["-"]
1139
+ }],
1141
1140
  "vue/html-indent": ["error", 4, {
1141
+ alignAttributesVertically: true,
1142
1142
  attribute: 1,
1143
1143
  baseIndent: 1,
1144
1144
  closeBracket: 0,
1145
- alignAttributesVertically: true,
1146
1145
  ignores: []
1147
1146
  }],
1148
- "vue/html-comment-content-spacing": ["error", "always", {
1149
- exceptions: ["-"]
1150
- }],
1151
1147
  "vue/html-self-closing": ["error", {
1152
1148
  html: {
1153
- void: "never",
1149
+ component: "any",
1154
1150
  normal: "any",
1155
- component: "any"
1151
+ void: "never"
1156
1152
  },
1157
- svg: "always",
1158
- math: "always"
1153
+ math: "always",
1154
+ svg: "always"
1159
1155
  }],
1160
1156
  "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
1161
1157
  "vue/keyword-spacing": ["error", { after: true, before: true }],
@@ -1174,7 +1170,6 @@ function vue(options = {}) {
1174
1170
  "WithStatement"
1175
1171
  ],
1176
1172
  "vue/no-restricted-v-bind": ["error", "/^v-/"],
1177
- // reactivity transform
1178
1173
  "vue/no-setup-props-reactivity-loss": OFF,
1179
1174
  "vue/no-sparse-arrays": "error",
1180
1175
  "vue/no-unused-refs": "error",
@@ -1199,11 +1194,11 @@ function vue(options = {}) {
1199
1194
  "vue/quote-props": ["error", "consistent-as-needed"],
1200
1195
  "vue/require-default-prop": OFF,
1201
1196
  "vue/require-prop-types": OFF,
1197
+ "vue/singleline-html-element-content-newline": "off",
1202
1198
  "vue/space-in-parens": ["error", "never"],
1203
1199
  "vue/space-infix-ops": "error",
1204
1200
  "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
1205
- "vue/template-curly-spacing": "error",
1206
- "vue/singleline-html-element-content-newline": "off"
1201
+ "vue/template-curly-spacing": "error"
1207
1202
  }
1208
1203
  }
1209
1204
  ];
@@ -1245,12 +1240,32 @@ function test(options = {}) {
1245
1240
  }
1246
1241
 
1247
1242
  // src/factory.ts
1243
+ var flatConfigProps = [
1244
+ "files",
1245
+ "ignores",
1246
+ "languageOptions",
1247
+ "linterOptions",
1248
+ "processor",
1249
+ "plugins",
1250
+ "rules",
1251
+ "settings"
1252
+ ];
1248
1253
  function lincy(options = {}, ...userConfigs) {
1249
1254
  const isInEditor = options.isInEditor ?? !!((process2.env.VSCODE_PID || process2.env.JETBRAINS_IDE) && !process2.env.CI);
1250
1255
  const enableVue = options.vue ?? (isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli"));
1251
1256
  const enableTypeScript = options.typescript ?? isPackageExists("typescript");
1252
1257
  const enableStylistic = options.stylistic ?? true;
1253
- const configs = [
1258
+ const enableGitignore = options.gitignore ?? true;
1259
+ const configs = [];
1260
+ if (enableGitignore) {
1261
+ if (typeof enableGitignore !== "boolean") {
1262
+ configs.push([gitignore(enableGitignore)]);
1263
+ } else {
1264
+ if (fs2.existsSync(".gitignore"))
1265
+ configs.push([gitignore()]);
1266
+ }
1267
+ }
1268
+ configs.push(
1254
1269
  ignores,
1255
1270
  javascript({ isInEditor }),
1256
1271
  comments,
@@ -1258,7 +1273,7 @@ function lincy(options = {}, ...userConfigs) {
1258
1273
  jsdoc,
1259
1274
  imports,
1260
1275
  unicorn
1261
- ];
1276
+ );
1262
1277
  const componentExts = [];
1263
1278
  if (enableVue)
1264
1279
  componentExts.push("vue");
@@ -1290,6 +1305,13 @@ function lincy(options = {}, ...userConfigs) {
1290
1305
  configs.push(yml);
1291
1306
  if (options.markdown ?? true)
1292
1307
  configs.push(markdown({ componentExts }));
1308
+ const fusedConfig = flatConfigProps.reduce((acc, key) => {
1309
+ if (key in options)
1310
+ acc[key] = options[key];
1311
+ return acc;
1312
+ }, {});
1313
+ if (Object.keys(fusedConfig).length)
1314
+ configs.push([fusedConfig]);
1293
1315
  return combine(
1294
1316
  ...configs,
1295
1317
  ...userConfigs
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "3.0.9",
4
+ "version": "3.0.11",
5
5
  "packageManager": "pnpm@8.7.6",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
@@ -10,18 +10,25 @@
10
10
  "keywords": [
11
11
  "eslint-config"
12
12
  ],
13
- "main": "dist/index.cjs",
14
- "module": "dist/index.js",
15
- "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "main": "./dist/index.cjs",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
16
23
  "files": [
17
24
  "dist"
18
25
  ],
19
26
  "scripts": {
20
27
  "build": "tsup src/index.ts --format esm,cjs --shims --clean --dts",
21
- "stub": "tsup src/index.ts --format esm,cjs --shims --clean",
28
+ "stub": "tsup src/index.ts --format esm",
22
29
  "lint": "pnpm run stub && eslint .",
23
30
  "lint:fix": "eslint . --fix",
24
- "postpublish": "open https://npmmirror.com/package/@lincy/eslint-config",
31
+ "postpublish": "simple-open-url https://npmmirror.com/package/@lincy/eslint-config",
25
32
  "prepublishOnly": "nr build",
26
33
  "release": "bumpp && npm publish -r --access public",
27
34
  "test": "vitest",
@@ -33,13 +40,14 @@
33
40
  },
34
41
  "dependencies": {
35
42
  "@eslint-stylistic/metadata": "0.0.4",
36
- "@eslint/js": "^8.49.0",
43
+ "@eslint/js": "^8.50.0",
37
44
  "@stylistic/eslint-plugin-js": "0.0.4",
38
45
  "@stylistic/eslint-plugin-ts": "0.0.4",
39
46
  "@typescript-eslint/eslint-plugin": "^6.7.2",
40
47
  "@typescript-eslint/parser": "^6.7.2",
48
+ "eslint-config-flat-gitignore": "^0.1.0",
41
49
  "eslint-define-config": "^1.23.0",
42
- "eslint-plugin-antfu": "1.0.0-beta.3",
50
+ "eslint-plugin-antfu": "1.0.0-beta.6",
43
51
  "eslint-plugin-eslint-comments": "^3.2.0",
44
52
  "eslint-plugin-i": "^2.28.1",
45
53
  "eslint-plugin-jsdoc": "^46.8.2",
@@ -60,15 +68,16 @@
60
68
  "@antfu/ni": "^0.21.8",
61
69
  "@lincy/eslint-config": "workspace:*",
62
70
  "@stylistic/eslint-plugin-migrate": "0.0.4",
63
- "@types/node": "^20.6.3",
71
+ "@types/node": "^20.6.5",
64
72
  "bumpp": "^9.2.0",
65
- "eslint": "^8.49.0",
73
+ "eslint": "^8.50.0",
66
74
  "eslint-plugin-sort-keys": "^2.3.5",
67
75
  "esno": "^0.17.0",
68
76
  "lint-staged": "^14.0.1",
69
77
  "local-pkg": "^0.4.3",
70
78
  "rimraf": "^5.0.1",
71
79
  "simple-git-hooks": "^2.9.0",
80
+ "simple-open-url": "^3.0.1",
72
81
  "sucrase": "^3.34.0",
73
82
  "tsup": "^7.2.0",
74
83
  "typescript": "^5.2.2",