Skip to content

Support defineConfig of ESLint, instead of tseslint.config #998

@ldrick

Description

@ldrick

Suggestion

See tseslint.config() is deprecated:
https://typescript-eslint.io/packages/typescript-eslint/#config-deprecated

It is recommended to setup plugins with defineConfig of eslint.

Trying to setup this plugin the recommended way results in:

Type 'EslintPluginFunctional' is not assignable to type 'Plugin'.
Types of property 'configs' are incompatible.
Type 'SharedConfigs & Readonly<{ all: Config; lite: Config; recommended: Config; strict: Config; off: Config; disableTypeChecked: Config; ... 7 more ...; stylistic: Config; }>' is not assignable to type 'Record<string, ConfigObject | LegacyConfigObject<RulesConfig, RulesConfig> | ConfigObject[]> | undefined'.ts(2322)

What I did (extraction from eslint.config.js):

// @ts-check

import functionalPlugin from 'eslint-plugin-functional';
import { defineConfig } from 'eslint/config';
import typescriptEslint from 'typescript-eslint';

export default defineConfig(
	// register all of the plugins upfront
	{
		plugins: {
			['@typescript-eslint']: typescriptEslint.plugin,
			// @ts-expect-error not compatible to use defineConfig
			['functional']: functionalPlugin,
		},
	},
        // many more configuration ...
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedThis issue or PR has been accepted.Type: EnhancementEnhancement of the code, not introducing new features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions