Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Describe the bug
The current type for meta.schema under the Rule type results in a typescript error when using strict type checking, and providing an array.

If I change it to an object instead of an array, the type error goes away.
To Reproduce Steps to reproduce the behavior:
Expected behavior
Environment:
- OS: MacOS
@graphql-eslint/eslint-plugin: 4.4.0
- Node.js: 22.11
Additional context
I believe this is due to [] not having a relevant type on https://github.com/graphql-hive/graphql-eslint/blob/master/packages/plugin/src/types.ts#L79
Recommend something similar to
type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = {
meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & {
docs?: RuleDocsInfo<Options>;
- schema: Readonly<JSONSchema> | [];
+ schema: Readonly<JSONSchema> | JSONSchema[];
};
create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>;
};
I tested the above locally, and it resolves the issue.
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
2. A failing test has been provided
3. A local solution has been provided
4. A pull request is pending review
Describe the bug
The current type for
meta.schemaunder the Rule type results in a typescript error when usingstricttype checking, and providing an array.If I change it to an object instead of an array, the type error goes away.
To Reproduce Steps to reproduce the behavior:
Expected behavior
Environment:
@graphql-eslint/eslint-plugin: 4.4.0Additional context
I believe this is due to
[]not having a relevant type on https://github.com/graphql-hive/graphql-eslint/blob/master/packages/plugin/src/types.ts#L79Recommend something similar to
type GraphQLESLintRule<Options = [], WithTypeInfo extends boolean = false> = { meta: Omit<Rule.RuleMetaData, 'docs' | 'schema'> & { docs?: RuleDocsInfo<Options>; - schema: Readonly<JSONSchema> | []; + schema: Readonly<JSONSchema> | JSONSchema[]; }; create(context: GraphQLESLintRuleContext<Options>): GraphQLESLintRuleListener<WithTypeInfo>; };I tested the above locally, and it resolves the issue.