Skip to content

Commit 03f5e61

Browse files
committed
refactor(plugin-eslint): update to renamed config types
1 parent 2e7ca9c commit 03f5e61

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

e2e/plugin-eslint-e2e/mocks/fixtures/flat-config/eslint.config.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import('eslint').Linter.FlatConfig[]} */
1+
/** @type {import('eslint').Linter.Config[]} */
22
module.exports = [
33
{
44
ignores: ['code-pushup.config.ts'],

packages/plugin-eslint/src/lib/meta/versions/flat.integration.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('loadRulesForFlatConfig', () => {
2222
});
2323

2424
it('should load built-in rules from implicit flat config location', async () => {
25-
const config: Linter.FlatConfig = {
25+
const config: Linter.Config = {
2626
rules: {
2727
'no-unused-vars': 'error',
2828
'prefer-const': 'warn',
@@ -78,7 +78,7 @@ describe('loadRulesForFlatConfig', () => {
7878
} as Rule.RuleModule,
7979
},
8080
} as ESLint.Plugin;
81-
const config: Linter.FlatConfig[] = [
81+
const config: Linter.Config[] = [
8282
{
8383
plugins: {
8484
'@typescript-eslint': tseslint,
@@ -143,7 +143,7 @@ describe('loadRulesForFlatConfig', () => {
143143
});
144144

145145
it('should load custom rule options', async () => {
146-
const config: Linter.FlatConfig[] = [
146+
const config: Linter.Config[] = [
147147
{
148148
rules: {
149149
complexity: ['warn', 30],
@@ -171,7 +171,7 @@ describe('loadRulesForFlatConfig', () => {
171171
});
172172

173173
it('should create multiple rule instances when different options used', async () => {
174-
const config: Linter.FlatConfig[] = [
174+
const config: Linter.Config[] = [
175175
{
176176
rules: {
177177
'max-lines': ['warn', { max: 300 }],

packages/plugin-eslint/src/lib/meta/versions/flat.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function loadRulesForFlatConfig({
3333
.filter(exists);
3434
}
3535

36-
type FlatConfig = Linter.FlatConfig | Linter.FlatConfig[];
36+
type FlatConfig = Linter.Config | Linter.Config[];
3737

3838
async function loadConfigByDefaultLocation(): Promise<FlatConfig> {
3939
const flatConfigFileNames = [
@@ -63,7 +63,7 @@ async function loadConfigByPath(configPath: string): Promise<FlatConfig> {
6363
}
6464

6565
function findEnabledRulesWithOptions(
66-
configs: Linter.FlatConfig[],
66+
configs: Linter.Config[],
6767
): Omit<RuleData, 'meta'>[] {
6868
const enabledRules = configs
6969
.flatMap(({ rules }) => Object.entries(rules ?? {}))
@@ -83,7 +83,7 @@ function findEnabledRulesWithOptions(
8383

8484
function findRuleMeta(
8585
ruleId: string,
86-
configs: Linter.FlatConfig[],
86+
configs: Linter.Config[],
8787
): Rule.RuleMetaData | undefined {
8888
const { plugin, name } = parseRuleId(ruleId);
8989
if (!plugin) {
@@ -100,7 +100,7 @@ function findBuiltinRuleMeta(name: string): Rule.RuleMetaData | undefined {
100100
function findPluginRuleMeta(
101101
plugin: string,
102102
name: string,
103-
configs: Linter.FlatConfig[],
103+
configs: Linter.Config[],
104104
): Rule.RuleMetaData | undefined {
105105
const config = configs.find(({ plugins = {} }) => plugin in plugins);
106106
const rule = config?.plugins?.[plugin]?.rules?.[name];

packages/plugin-eslint/src/lib/meta/versions/legacy.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export async function loadRulesForLegacyConfig({
1313
const configs = await toArray(patterns).reduce(
1414
async (acc, pattern) => [
1515
...(await acc),
16-
(await eslint.calculateConfigForFile(pattern)) as Linter.Config,
16+
(await eslint.calculateConfigForFile(pattern)) as Linter.LegacyConfig,
1717
],
18-
Promise.resolve<Linter.Config[]>([]),
18+
Promise.resolve<Linter.LegacyConfig[]>([]),
1919
);
2020

2121
const rulesIds = distinct(

0 commit comments

Comments
 (0)