@@ -17,57 +17,6 @@ import (
17
17
rslintconfig "github.com/web-infra-dev/rslint/internal/config"
18
18
"github.com/web-infra-dev/rslint/internal/linter"
19
19
"github.com/web-infra-dev/rslint/internal/rule"
20
- "github.com/web-infra-dev/rslint/internal/rules/adjacent_overload_signatures"
21
- "github.com/web-infra-dev/rslint/internal/rules/array_type"
22
- "github.com/web-infra-dev/rslint/internal/rules/await_thenable"
23
- "github.com/web-infra-dev/rslint/internal/rules/class_literal_property_style"
24
- "github.com/web-infra-dev/rslint/internal/rules/no_array_delete"
25
- "github.com/web-infra-dev/rslint/internal/rules/no_base_to_string"
26
- "github.com/web-infra-dev/rslint/internal/rules/no_confusing_void_expression"
27
- "github.com/web-infra-dev/rslint/internal/rules/no_duplicate_type_constituents"
28
- "github.com/web-infra-dev/rslint/internal/rules/no_empty_function"
29
- "github.com/web-infra-dev/rslint/internal/rules/no_empty_interface"
30
- "github.com/web-infra-dev/rslint/internal/rules/no_floating_promises"
31
- "github.com/web-infra-dev/rslint/internal/rules/no_for_in_array"
32
- "github.com/web-infra-dev/rslint/internal/rules/no_implied_eval"
33
- "github.com/web-infra-dev/rslint/internal/rules/no_meaningless_void_operator"
34
- "github.com/web-infra-dev/rslint/internal/rules/no_misused_promises"
35
- "github.com/web-infra-dev/rslint/internal/rules/no_misused_spread"
36
- "github.com/web-infra-dev/rslint/internal/rules/no_mixed_enums"
37
- "github.com/web-infra-dev/rslint/internal/rules/no_namespace"
38
- "github.com/web-infra-dev/rslint/internal/rules/no_redundant_type_constituents"
39
- "github.com/web-infra-dev/rslint/internal/rules/no_require_imports"
40
- "github.com/web-infra-dev/rslint/internal/rules/no_unnecessary_boolean_literal_compare"
41
- "github.com/web-infra-dev/rslint/internal/rules/no_unnecessary_template_expression"
42
- "github.com/web-infra-dev/rslint/internal/rules/no_unnecessary_type_arguments"
43
- "github.com/web-infra-dev/rslint/internal/rules/no_unnecessary_type_assertion"
44
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_argument"
45
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_assignment"
46
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_call"
47
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_enum_comparison"
48
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_member_access"
49
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_return"
50
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_type_assertion"
51
- "github.com/web-infra-dev/rslint/internal/rules/no_unsafe_unary_minus"
52
- "github.com/web-infra-dev/rslint/internal/rules/no_unused_vars"
53
- "github.com/web-infra-dev/rslint/internal/rules/no_useless_empty_export"
54
- "github.com/web-infra-dev/rslint/internal/rules/no_var_requires"
55
- "github.com/web-infra-dev/rslint/internal/rules/non_nullable_type_assertion_style"
56
- "github.com/web-infra-dev/rslint/internal/rules/only_throw_error"
57
- "github.com/web-infra-dev/rslint/internal/rules/prefer_as_const"
58
- "github.com/web-infra-dev/rslint/internal/rules/prefer_promise_reject_errors"
59
- "github.com/web-infra-dev/rslint/internal/rules/prefer_reduce_type_parameter"
60
- "github.com/web-infra-dev/rslint/internal/rules/prefer_return_this_type"
61
- "github.com/web-infra-dev/rslint/internal/rules/promise_function_async"
62
- "github.com/web-infra-dev/rslint/internal/rules/related_getter_setter_pairs"
63
- "github.com/web-infra-dev/rslint/internal/rules/require_array_sort_compare"
64
- "github.com/web-infra-dev/rslint/internal/rules/require_await"
65
- "github.com/web-infra-dev/rslint/internal/rules/restrict_plus_operands"
66
- "github.com/web-infra-dev/rslint/internal/rules/restrict_template_expressions"
67
- "github.com/web-infra-dev/rslint/internal/rules/return_await"
68
- "github.com/web-infra-dev/rslint/internal/rules/switch_exhaustiveness_check"
69
- "github.com/web-infra-dev/rslint/internal/rules/unbound_method"
70
- "github.com/web-infra-dev/rslint/internal/rules/use_unknown_in_catch_callback_variable"
71
20
"github.com/web-infra-dev/rslint/internal/utils"
72
21
)
73
22
@@ -107,73 +56,19 @@ func (h *IPCHandler) HandleLint(req api.LintRequest) (*api.LintResponse, error)
107
56
}
108
57
109
58
// Initialize rule registry with all available rules
110
- rslintconfig .RegisterAllTypeScriptEslintPluginRules ()
59
+ rslintconfig .RegisterAllRules ()
111
60
112
61
// Load rslint configuration and determine which tsconfig files to use
113
62
_ , tsConfigs , configDirectory := rslintconfig .LoadConfigurationWithFallback (req .Config , currentDirectory , fs )
114
63
115
- // Create rules
116
- var origin_rules = []rule.Rule {
117
- adjacent_overload_signatures .AdjacentOverloadSignaturesRule ,
118
- array_type .ArrayTypeRule ,
119
- await_thenable .AwaitThenableRule ,
120
- class_literal_property_style .ClassLiteralPropertyStyleRule ,
121
- no_array_delete .NoArrayDeleteRule ,
122
- no_base_to_string .NoBaseToStringRule ,
123
- no_confusing_void_expression .NoConfusingVoidExpressionRule ,
124
- no_duplicate_type_constituents .NoDuplicateTypeConstituentsRule ,
125
- no_empty_function .NoEmptyFunctionRule ,
126
- no_empty_interface .NoEmptyInterfaceRule ,
127
- no_floating_promises .NoFloatingPromisesRule ,
128
- no_for_in_array .NoForInArrayRule ,
129
- no_implied_eval .NoImpliedEvalRule ,
130
- no_meaningless_void_operator .NoMeaninglessVoidOperatorRule ,
131
- no_misused_promises .NoMisusedPromisesRule ,
132
- no_misused_spread .NoMisusedSpreadRule ,
133
- no_mixed_enums .NoMixedEnumsRule ,
134
- no_namespace .NoNamespaceRule ,
135
- no_redundant_type_constituents .NoRedundantTypeConstituentsRule ,
136
- no_require_imports .NoRequireImportsRule ,
137
- no_unnecessary_boolean_literal_compare .NoUnnecessaryBooleanLiteralCompareRule ,
138
- no_unnecessary_template_expression .NoUnnecessaryTemplateExpressionRule ,
139
- no_unnecessary_type_arguments .NoUnnecessaryTypeArgumentsRule ,
140
- no_unnecessary_type_assertion .NoUnnecessaryTypeAssertionRule ,
141
- no_unsafe_argument .NoUnsafeArgumentRule ,
142
- no_unsafe_assignment .NoUnsafeAssignmentRule ,
143
- no_unsafe_call .NoUnsafeCallRule ,
144
- no_unsafe_enum_comparison .NoUnsafeEnumComparisonRule ,
145
- no_unsafe_member_access .NoUnsafeMemberAccessRule ,
146
- no_unsafe_return .NoUnsafeReturnRule ,
147
- no_unsafe_type_assertion .NoUnsafeTypeAssertionRule ,
148
- no_unsafe_unary_minus .NoUnsafeUnaryMinusRule ,
149
- no_unused_vars .NoUnusedVarsRule ,
150
- no_useless_empty_export .NoUselessEmptyExportRule ,
151
- no_var_requires .NoVarRequiresRule ,
152
- non_nullable_type_assertion_style .NonNullableTypeAssertionStyleRule ,
153
- only_throw_error .OnlyThrowErrorRule ,
154
- prefer_as_const .PreferAsConstRule ,
155
- prefer_promise_reject_errors .PreferPromiseRejectErrorsRule ,
156
- prefer_reduce_type_parameter .PreferReduceTypeParameterRule ,
157
- prefer_return_this_type .PreferReturnThisTypeRule ,
158
- promise_function_async .PromiseFunctionAsyncRule ,
159
- related_getter_setter_pairs .RelatedGetterSetterPairsRule ,
160
- require_array_sort_compare .RequireArraySortCompareRule ,
161
- require_await .RequireAwaitRule ,
162
- restrict_plus_operands .RestrictPlusOperandsRule ,
163
- restrict_template_expressions .RestrictTemplateExpressionsRule ,
164
- return_await .ReturnAwaitRule ,
165
- switch_exhaustiveness_check .SwitchExhaustivenessCheckRule ,
166
- unbound_method .UnboundMethodRule ,
167
- use_unknown_in_catch_callback_variable .UseUnknownInCatchCallbackVariableRule ,
168
- }
169
64
type RuleWithOption struct {
170
65
rule rule.Rule
171
66
option interface {}
172
67
}
173
68
rulesWithOptions := []RuleWithOption {}
174
69
// filter rule based on request.RuleOptions
175
70
if len (req .RuleOptions ) > 0 {
176
- for _ , r := range origin_rules {
71
+ for _ , r := range rslintconfig . GlobalRuleRegistry . GetAllRules () {
177
72
if option , ok := req .RuleOptions [r .Name ]; ok {
178
73
rulesWithOptions = append (rulesWithOptions , RuleWithOption {
179
74
rule : r ,
0 commit comments