Skip to content

Commit 7b6dd37

Browse files
nzakasfasttime
andauthored
feat: Add config types in @eslint/core (#237)
Co-authored-by: Francesco Trotta <github@fasttime.org>
1 parent c9fe7c6 commit 7b6dd37

File tree

11 files changed

+541
-22
lines changed

11 files changed

+541
-22
lines changed

packages/compat/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@
4848
"url": "https://github.com/eslint/rewrite/issues"
4949
},
5050
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/compat#readme",
51+
"dependencies": {
52+
"@eslint/core": "^0.15.2"
53+
},
5154
"devDependencies": {
52-
"@eslint/core": "^0.15.2",
5355
"eslint": "^9.27.0"
5456
},
5557
"peerDependencies": {

packages/compat/src/fixup-rules.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// Types
88
//-----------------------------------------------------------------------------
99

10-
/** @typedef {import("eslint").ESLint.Plugin} FixupPluginDefinition */
11-
/** @typedef {import("eslint").Rule.RuleModule} FixupRuleDefinition */
10+
/** @typedef {import("@eslint/core").Plugin} FixupPluginDefinition */
11+
/** @typedef {import("@eslint/core").RuleDefinition} FixupRuleDefinition */
1212
/** @typedef {FixupRuleDefinition["create"]} FixupLegacyRuleDefinition */
13-
/** @typedef {import("eslint").Linter.Config} FixupConfig */
13+
/** @typedef {import("@eslint/core").ConfigObject} FixupConfig */
1414
/** @typedef {Array<FixupConfig>} FixupConfigArray */
1515

1616
//-----------------------------------------------------------------------------

packages/compat/src/ignore-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import path from "node:path";
1414
// Types
1515
//-----------------------------------------------------------------------------
1616

17-
/** @typedef {import("eslint").Linter.Config} FlatConfig */
17+
/** @typedef {import("@eslint/core").ConfigObject} FlatConfig */
1818

1919
//-----------------------------------------------------------------------------
2020
// Exports

packages/config-helpers/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@
4646
"url": "https://github.com/eslint/rewrite/issues"
4747
},
4848
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/config-helpers#readme",
49+
"dependencies": {
50+
"@eslint/core": "^0.15.2"
51+
},
4952
"devDependencies": {
50-
"@eslint/core": "^0.15.2",
5153
"eslint": "^9.27.0",
5254
"rollup-plugin-copy": "^3.5.0"
5355
},

packages/config-helpers/src/define-config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// Type Definitions
88
//-----------------------------------------------------------------------------
99

10-
/** @typedef {import("eslint").Linter.Config} Config */
11-
/** @typedef {import("eslint").Linter.LegacyConfig} LegacyConfig */
12-
/** @typedef {import("eslint").ESLint.Plugin} Plugin */
13-
/** @typedef {import("eslint").Linter.RuleEntry} RuleEntry */
10+
/** @typedef {import("@eslint/core").ConfigObject} Config */
11+
/** @typedef {import("@eslint/core").LegacyConfigObject} LegacyConfig */
12+
/** @typedef {import("@eslint/core").Plugin} Plugin */
13+
/** @typedef {import("@eslint/core").RuleConfig} RuleConfig */
1414
/** @typedef {import("./types.ts").ExtendsElement} ExtendsElement */
1515
/** @typedef {import("./types.ts").SimpleExtendsElement} SimpleExtendsElement */
1616
/** @typedef {import("./types.ts").ConfigWithExtends} ConfigWithExtends */
@@ -153,7 +153,7 @@ function normalizePluginConfig(userNamespace, plugin, config) {
153153
if (result.rules) {
154154
const ruleIds = Object.keys(result.rules);
155155

156-
/** @type {Record<string,RuleEntry|undefined>} */
156+
/** @type {Record<string,RuleConfig|undefined>} */
157157
const newRules = {};
158158

159159
for (let i = 0; i < ruleIds.length; i++) {

packages/config-helpers/src/global-ignores.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Type Definitions
88
//-----------------------------------------------------------------------------
99

10-
/** @typedef {import("eslint").Linter.Config} Config */
10+
/** @typedef {import("@eslint/core").ConfigObject} Config */
1111

1212
//-----------------------------------------------------------------------------
1313
// Helpers

packages/config-helpers/src/types.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @fileoverview Types for this package.
33
*/
44

5-
import type { Linter } from "eslint";
5+
import type { ConfigObject } from "@eslint/core";
66

77
/**
88
* Infinite array type.
@@ -12,19 +12,17 @@ export type InfiniteArray<T> = T | InfiniteArray<T>[];
1212
/**
1313
* The type of array element in the `extends` property after flattening.
1414
*/
15-
export type SimpleExtendsElement = string | Linter.Config;
15+
export type SimpleExtendsElement = string | ConfigObject;
1616

1717
/**
1818
* The type of array element in the `extends` property before flattening.
1919
*/
20-
export type ExtendsElement =
21-
| SimpleExtendsElement
22-
| InfiniteArray<Linter.Config>;
20+
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
2321

2422
/**
2523
* Config with extends. Valid only inside of `defineConfig()`.
2624
*/
27-
export interface ConfigWithExtends extends Linter.Config {
25+
export interface ConfigWithExtends extends ConfigObject {
2826
extends?: ExtendsElement[];
2927
}
3028

0 commit comments

Comments
 (0)