diff --git a/index.ts b/index.ts index cbe1141d0..8a8d53778 100644 --- a/index.ts +++ b/index.ts @@ -1,4 +1,7 @@ -import type { Linter, ESLint } from 'eslint' +import type { + ClassicConfig, + FlatConfig, +} from '@typescript-eslint/utils/ts-eslint' import sortIntersectionTypes from './rules/sort-intersection-types' import sortSvelteAttributes from './rules/sort-svelte-attributes' @@ -52,24 +55,24 @@ let plugin = { 'sort-maps': sortMaps, }, name, -} as unknown as ESLint.Plugin +} let getRules = (options: BaseOptions): Record => Object.fromEntries( - Object.keys(plugin.rules!).map(rule => [ + Object.keys(plugin.rules).map(rule => [ `${name}/${rule}`, ['error', options], ]), ) -let createConfig = (options: BaseOptions): Linter.FlatConfig => ({ +let createConfig = (options: BaseOptions): FlatConfig.Config => ({ plugins: { [name]: plugin, }, rules: getRules(options), }) -let createLegacyConfig = (options: BaseOptions): Linter.Config => ({ +let createLegacyConfig = (options: BaseOptions): ClassicConfig.Config => ({ rules: getRules(options), plugins: [name], }) diff --git a/tsconfig.json b/tsconfig.json index fcf1ebe54..0b4bff5e9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "target": "esnext", "types": ["node"], "allowJs": true, + "baseUrl": ".", "strict": true, "noEmit": true }