Skip to content

Commit af1ce61

Browse files
committed
fix: improve plugin type compatibility
1 parent 08d69ca commit af1ce61

File tree

1 file changed

+5
-46
lines changed

1 file changed

+5
-46
lines changed

index.ts

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ESLint, Linter, Rule } from 'eslint'
1+
import type { ESLint, Linter } from 'eslint'
22

33
import { version as packageVersion, name as packageName } from './package.json'
44
import sortVariableDeclarations from './rules/sort-variable-declarations'
@@ -24,47 +24,6 @@ import sortEnums from './rules/sort-enums'
2424
import sortMaps from './rules/sort-maps'
2525
import sortSets from './rules/sort-sets'
2626

27-
interface PluginConfig {
28-
rules: {
29-
'sort-variable-declarations': Rule.RuleModule
30-
'sort-intersection-types': Rule.RuleModule
31-
'sort-import-attributes': Rule.RuleModule
32-
'sort-export-attributes': Rule.RuleModule
33-
'sort-heritage-clauses': Rule.RuleModule
34-
'sort-array-includes': Rule.RuleModule
35-
'sort-named-imports': Rule.RuleModule
36-
'sort-named-exports': Rule.RuleModule
37-
'sort-object-types': Rule.RuleModule
38-
'sort-union-types': Rule.RuleModule
39-
'sort-switch-case': Rule.RuleModule
40-
'sort-interfaces': Rule.RuleModule
41-
'sort-decorators': Rule.RuleModule
42-
'sort-jsx-props': Rule.RuleModule
43-
'sort-modules': Rule.RuleModule
44-
'sort-classes': Rule.RuleModule
45-
'sort-imports': Rule.RuleModule
46-
'sort-exports': Rule.RuleModule
47-
'sort-objects': Rule.RuleModule
48-
'sort-enums': Rule.RuleModule
49-
'sort-sets': Rule.RuleModule
50-
'sort-maps': Rule.RuleModule
51-
}
52-
configs: {
53-
'recommended-alphabetical-legacy': Linter.LegacyConfig
54-
'recommended-line-length-legacy': Linter.LegacyConfig
55-
'recommended-natural-legacy': Linter.LegacyConfig
56-
'recommended-custom-legacy': Linter.LegacyConfig
57-
'recommended-alphabetical': Linter.Config
58-
'recommended-line-length': Linter.Config
59-
'recommended-natural': Linter.Config
60-
'recommended-custom': Linter.Config
61-
}
62-
meta: {
63-
version: string
64-
name: string
65-
}
66-
}
67-
6827
interface BaseOptions {
6928
type: 'alphabetical' | 'line-length' | 'natural' | 'custom'
7029
order: 'desc' | 'asc'
@@ -95,7 +54,7 @@ export let rules = {
9554
'sort-enums': sortEnums,
9655
'sort-sets': sortSets,
9756
'sort-maps': sortMaps,
98-
}
57+
} as unknown as ESLint.Plugin['rules']
9958

10059
let plugin = {
10160
meta: {
@@ -130,7 +89,7 @@ function createLegacyConfig(options: BaseOptions): Linter.LegacyConfig {
13089
}
13190
}
13291

133-
export let configs: PluginConfig['configs'] = {
92+
export let configs = {
13493
'recommended-alphabetical-legacy': createLegacyConfig({
13594
type: 'alphabetical',
13695
order: 'asc',
@@ -163,9 +122,9 @@ export let configs: PluginConfig['configs'] = {
163122
type: 'custom',
164123
order: 'asc',
165124
}),
166-
}
125+
} as unknown as ESLint.Plugin['configs']
167126

168127
export default {
169128
...plugin,
170129
configs,
171-
} as PluginConfig
130+
} as ESLint.Plugin

0 commit comments

Comments
 (0)