Skip to content

Commit 1e3e966

Browse files
authored
fix - Config types don't satisfy FlatConfig.Config (#2752)
* fix - Config types don't satisfy `FlatConfig.Config` * fix - Config types don't satisfy `FlatConfig.Config` * ignore type errors for now
1 parent 4edf61e commit 1e3e966

File tree

14 files changed

+47
-33
lines changed

14 files changed

+47
-33
lines changed

.changeset/fast-fishes-shake.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
'@graphql-eslint/eslint-plugin': patch
33
---
44

5-
fix reporting lint issues not on first char of file for `.vue` and support ESLint fixes and suggestions for them. Use [new official example](https://github.com/dimaMachina/graphql-eslint/blob/master/examples/vue-code-file/eslint.config.js)
5+
fix reporting lint issues not on first char of file for `.vue` and support ESLint fixes and
6+
suggestions for them. Use
7+
[new official example](https://github.com/dimaMachina/graphql-eslint/blob/master/examples/vue-code-file/eslint.config.js)

.changeset/popular-ads-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-eslint/eslint-plugin': patch
3+
---
4+
5+
fix - Config types don't satisfy `FlatConfig.Config`

examples/multiple-projects-graphql-config/graphql.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { IGraphQLConfig } from 'graphql-config';
2-
import type { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
1+
import type { IGraphQLConfig, GraphQLTagPluckOptions } from '@graphql-eslint/eslint-plugin';
32

43
const config: IGraphQLConfig = {
54
projects: {

packages/plugin/src/configs/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
import type { Linter } from 'eslint';
12
import { ConfigName } from '../types.js';
2-
// @ts-expect-error -- complains about no default export
33
import operationsAllConfig from './operations-all.js';
4-
// @ts-expect-error -- complains about no default export
54
import operationsRecommendedConfig from './operations-recommended.js';
6-
// @ts-expect-error -- complains about no default export
75
import schemaAllConfig from './schema-all.js';
8-
// @ts-expect-error -- complains about no default export
96
import schemaRecommendedConfig from './schema-recommended.js';
10-
// @ts-expect-error -- complains about no default export
117
import relayConfig from './schema-relay.js';
128

139
export const configs = {
@@ -37,4 +33,4 @@ export const configs = {
3733
...operationsAllConfig.rules,
3834
},
3935
},
40-
} satisfies Record<ConfigName | `flat/${ConfigName}`, unknown>;
36+
} satisfies Record<ConfigName, Linter.LegacyConfig> & Record<`flat/${ConfigName}`, Linter.Config>;

packages/plugin/src/configs/operations-all.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
2+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `pnpm generate:configs`
33
*/
44

5-
// @ts-expect-error -- for cjs
6-
export = {
5+
import type { Linter } from 'eslint';
6+
7+
export default {
78
extends: './configs/operations-recommended',
89
rules: {
910
'@graphql-eslint/alphabetize': [
@@ -29,4 +30,4 @@ export = {
2930
'@graphql-eslint/no-one-place-fragments': 'error',
3031
'@graphql-eslint/require-import-fragment': 'error',
3132
},
32-
};
33+
} satisfies Linter.LegacyConfig;

packages/plugin/src/configs/operations-recommended.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
2+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `pnpm generate:configs`
33
*/
44

5-
// @ts-expect-error -- for cjs
6-
export = {
5+
import type { Linter } from 'eslint';
6+
7+
export default {
78
parser: '@graphql-eslint/eslint-plugin',
89
plugins: ['@graphql-eslint'],
910
rules: {
@@ -55,4 +56,4 @@ export = {
5556
'@graphql-eslint/variables-are-input-types': 'error',
5657
'@graphql-eslint/variables-in-allowed-position': 'error',
5758
},
58-
};
59+
} satisfies Linter.LegacyConfig;

packages/plugin/src/configs/schema-all.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
2+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `pnpm generate:configs`
33
*/
44

5-
// @ts-expect-error -- for cjs
6-
export = {
5+
import type { Linter } from 'eslint';
6+
7+
export default {
78
extends: './configs/schema-recommended',
89
rules: {
910
'@graphql-eslint/alphabetize': [
@@ -25,4 +26,4 @@ export = {
2526
'@graphql-eslint/require-nullable-result-in-root': 'error',
2627
'@graphql-eslint/require-type-pattern-with-oneof': 'error',
2728
},
28-
};
29+
} satisfies Linter.LegacyConfig;

packages/plugin/src/configs/schema-recommended.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* 🚨 IMPORTANT! Do not manually modify this file. Run: `yarn generate-configs`
2+
* 🚨 IMPORTANT! Do not manually modify this file. Run: `pnpm generate:configs`
33
*/
44

5-
// @ts-expect-error -- for cjs
6-
export = {
5+
import type { Linter } from 'eslint';
6+
7+
export default {
78
parser: '@graphql-eslint/eslint-plugin',
89
plugins: ['@graphql-eslint'],
910
rules: {
@@ -69,4 +70,4 @@ export = {
6970
'@graphql-eslint/unique-operation-types': 'error',
7071
'@graphql-eslint/unique-type-names': 'error',
7172
},
72-
};
73+
} satisfies Linter.LegacyConfig;
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// @ts-expect-error -- for cjs
2-
export = {
1+
import type { Linter } from 'eslint';
2+
3+
export default {
34
parser: '@graphql-eslint/eslint-plugin',
45
plugins: ['@graphql-eslint'],
56
rules: {
@@ -8,4 +9,4 @@ export = {
89
'@graphql-eslint/relay-edge-types': 'error',
910
'@graphql-eslint/relay-page-info': 'error',
1011
},
11-
};
12+
} satisfies Linter.LegacyConfig;

packages/plugin/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { processor } from './processor.js';
44
import { rules } from './rules/index.js';
55

66
export * from './types.js';
7+
export type { IGraphQLConfig } from 'graphql-config';
8+
export type { GraphQLTagPluckOptions } from '@graphql-tools/graphql-tag-pluck';
9+
710
export { requireGraphQLSchemaFromContext, requireSiblingsOperations } from './utils.js';
811

912
export const processors = { graphql: processor };

0 commit comments

Comments
 (0)