|
1 | | -import { TSESLint } from '@typescript-eslint/utils'; |
| 1 | +import type { TSESLint } from '@typescript-eslint/utils'; |
| 2 | +import type { ESLint, Rule } from 'eslint'; |
2 | 3 | import { name, version } from '../package.json'; |
3 | 4 | import { createRecommendedConfig } from './configs/recommended'; |
4 | 5 | import { createStrictConfig } from './configs/strict'; |
@@ -49,63 +50,66 @@ import { preferRootOperatorsRule } from './rules/prefer-root-operators'; |
49 | 50 | import { suffixSubjectsRule } from './rules/suffix-subjects'; |
50 | 51 | import { throwErrorRule } from './rules/throw-error'; |
51 | 52 |
|
| 53 | +const allRules = { |
| 54 | + 'ban-observables': banObservablesRule, |
| 55 | + 'ban-operators': banOperatorsRule, |
| 56 | + 'finnish': finnishRule, |
| 57 | + 'just': justRule, |
| 58 | + 'macro': macroRule, |
| 59 | + 'no-async-subscribe': noAsyncSubscribeRule, |
| 60 | + 'no-compat': noCompatRule, |
| 61 | + 'no-connectable': noConnectableRule, |
| 62 | + 'no-create': noCreateRule, |
| 63 | + 'no-cyclic-action': noCyclicActionRule, |
| 64 | + 'no-explicit-generics': noExplicitGenericsRule, |
| 65 | + 'no-exposed-subjects': noExposedSubjectsRule, |
| 66 | + 'no-finnish': noFinnishRule, |
| 67 | + 'no-floating-observables': noFloatingObservablesRule, |
| 68 | + 'no-ignored-default-value': noIgnoredDefaultValueRule, |
| 69 | + 'no-ignored-error': noIgnoredErrorRule, |
| 70 | + 'no-ignored-notifier': noIgnoredNotifierRule, |
| 71 | + 'no-ignored-replay-buffer': noIgnoredReplayBufferRule, |
| 72 | + 'no-ignored-subscribe': noIgnoredSubscribeRule, |
| 73 | + 'no-ignored-subscription': noIgnoredSubscriptionRule, |
| 74 | + 'no-ignored-takewhile-value': noIgnoredTakewhileValueRule, |
| 75 | + 'no-implicit-any-catch': noImplicitAnyCatchRule, |
| 76 | + 'no-index': noIndexRule, |
| 77 | + 'no-internal': noInternalRule, |
| 78 | + 'no-misused-observables': noMisusedObservablesRule, |
| 79 | + 'no-nested-subscribe': noNestedSubscribeRule, |
| 80 | + 'no-redundant-notify': noRedundantNotifyRule, |
| 81 | + 'no-sharereplay': noSharereplayRule, |
| 82 | + 'no-subclass': noSubclassRule, |
| 83 | + 'no-subject-unsubscribe': noSubjectUnsubscribeRule, |
| 84 | + 'no-subject-value': noSubjectValueRule, |
| 85 | + 'no-subscribe-handlers': noSubscribeHandlersRule, |
| 86 | + 'no-subscribe-in-pipe': noSubscribeInPipeRule, |
| 87 | + 'no-tap': noTapRule, |
| 88 | + 'no-topromise': noTopromiseRule, |
| 89 | + 'no-unbound-methods': noUnboundMethodsRule, |
| 90 | + 'no-unsafe-catch': noUnsafeCatchRule, |
| 91 | + 'no-unsafe-first': noUnsafeFirstRule, |
| 92 | + 'no-unsafe-subject-next': noUnsafeSubjectNext, |
| 93 | + 'no-unsafe-switchmap': noUnsafeSwitchmapRule, |
| 94 | + 'no-unsafe-takeuntil': noUnsafeTakeuntilRule, |
| 95 | + 'prefer-observer': preferObserverRule, |
| 96 | + 'prefer-root-operators': preferRootOperatorsRule, |
| 97 | + 'suffix-subjects': suffixSubjectsRule, |
| 98 | + 'throw-error': throwErrorRule, |
| 99 | +} satisfies TSESLint.FlatConfig.Plugin['rules']; |
| 100 | + |
52 | 101 | const plugin = { |
53 | 102 | meta: { name, version }, |
54 | | - rules: { |
55 | | - 'ban-observables': banObservablesRule, |
56 | | - 'ban-operators': banOperatorsRule, |
57 | | - 'finnish': finnishRule, |
58 | | - 'just': justRule, |
59 | | - 'macro': macroRule, |
60 | | - 'no-async-subscribe': noAsyncSubscribeRule, |
61 | | - 'no-compat': noCompatRule, |
62 | | - 'no-connectable': noConnectableRule, |
63 | | - 'no-create': noCreateRule, |
64 | | - 'no-cyclic-action': noCyclicActionRule, |
65 | | - 'no-explicit-generics': noExplicitGenericsRule, |
66 | | - 'no-exposed-subjects': noExposedSubjectsRule, |
67 | | - 'no-finnish': noFinnishRule, |
68 | | - 'no-floating-observables': noFloatingObservablesRule, |
69 | | - 'no-ignored-default-value': noIgnoredDefaultValueRule, |
70 | | - 'no-ignored-error': noIgnoredErrorRule, |
71 | | - 'no-ignored-notifier': noIgnoredNotifierRule, |
72 | | - 'no-ignored-replay-buffer': noIgnoredReplayBufferRule, |
73 | | - 'no-ignored-subscribe': noIgnoredSubscribeRule, |
74 | | - 'no-ignored-subscription': noIgnoredSubscriptionRule, |
75 | | - 'no-ignored-takewhile-value': noIgnoredTakewhileValueRule, |
76 | | - 'no-implicit-any-catch': noImplicitAnyCatchRule, |
77 | | - 'no-index': noIndexRule, |
78 | | - 'no-internal': noInternalRule, |
79 | | - 'no-misused-observables': noMisusedObservablesRule, |
80 | | - 'no-nested-subscribe': noNestedSubscribeRule, |
81 | | - 'no-redundant-notify': noRedundantNotifyRule, |
82 | | - 'no-sharereplay': noSharereplayRule, |
83 | | - 'no-subclass': noSubclassRule, |
84 | | - 'no-subject-unsubscribe': noSubjectUnsubscribeRule, |
85 | | - 'no-subject-value': noSubjectValueRule, |
86 | | - 'no-subscribe-handlers': noSubscribeHandlersRule, |
87 | | - 'no-subscribe-in-pipe': noSubscribeInPipeRule, |
88 | | - 'no-tap': noTapRule, |
89 | | - 'no-topromise': noTopromiseRule, |
90 | | - 'no-unbound-methods': noUnboundMethodsRule, |
91 | | - 'no-unsafe-catch': noUnsafeCatchRule, |
92 | | - 'no-unsafe-first': noUnsafeFirstRule, |
93 | | - 'no-unsafe-subject-next': noUnsafeSubjectNext, |
94 | | - 'no-unsafe-switchmap': noUnsafeSwitchmapRule, |
95 | | - 'no-unsafe-takeuntil': noUnsafeTakeuntilRule, |
96 | | - 'prefer-observer': preferObserverRule, |
97 | | - 'prefer-root-operators': preferRootOperatorsRule, |
98 | | - 'suffix-subjects': suffixSubjectsRule, |
99 | | - 'throw-error': throwErrorRule, |
100 | | - }, |
101 | | -} satisfies TSESLint.FlatConfig.Plugin; |
| 103 | + /** Compatibility with `defineConfig` until https://github.com/typescript-eslint/typescript-eslint/issues/11543 is addressed. */ |
| 104 | + rules: allRules as { [K in keyof typeof allRules]: (typeof allRules)[K] & Rule.RuleModule }, |
| 105 | +} satisfies ESLint.Plugin; |
102 | 106 |
|
103 | 107 | const rxjsX = { |
104 | 108 | ...plugin, |
105 | 109 | configs: { |
106 | 110 | recommended: createRecommendedConfig(plugin), |
107 | 111 | strict: createStrictConfig(plugin), |
108 | 112 | }, |
109 | | -} satisfies TSESLint.FlatConfig.Plugin; |
| 113 | +} satisfies ESLint.Plugin; |
110 | 114 |
|
111 | 115 | export default rxjsX; |
0 commit comments