@octohash/eslint-config 0.2.9 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.d.mts +54 -7
  2. package/package.json +12 -12
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import * as _antfu_eslint_config0 from "@antfu/eslint-config";
1
+ import * as _$_antfu_eslint_config0 from "@antfu/eslint-config";
2
2
  import { Awaitable, OptionsConfig, OptionsFiles, OptionsOverrides, TypedFlatConfigItem } from "@antfu/eslint-config";
3
3
  import { Linter, Rule } from "eslint";
4
4
 
@@ -759,7 +759,7 @@ interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
759
759
  * An object containing a name-value mapping of plugin names to plugin objects.
760
760
  * When files is specified, these plugins are only available to the matching files.
761
761
  */
762
- plugins?: Record<string, Plugin>;
762
+ plugins?: Record<string, Plugin$1>;
763
763
  /**
764
764
  * An object containing the configured rules. When files or ignores are specified,
765
765
  * these rule configurations are only available to the matching files.
@@ -975,7 +975,7 @@ interface Processor<T extends string | ProcessorFile = string | ProcessorFile> e
975
975
  /** The function to merge messages. */
976
976
  postprocess?(messages: LintMessage[][], filename: string): LintMessage[];
977
977
  }
978
- interface Plugin extends ObjectMetaProperties {
978
+ interface Plugin$1 extends ObjectMetaProperties {
979
979
  meta?: ObjectMetaProperties["meta"] & {
980
980
  namespace?: string | undefined;
981
981
  };
@@ -1328,9 +1328,37 @@ interface ConfigWithExtends$1 extends ConfigObject {
1328
1328
  }
1329
1329
  //#endregion
1330
1330
  //#region node_modules/.pnpm/@eslint+config-helpers@0.5.3/node_modules/@eslint/config-helpers/dist/esm/index.d.ts
1331
+ type Plugin = Plugin$1;
1331
1332
  type ConfigWithExtends = ConfigWithExtends$1;
1332
1333
  //#endregion
1333
- //#region node_modules/.pnpm/eslint-flat-config-utils@3.0.2/node_modules/eslint-flat-config-utils/dist/index.d.mts
1334
+ //#region node_modules/.pnpm/eslint-flat-config-utils@3.1.0/node_modules/eslint-flat-config-utils/dist/index.d.mts
1335
+ /**
1336
+ * The options for `renamePluginsInConfigs`
1337
+ */
1338
+ interface RenamePluginsInConfigsOptions {
1339
+ /**
1340
+ * Resolve conflicts by merging plugins.
1341
+ *
1342
+ * Note there is no guarantee that the result works the same as the original configs.
1343
+ *
1344
+ * @default false
1345
+ */
1346
+ mergePlugins?: boolean;
1347
+ }
1348
+ /**
1349
+ * Rename plugin names a flat configs array
1350
+ *
1351
+ * @example
1352
+ * ```ts
1353
+ * import { renamePluginsInConfigs } from 'eslint-flat-config-utils'
1354
+ * import someConfigs from './some-configs'
1355
+ *
1356
+ * export default renamePluginsInConfigs(someConfigs, {
1357
+ * '@typescript-eslint': 'ts',
1358
+ * 'import-x': 'import',
1359
+ * })
1360
+ * ```
1361
+ */
1334
1362
  /**
1335
1363
  * A type that can be awaited. Promise<T> or T.
1336
1364
  */
@@ -1426,6 +1454,7 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
1426
1454
  private _operationsOverrides;
1427
1455
  private _operationsResolved;
1428
1456
  private _renames;
1457
+ private _renamesOptions;
1429
1458
  private _pluginsConflictsError;
1430
1459
  constructor(...configs: ResolvableFlatConfig<T>[]);
1431
1460
  /**
@@ -1433,7 +1462,7 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
1433
1462
  *
1434
1463
  * This will runs after all config items are resolved. Applies to `plugins` and `rules`.
1435
1464
  */
1436
- renamePlugins(renames: Record<string, string>): this;
1465
+ renamePlugins(renames: Record<string, string>, options?: RenamePluginsInConfigsOptions): this;
1437
1466
  /**
1438
1467
  * Append configs to the end of the current configs array.
1439
1468
  */
@@ -1509,7 +1538,25 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
1509
1538
  /**
1510
1539
  * Remove a specific config by name or index.
1511
1540
  */
1512
- remove(nameOrIndex: ConfigNames | string | number): this;
1541
+ remove(nameOrIndex: StringLiteralUnion<ConfigNames, string | number>): this;
1542
+ /**
1543
+ * Replace a plugin with another.
1544
+ *
1545
+ * @example
1546
+ * ```ts
1547
+ * composer
1548
+ * .replacePlugin('foo', (fooPlugin) => ({
1549
+ * ...fooPlugin,
1550
+ * rules: {
1551
+ * ...fooPlugin.rules,
1552
+ * someNewRule,
1553
+ * },
1554
+ * }))
1555
+ * ```
1556
+ *
1557
+ * The `plugins: { foo }` will be replaced from all configs with a new plugin that is a merge of it and the `bar` plugin
1558
+ */
1559
+ replacePlugin(name: string, replacement: Awaitable$1<Plugin> | ((original: Plugin) => Awaitable$1<Plugin>)): this;
1513
1560
  /**
1514
1561
  * Replace a specific config by name or index.
1515
1562
  *
@@ -1600,6 +1647,6 @@ interface OptionsTailwindcss extends OptionsFiles, OptionsOverrides {
1600
1647
  }
1601
1648
  //#endregion
1602
1649
  //#region src/index.d.ts
1603
- declare function defineConfig(options?: Options, ...userConfigs: UserConfig): FlatConfigComposer<_antfu_eslint_config0.TypedFlatConfigItem, _antfu_eslint_config0.ConfigNames>;
1650
+ declare function defineConfig(options?: Options, ...userConfigs: UserConfig): FlatConfigComposer<_$_antfu_eslint_config0.TypedFlatConfigItem, _$_antfu_eslint_config0.ConfigNames>;
1604
1651
  //#endregion
1605
1652
  export { defineConfig };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@octohash/eslint-config",
3
3
  "type": "module",
4
- "version": "0.2.9",
4
+ "version": "0.3.0",
5
5
  "description": "Personal ESLint config based on @antfu/eslint-config with opinionated extensions.",
6
6
  "author": "jinghaihan",
7
7
  "license": "MIT",
@@ -38,27 +38,27 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@antfu/eslint-config": "^7.7.3",
41
+ "@antfu/eslint-config": "^8.0.0",
42
42
  "eslint-plugin-catalogs-sort": "^0.0.0-alpha.0",
43
43
  "find-up-simple": "^1.0.1",
44
44
  "local-pkg": "^1.1.2",
45
45
  "pathe": "^2.0.3"
46
46
  },
47
47
  "devDependencies": {
48
- "tsdown": "^0.21.4",
48
+ "tsdown": "^0.21.7",
49
49
  "@octohash/tsconfig": "^0.2.0",
50
50
  "bumpp": "^11.0.1",
51
51
  "nano-staged": "^0.9.0",
52
- "pncat": "^0.11.0",
52
+ "pncat": "^0.11.1",
53
53
  "simple-git-hooks": "^2.13.1",
54
- "taze": "^19.10.0",
55
- "typescript": "^5.9.3",
56
- "eslint": "^10.0.3",
57
- "eslint-flat-config-utils": "^3.0.2",
54
+ "taze": "^19.11.0",
55
+ "typescript": "^6.0.2",
56
+ "eslint": "^10.2.0",
57
+ "eslint-flat-config-utils": "^3.1.0",
58
58
  "eslint-plugin-better-tailwindcss": "^4.3.2",
59
- "vitest": "^4.1.0",
60
- "@types/node": "^25.5.0",
61
- "@octohash/eslint-config": "0.2.9"
59
+ "vitest": "^4.1.2",
60
+ "@types/node": "^25.5.2",
61
+ "@octohash/eslint-config": "0.3.0"
62
62
  },
63
63
  "simple-git-hooks": {
64
64
  "pre-commit": "pnpm nano-staged"
@@ -70,7 +70,7 @@
70
70
  "@eslint/config-helpers": "0.5.3",
71
71
  "@eslint/core": "1.1.1",
72
72
  "@types/json-schema": "7.0.15",
73
- "eslint-flat-config-utils": "3.0.2"
73
+ "eslint-flat-config-utils": "3.1.0"
74
74
  },
75
75
  "scripts": {
76
76
  "build": "tsdown",