@lincy/eslint-config 5.2.7 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -66,6 +66,7 @@ __export(src_exports, {
66
66
  disables: () => disables,
67
67
  ensurePackages: () => ensurePackages,
68
68
  formatters: () => formatters,
69
+ getOverrides: () => getOverrides,
69
70
  ignores: () => ignores,
70
71
  imports: () => imports,
71
72
  interopDefault: () => interopDefault,
@@ -85,6 +86,7 @@ __export(src_exports, {
85
86
  regexp: () => regexp,
86
87
  renamePluginInConfigs: () => renamePluginInConfigs,
87
88
  renameRules: () => renameRules,
89
+ resolveSubOptions: () => resolveSubOptions,
88
90
  sortPackageJson: () => sortPackageJson,
89
91
  sortTsconfig: () => sortTsconfig,
90
92
  stylistic: () => stylistic,
@@ -99,7 +101,7 @@ __export(src_exports, {
99
101
  });
100
102
  module.exports = __toCommonJS(src_exports);
101
103
 
102
- // node_modules/.pnpm/tsup@8.3.5_jiti@2.3.3_postcss@8.4.47_tsx@4.19.2_typescript@5.6.3_yaml@2.6.0/node_modules/tsup/assets/cjs_shims.js
104
+ // node_modules/.pnpm/tsup@8.3.5_jiti@2.4.0_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.6.1/node_modules/tsup/assets/cjs_shims.js
103
105
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
104
106
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
105
107
 
@@ -347,7 +349,8 @@ async function ensurePackages(packages) {
347
349
  return;
348
350
  const p = await import("@clack/prompts");
349
351
  const result = await p.confirm({
350
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
352
+ // message: `${nonExistingPackages.length === 1 ? 'Package is' : 'Packages are'} required for this config: ${nonExistingPackages.join(', ')}. Do you want to install them?`,
353
+ message: `\u6B64\u914D\u7F6E\u9700\u8981\u8F6F\u4EF6\u5305: ${nonExistingPackages.join(", ")}. \u4F60\u60F3\u5B89\u88C5\u5B83\u4EEC\u5417?`
351
354
  });
352
355
  if (result)
353
356
  await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
@@ -412,7 +415,6 @@ async function stylistic(options = {}) {
412
415
  },
413
416
  // 覆盖`stylistic`默认规则
414
417
  "style/brace-style": ["error", "stroustrup"],
415
- "style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
416
418
  "style/multiline-ternary": ["error", "never"],
417
419
  ...overrides
418
420
  }
@@ -435,13 +437,14 @@ async function formatters(options = {}, stylistic2 = {}) {
435
437
  const defaultIndent = 4;
436
438
  const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
437
439
  if (options === true) {
440
+ const isPrettierPluginXmlInScope2 = isPackageInScope("@prettier/plugin-xml");
438
441
  options = {
439
442
  css: false,
440
443
  graphql: true,
441
444
  html: true,
442
445
  markdown: true,
443
- svg: isPrettierPluginXmlInScope,
444
- xml: isPrettierPluginXmlInScope
446
+ svg: isPrettierPluginXmlInScope2,
447
+ xml: isPrettierPluginXmlInScope2
445
448
  };
446
449
  } else {
447
450
  options = {
@@ -494,7 +497,7 @@ async function formatters(options = {}, stylistic2 = {}) {
494
497
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
495
498
  const configs2 = [
496
499
  {
497
- name: "eslint/formatters/setup",
500
+ name: "eslint/formatter/setup",
498
501
  plugins: {
499
502
  format: pluginFormat
500
503
  }
@@ -507,12 +510,11 @@ async function formatters(options = {}, stylistic2 = {}) {
507
510
  languageOptions: {
508
511
  parser: parserPlain
509
512
  },
510
- name: "eslint/formatters/css",
513
+ name: "eslint/formatter/css",
511
514
  rules: {
512
515
  "format/prettier": [
513
516
  "error",
514
517
  mergePrettierOptions(prettierOptions, {
515
- ...prettierOptions,
516
518
  parser: "css"
517
519
  })
518
520
  ]
@@ -523,12 +525,11 @@ async function formatters(options = {}, stylistic2 = {}) {
523
525
  languageOptions: {
524
526
  parser: parserPlain
525
527
  },
526
- name: "eslint/formatters/scss",
528
+ name: "eslint/formatter/scss",
527
529
  rules: {
528
530
  "format/prettier": [
529
531
  "error",
530
532
  mergePrettierOptions(prettierOptions, {
531
- ...prettierOptions,
532
533
  parser: "scss"
533
534
  })
534
535
  ]
@@ -539,12 +540,11 @@ async function formatters(options = {}, stylistic2 = {}) {
539
540
  languageOptions: {
540
541
  parser: parserPlain
541
542
  },
542
- name: "eslint/formatters/less",
543
+ name: "eslint/formatter/less",
543
544
  rules: {
544
545
  "format/prettier": [
545
546
  "error",
546
547
  mergePrettierOptions(prettierOptions, {
547
- ...prettierOptions,
548
548
  parser: "less"
549
549
  })
550
550
  ]
@@ -558,12 +558,11 @@ async function formatters(options = {}, stylistic2 = {}) {
558
558
  languageOptions: {
559
559
  parser: parserPlain
560
560
  },
561
- name: "eslint/formatters/html",
561
+ name: "eslint/formatter/html",
562
562
  rules: {
563
563
  "format/prettier": [
564
564
  "error",
565
565
  mergePrettierOptions(prettierOptions, {
566
- ...prettierOptions,
567
566
  parser: "html"
568
567
  })
569
568
  ]
@@ -596,7 +595,7 @@ async function formatters(options = {}, stylistic2 = {}) {
596
595
  languageOptions: {
597
596
  parser: parserPlain
598
597
  },
599
- name: "eslint/formatters/svg",
598
+ name: "eslint/formatter/svg",
600
599
  rules: {
601
600
  "format/prettier": [
602
601
  "error",
@@ -614,10 +613,11 @@ async function formatters(options = {}, stylistic2 = {}) {
614
613
  const formater = options.markdown === true ? "prettier" : options.markdown;
615
614
  configs2.push({
616
615
  files: [GLOB_MARKDOWN],
616
+ ignores: [],
617
617
  languageOptions: {
618
618
  parser: parserPlain
619
619
  },
620
- name: "eslint/formatters/markdown",
620
+ name: "eslint/formatter/markdown",
621
621
  rules: {
622
622
  [`format/${formater}`]: [
623
623
  "error",
@@ -638,7 +638,7 @@ async function formatters(options = {}, stylistic2 = {}) {
638
638
  languageOptions: {
639
639
  parser: parserPlain
640
640
  },
641
- name: "eslint/formatters/graphql",
641
+ name: "eslint/formatter/graphql",
642
642
  rules: {
643
643
  "format/prettier": [
644
644
  "error",
@@ -1182,7 +1182,7 @@ async function perfectionist(options = {}) {
1182
1182
  "object",
1183
1183
  "unknown"
1184
1184
  ],
1185
- internalPattern: ["~/**", "@/**"],
1185
+ internalPattern: ["^~/.*", "^@/.*"],
1186
1186
  newlinesBetween: "ignore",
1187
1187
  order: "asc",
1188
1188
  type: "natural"
@@ -1202,13 +1202,18 @@ var ReactRefreshAllowConstantExportPackages = [
1202
1202
  ];
1203
1203
  async function react(options = {}) {
1204
1204
  const {
1205
- files = [GLOB_JSX, GLOB_TSX],
1206
- jsx: jsx2 = true,
1205
+ files = [GLOB_SRC],
1206
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
1207
+ ignoresTypeAware = [
1208
+ `${GLOB_MARKDOWN}/**`
1209
+ ],
1207
1210
  overrides = {},
1208
- version = "detect"
1211
+ tsconfigPath
1209
1212
  } = options;
1210
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1211
1213
  const isTypeAware = !!tsconfigPath;
1214
+ const typeAwareRules = {
1215
+ "react/no-leaked-conditional-rendering": "warn"
1216
+ };
1212
1217
  await ensurePackages([
1213
1218
  "@eslint-react/eslint-plugin",
1214
1219
  "eslint-plugin-react-hooks",
@@ -1217,15 +1222,12 @@ async function react(options = {}) {
1217
1222
  const [
1218
1223
  pluginReact,
1219
1224
  pluginReactHooks,
1220
- pluginReactRefresh,
1221
- parserTs
1225
+ pluginReactRefresh
1222
1226
  ] = await Promise.all([
1223
1227
  interopDefault(import("@eslint-react/eslint-plugin")),
1224
1228
  // @ts-expect-error missing types
1225
1229
  interopDefault(import("eslint-plugin-react-hooks")),
1226
- // @ts-expect-error missing types
1227
- interopDefault(import("eslint-plugin-react-refresh")),
1228
- interopDefault(import("@typescript-eslint/parser"))
1230
+ interopDefault(import("eslint-plugin-react-refresh"))
1229
1231
  ]);
1230
1232
  const _isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
1231
1233
  (i) => (0, import_local_pkg2.isPackageExists)(i)
@@ -1246,13 +1248,12 @@ async function react(options = {}) {
1246
1248
  {
1247
1249
  files,
1248
1250
  languageOptions: {
1249
- parser: parserTs,
1250
1251
  parserOptions: {
1251
1252
  ecmaFeatures: {
1252
- jsx: jsx2
1253
- },
1254
- ...isTypeAware ? { project: tsconfigPath } : {}
1255
- }
1253
+ jsx: true
1254
+ }
1255
+ },
1256
+ sourceType: "module"
1256
1257
  },
1257
1258
  name: "eslint/react/rules",
1258
1259
  rules: {
@@ -1312,18 +1313,18 @@ async function react(options = {}) {
1312
1313
  "react/prefer-destructuring-assignment": "warn",
1313
1314
  "react/prefer-shorthand-boolean": "warn",
1314
1315
  "react/prefer-shorthand-fragment": "warn",
1315
- ...isTypeAware ? {
1316
- "react/no-leaked-conditional-rendering": "warn"
1317
- } : {},
1318
1316
  // overrides
1319
1317
  ...overrides
1320
- },
1321
- settings: {
1322
- react: {
1323
- version
1324
- }
1325
1318
  }
1326
- }
1319
+ },
1320
+ ...isTypeAware ? [{
1321
+ files: filesTypeAware,
1322
+ ignores: ignoresTypeAware,
1323
+ name: "eslint/react/type-aware-rules",
1324
+ rules: {
1325
+ ...typeAwareRules
1326
+ }
1327
+ }] : []
1327
1328
  ];
1328
1329
  }
1329
1330
 
@@ -1957,6 +1958,8 @@ async function vue(options = {}) {
1957
1958
  ]);
1958
1959
  return [
1959
1960
  {
1961
+ // This allows Vue plugin to work with auto imports
1962
+ // https://github.com/vuejs/eslint-plugin-vue/pull/2422
1960
1963
  languageOptions: {
1961
1964
  globals: {
1962
1965
  computed: "readonly",
@@ -1999,21 +2002,21 @@ async function vue(options = {}) {
1999
2002
  processorVueBlocks({
2000
2003
  ...sfcBlocks,
2001
2004
  blocks: {
2002
- ...sfcBlocks.blocks,
2003
- styles: true
2005
+ styles: true,
2006
+ ...sfcBlocks.blocks
2004
2007
  }
2005
2008
  })
2006
2009
  ]),
2007
2010
  rules: {
2008
2011
  ...pluginVue.configs.base.rules,
2009
- ...vueVersion === "3" ? {
2010
- ...pluginVue.configs["vue3-essential"].rules,
2011
- ...pluginVue.configs["vue3-strongly-recommended"].rules,
2012
- ...pluginVue.configs["vue3-recommended"].rules
2013
- } : {
2012
+ ...vueVersion === "2" ? {
2014
2013
  ...pluginVue.configs.essential.rules,
2015
2014
  ...pluginVue.configs["strongly-recommended"].rules,
2016
2015
  ...pluginVue.configs.recommended.rules
2016
+ } : {
2017
+ ...pluginVue.configs["vue3-essential"].rules,
2018
+ ...pluginVue.configs["vue3-strongly-recommended"].rules,
2019
+ ...pluginVue.configs["vue3-recommended"].rules
2017
2020
  },
2018
2021
  "antfu/no-top-level-await": "off",
2019
2022
  "node/prefer-global/process": "off",
@@ -2078,12 +2081,17 @@ async function vue(options = {}) {
2078
2081
  "vue/no-useless-v-bind": "error",
2079
2082
  "vue/no-v-html": "off",
2080
2083
  "vue/no-v-text-v-html-on-component": "off",
2081
- "vue/object-shorthand": ["error", "always", {
2082
- avoidQuotes: true,
2083
- ignoreConstructors: false
2084
- }],
2084
+ "vue/object-shorthand": [
2085
+ "error",
2086
+ "always",
2087
+ {
2088
+ avoidQuotes: true,
2089
+ ignoreConstructors: false
2090
+ }
2091
+ ],
2085
2092
  "vue/prefer-separate-static-class": "error",
2086
2093
  "vue/prefer-template": "error",
2094
+ "vue/prop-name-casing": ["error", "camelCase"],
2087
2095
  "vue/require-default-prop": "off",
2088
2096
  "vue/require-prop-types": "off",
2089
2097
  "vue/singleline-html-element-content-newline": "off",
@@ -2093,12 +2101,17 @@ async function vue(options = {}) {
2093
2101
  "vue/array-bracket-spacing": ["error", "never"],
2094
2102
  "vue/arrow-spacing": ["error", { after: true, before: true }],
2095
2103
  "vue/block-spacing": ["error", "always"],
2096
- "vue/block-tag-newline": ["error", { multiline: "always", singleline: "always" }],
2104
+ "vue/block-tag-newline": ["error", {
2105
+ multiline: "always",
2106
+ singleline: "always"
2107
+ }],
2097
2108
  "vue/brace-style": ["error", "stroustrup", { allowSingleLine: false }],
2098
2109
  "vue/comma-dangle": ["error", "always-multiline"],
2099
2110
  "vue/comma-spacing": ["error", { after: true, before: false }],
2100
2111
  "vue/comma-style": ["error", "last"],
2101
- "vue/html-comment-content-spacing": ["error", "always", { exceptions: ["-"] }],
2112
+ "vue/html-comment-content-spacing": ["error", "always", {
2113
+ exceptions: ["-"]
2114
+ }],
2102
2115
  "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
2103
2116
  "vue/keyword-spacing": ["error", { after: true, before: true }],
2104
2117
  "vue/object-curly-newline": "off",
@@ -2123,6 +2136,9 @@ async function yaml(options = {}) {
2123
2136
  overrides = {},
2124
2137
  stylistic: stylistic2 = true
2125
2138
  } = options;
2139
+ const {
2140
+ quotes = "single"
2141
+ } = typeof stylistic2 === "boolean" ? {} : stylistic2;
2126
2142
  const [
2127
2143
  pluginYaml,
2128
2144
  parserYaml
@@ -2162,7 +2178,7 @@ async function yaml(options = {}) {
2162
2178
  "yaml/indent": ["error", 2],
2163
2179
  "yaml/key-spacing": "error",
2164
2180
  "yaml/no-tab-indent": "error",
2165
- "yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
2181
+ "yaml/quotes": ["error", { avoidEscape: true, prefer: quotes === "backtick" ? "single" : quotes }],
2166
2182
  "yaml/spaced-comment": "error"
2167
2183
  } : {},
2168
2184
  ...overrides
@@ -2199,10 +2215,6 @@ var defaultPluginRenaming = {
2199
2215
  "vitest": "test",
2200
2216
  "yml": "yaml"
2201
2217
  };
2202
- var ReactPackages = [
2203
- "react",
2204
- "next"
2205
- ];
2206
2218
  function lincy(options = {}, ...userConfigs) {
2207
2219
  const {
2208
2220
  autoRenamePlugins = true,
@@ -2211,7 +2223,7 @@ function lincy(options = {}, ...userConfigs) {
2211
2223
  ignores: ignoresList = [],
2212
2224
  jsx: enableJsx = true,
2213
2225
  overrides = {},
2214
- react: enableReact = ReactPackages.some((i) => (0, import_local_pkg4.isPackageExists)(i)),
2226
+ react: enableReact = false,
2215
2227
  regexp: enableRegexp = true,
2216
2228
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2217
2229
  unicorn: enableUnicorn = true,
@@ -2225,12 +2237,8 @@ function lincy(options = {}, ...userConfigs) {
2225
2237
  console.log("[@lincy/eslint-config] Detected running in editor, some rules are disabled.");
2226
2238
  }
2227
2239
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2228
- const tsconfigPath = typeof enableTypeScript !== "boolean" && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : void 0;
2229
- if (stylisticOptions) {
2230
- if (!("jsx" in stylisticOptions)) {
2231
- stylisticOptions.jsx = enableJsx;
2232
- }
2233
- }
2240
+ if (stylisticOptions && !("jsx" in stylisticOptions))
2241
+ stylisticOptions.jsx = enableJsx;
2234
2242
  const configs2 = [];
2235
2243
  if (enableGitignore) {
2236
2244
  if (typeof enableGitignore !== "boolean") {
@@ -2245,6 +2253,8 @@ function lincy(options = {}, ...userConfigs) {
2245
2253
  })]));
2246
2254
  }
2247
2255
  }
2256
+ const typescriptOptions = resolveSubOptions(options, "typescript");
2257
+ const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
2248
2258
  configs2.push(
2249
2259
  ignores({
2250
2260
  ignores: [
@@ -2254,7 +2264,7 @@ function lincy(options = {}, ...userConfigs) {
2254
2264
  }),
2255
2265
  javascript({
2256
2266
  isInEditor,
2257
- overrides: overrides.javascript
2267
+ overrides: getOverrides(options, "javascript")
2258
2268
  }),
2259
2269
  comments({
2260
2270
  overrides: overrides.comments
@@ -2284,63 +2294,64 @@ function lincy(options = {}, ...userConfigs) {
2284
2294
  if (enableVue) {
2285
2295
  componentExts.push("vue");
2286
2296
  }
2297
+ if (enableJsx) {
2298
+ configs2.push(jsx());
2299
+ }
2287
2300
  if (enableTypeScript) {
2288
2301
  configs2.push(typescript({
2289
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2302
+ ...typescriptOptions,
2290
2303
  componentExts,
2291
- overrides: overrides.typescript,
2304
+ overrides: getOverrides(options, "typescript"),
2292
2305
  tsconfigPath,
2293
2306
  type: options.type
2294
2307
  }));
2295
2308
  }
2296
- if (enableJsx) {
2297
- configs2.push(jsx());
2298
- }
2299
2309
  if (stylisticOptions) {
2300
2310
  configs2.push(stylistic({
2301
- overrides: overrides.stylistic,
2311
+ overrides: getOverrides(options, "stylistic"),
2302
2312
  stylistic: stylisticOptions
2303
2313
  }));
2304
2314
  }
2305
2315
  if (enableRegexp) {
2306
2316
  configs2.push(regexp({
2307
- ...typeof enableRegexp === "boolean" ? {} : enableRegexp,
2308
- overrides: overrides.regexp
2317
+ ...resolveSubOptions(options, "regexp"),
2318
+ ...getOverrides(options, "regexp")
2309
2319
  }));
2310
2320
  }
2311
2321
  if (options.test ?? true) {
2312
2322
  configs2.push(test({
2313
- ...typeof options.test !== "boolean" ? options.test : {},
2323
+ ...resolveSubOptions(options, "test"),
2314
2324
  isInEditor,
2315
- overrides: overrides.test
2325
+ overrides: getOverrides(options, "test")
2316
2326
  }));
2317
2327
  }
2318
2328
  if (enableVue) {
2319
2329
  configs2.push(vue({
2320
- ...typeof options.vue !== "boolean" ? options.vue : {},
2321
- overrides: overrides.vue,
2330
+ ...resolveSubOptions(options, "vue"),
2331
+ overrides: getOverrides(options, "vue"),
2322
2332
  stylistic: stylisticOptions,
2323
2333
  typescript: !!enableTypeScript
2324
2334
  }));
2325
2335
  }
2326
2336
  if (enableReact) {
2327
2337
  configs2.push(react({
2328
- tsconfigPath,
2329
- ...typeof enableReact !== "boolean" ? enableReact : {},
2330
- overrides: overrides.react
2338
+ ...typescriptOptions,
2339
+ ...resolveSubOptions(options, "react"),
2340
+ overrides: getOverrides(options, "react"),
2341
+ tsconfigPath
2331
2342
  }));
2332
2343
  }
2333
2344
  if (enableUnoCSS) {
2334
2345
  configs2.push(unocss({
2335
- ...typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS,
2336
- overrides: overrides.unocss
2346
+ ...resolveSubOptions(options, "unocss"),
2347
+ overrides: getOverrides(options, "unocss")
2337
2348
  }));
2338
2349
  }
2339
2350
  if (options.jsonc ?? true) {
2340
2351
  configs2.push(
2341
2352
  jsonc({
2342
- ...typeof options.jsonc !== "boolean" ? options.jsonc : {},
2343
- overrides: overrides.jsonc,
2353
+ ...resolveSubOptions(options, "jsonc"),
2354
+ overrides: getOverrides(options, "jsonc"),
2344
2355
  stylistic: stylisticOptions
2345
2356
  }),
2346
2357
  sortPackageJson(),
@@ -2349,23 +2360,27 @@ function lincy(options = {}, ...userConfigs) {
2349
2360
  }
2350
2361
  if (options.yaml ?? true) {
2351
2362
  configs2.push(yaml({
2352
- ...typeof options.yaml !== "boolean" ? options.yaml : {},
2353
- overrides: overrides.yaml,
2363
+ ...resolveSubOptions(options, "yaml"),
2364
+ overrides: getOverrides(options, "yaml"),
2354
2365
  stylistic: stylisticOptions
2355
2366
  }));
2356
2367
  }
2357
- if (options.toml) {
2368
+ if (options.toml ?? true) {
2358
2369
  configs2.push(toml({
2359
- overrides: overrides.toml,
2370
+ overrides: getOverrides(options, "toml"),
2360
2371
  stylistic: stylisticOptions
2361
2372
  }));
2362
2373
  }
2363
2374
  if (options.markdown ?? true) {
2364
- configs2.push(markdown({
2365
- ...typeof options.markdown !== "boolean" ? options.markdown : {},
2366
- componentExts,
2367
- overrides: overrides.markdown
2368
- }));
2375
+ configs2.push(
2376
+ markdown(
2377
+ {
2378
+ ...resolveSubOptions(options, "markdown"),
2379
+ componentExts,
2380
+ overrides: getOverrides(options, "markdown")
2381
+ }
2382
+ )
2383
+ );
2369
2384
  }
2370
2385
  if (options.formatters) {
2371
2386
  configs2.push(formatters(
@@ -2380,14 +2395,12 @@ function lincy(options = {}, ...userConfigs) {
2380
2395
  throw new Error("[@lincy/eslint-config] \u7B2C\u4E00\u4E2A\u53C2\u6570\u4E0D\u5E94\u5305\u542B\u201Cfiles\u201D\u5C5E\u6027\uFF0C\u56E0\u4E3A\u9009\u9879\u5E94\u8BE5\u662F\u5168\u5C40\u7684\u3002\u8BF7\u5C06\u5176\u653E\u5728\u7B2C\u4E8C\u4E2A\u6216\u66F4\u540E\u9762\u7684\u914D\u7F6E\u4E2D\u3002");
2381
2396
  }
2382
2397
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
2383
- if (key in options) {
2398
+ if (key in options)
2384
2399
  acc[key] = options[key];
2385
- }
2386
2400
  return acc;
2387
2401
  }, {});
2388
- if (Object.keys(fusedConfig).length) {
2402
+ if (Object.keys(fusedConfig).length)
2389
2403
  configs2.push([fusedConfig]);
2390
- }
2391
2404
  let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
2392
2405
  composer = composer.append(
2393
2406
  ...configs2,
@@ -2398,6 +2411,16 @@ function lincy(options = {}, ...userConfigs) {
2398
2411
  }
2399
2412
  return composer;
2400
2413
  }
2414
+ function resolveSubOptions(options, key) {
2415
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
2416
+ }
2417
+ function getOverrides(options, key) {
2418
+ const sub = resolveSubOptions(options, key);
2419
+ return {
2420
+ ...options.overrides?.[key],
2421
+ ..."overrides" in sub ? sub.overrides : {}
2422
+ };
2423
+ }
2401
2424
 
2402
2425
  // src/index.ts
2403
2426
  var src_default = lincy;
@@ -2438,6 +2461,7 @@ var src_default = lincy;
2438
2461
  disables,
2439
2462
  ensurePackages,
2440
2463
  formatters,
2464
+ getOverrides,
2441
2465
  ignores,
2442
2466
  imports,
2443
2467
  interopDefault,
@@ -2457,6 +2481,7 @@ var src_default = lincy;
2457
2481
  regexp,
2458
2482
  renamePluginInConfigs,
2459
2483
  renameRules,
2484
+ resolveSubOptions,
2460
2485
  sortPackageJson,
2461
2486
  sortTsconfig,
2462
2487
  stylistic,