Skip to content

The plugin is not compatible with ESLint flat config #2943

@its-dibo

Description

@its-dibo
import graphql from '@graphql-eslint/eslint-plugin';

export default [
 plugins: {
        '@graphql-eslint': graphql,
      },
...
]

error:

Type '({ files: string[] | undefined; rules: { '@graphql-eslint/executable-definitions': "error"; '@graphql-eslint/fields-on-correct-type': "error"; '@graphql-eslint/fragments-on-composite-type': "error"; ... 28 more ...; '@graphql-eslint/variables-in-allowed-position': "error"; }; name: string; } | { ...; } | { ...; } | ...' is not assignable to type 'Config<RulesConfig>[]'.
  Type '{ files: string[] | undefined; rules: { '@graphql-eslint/executable-definitions': "error"; '@graphql-eslint/fields-on-correct-type': "error"; '@graphql-eslint/fragments-on-composite-type': "error"; ... 28 more ...; '@graphql-eslint/variables-in-allowed-position': "error"; }; name: string; } | { ...; } | { ...; } | {...' is not assignable to type 'Config<RulesConfig>'.
    Type '{ files: string[] | undefined; languageOptions: { parser: { parseForESLint: typeof parseForESLint; meta: { name: string; version: string | undefined; }; }; parserOptions: { ...; }; }; plugins: { ...; }; processor?: undefined; name: string; }' is not assignable to type 'ConfigObject<RulesConfig>'.
      Types of property 'plugins' are incompatible.
        Type '{ '@graphql-eslint': { parser: { parseForESLint: typeof parseForESLint; meta: { name: string; version: string | undefined; }; }; processor: { meta: { name: string; version: string | undefined; }; supportsAutofix: true; preprocess(code: string, filePath: string): (string | Block)[]; postprocess(messages: Linter.LintM...' is not assignable to type 'Record<string, Plugin>'.
          Property ''@graphql-eslint'' is incompatible with index signature.
            Type '{ parser: { parseForESLint: (code: string, options: ParserOptions) => GraphQLESLintParseResult; meta: { name: string; version: string | undefined; }; }; processor: { ...; }; rules: { ...; }; configs: { ...; }; }' is not assignable to type 'Plugin'.
              Types of property 'rules' are incompatible.
                Type '{ alphabetize: GraphQLESLintRule<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined; values?: boolean | undefined; fields?: ("ObjectTypeDefinition" | ... 1 more ....' is not assignable to type 'Record<string, RuleDefinition<RuleDefinitionTypeOptions>>'.
                  Property 'alphabetize' is incompatible with index signature.
                    Type 'GraphQLESLintRule<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined; values?: boolean | undefined; fields?: ("ObjectTypeDefinition" | ... 1 more ... | "InputObje...' is not assignable to type 'RuleDefinition<RuleDefinitionTypeOptions>'.
                      Types of property 'meta' are incompatible.
                        Type 'Omit<RuleMetaData, "schema" | "docs"> & { docs?: RuleDocsInfo<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; ... 4 more ...; groups?: string[] | undefined; }[]> | undefined; schema: any; }' is not assignable to type 'RulesMeta<string, unknown[], unknown> | undefined'.
                          Type 'Omit<RuleMetaData, "schema" | "docs"> & { docs?: RuleDocsInfo<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; ... 4 more ...; groups?: string[] | undefined; }[]> | undefined; schema: any; }' is not assignable to type 'RulesMeta<string, unknown[], unknown>'.
                            Types of property 'docs' are incompatible.
                              Type 'RuleDocsInfo<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined; values?: boolean | undefined; fields?: ("ObjectTypeDefinition" | ... 1 more ... | "InputObjectTyp...' is not assignable to type 'RulesMetaDocs | undefined'.
                                Type 'RuleDocsInfo<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined; values?: boolean | undefined; fields?: ("ObjectTypeDefinition" | ... 1 more ... | "InputObjectTyp...' is not assignable to type 'RulesMetaDocs | undefined'.
                                  Type 'RuleDocsInfo<{ definitions?: boolean | undefined; selections?: ("OperationDefinition" | "FragmentDefinition")[] | undefined; arguments?: ("Field" | "Directive" | "FieldDefinition" | "DirectiveDefinition")[] | undefined; values?: boolean | undefined; fields?: ("ObjectTypeDefinition" | ... 1 more ... | "InputObjectTyp...' is not assignable to type 'RulesMetaDocs'.
                                    Types of property 'category' are incompatible.
                                      Type 'CategoryType | CategoryType[]' is not assignable to type 'string | undefined'.
                                        Type 'CategoryType[]' is not assignable to type 'string'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions