Skip to content

Commit 780a25a

Browse files
committed
fix: add explicit type annotation for plugin configs
1 parent fc297a2 commit 780a25a

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

index.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ import sortEnums from './rules/sort-enums'
2424
import sortMaps from './rules/sort-maps'
2525
import sortSets from './rules/sort-sets'
2626

27+
interface PluginConfigs {
28+
'recommended-alphabetical-legacy': Linter.LegacyConfig
29+
'recommended-line-length-legacy': Linter.LegacyConfig
30+
'recommended-natural-legacy': Linter.LegacyConfig
31+
'recommended-custom-legacy': Linter.LegacyConfig
32+
'recommended-alphabetical': Linter.Config
33+
'recommended-line-length': Linter.Config
34+
'recommended-natural': Linter.Config
35+
'recommended-custom': Linter.Config
36+
}
37+
2738
interface BaseOptions {
2839
type: 'alphabetical' | 'line-length' | 'natural' | 'custom'
2940
order: 'desc' | 'asc'
@@ -89,7 +100,7 @@ function createLegacyConfig(options: BaseOptions): Linter.LegacyConfig {
89100
}
90101
}
91102

92-
export let configs = {
103+
export let configs: PluginConfigs = {
93104
'recommended-alphabetical-legacy': createLegacyConfig({
94105
type: 'alphabetical',
95106
order: 'asc',
@@ -122,9 +133,9 @@ export let configs = {
122133
type: 'custom',
123134
order: 'asc',
124135
}),
125-
} as unknown as ESLint.Plugin['configs']
136+
}
126137

127138
export default {
128139
...plugin,
129140
configs,
130-
} as ESLint.Plugin
141+
} as { configs: PluginConfigs } & ESLint.Plugin

0 commit comments

Comments
 (0)