-
Notifications
You must be signed in to change notification settings - Fork 101
Description
Suppose two TSLint rules end up generating output ESLint ban rule instances. Right now, the second rule will clobber over the first. How unfortunate!
In addition to src/rules/converters, there should be a src/rules/mergers that contains custom mergers for ESLint rule configs. They should take in any number configurations for a particular ESLint rule and output a single configuration. ban's merger, for example, would create a new ban config that bans all the things banned by the input configurations.
I'm thinking convertRules.ts would have to also receive a mergers: Map<string, RuleMerger>. Whenever the converted map receives a second output rule changes, it should use a merger to merge them. If a merger doesn't exist, there should be a ConversionError mentioning the failure.
Another strategy would be to store converted as a Map<string, ESLintRuleOptions[]> in convertRules.ts. At the end, all converted results would have to be looped over to check for arrays of length >=2.... seems less elegant.