Description
This is a follow-up issue of this PR: #250.
It is only valid if this branch gets merged.
Original discussion #250 (comment):
Similarly, convertConfig and convertEditorConfig are really similar... I wonder if the common parts from both should be moved to some common runFileConversion helper? 🤷♂ maybe better to file a followup ticket to investigate; that feels like a kind of long-winded architectural debate.
🚀 Feature Request
This refactoring should not touch the general functionality. The goal is to remove a good portion of copy-paste code. However it may involve a greater architectural change in order to handle rule conversions and editor settings conversions similar.
Existing Behavior
convertConfig.ts
converts TSLint rules into ESLint rulesconvertEditorConfig.ts
converts TSLint editor configuration settings into ESLint editor configuration settings- A lot of copy-paste code with little variation
Change Proposal
The potential runFileConversion
could extract the commonalities out of the convertConfig
and convertEditorConfig
. Mainly these steps are taken:
- Existing configurations are read
- TSLint rules or settings are converted into their ESLint configurations
- Additonal steps (e.g. ESLint configurations are simplified based on extended ESLint presets)
- The simplified configuration is written to the output config file
- A summary of the results is printed to the user's console
The challenge is that the things to be done are quite similar, the data on which is operated differs in it's structure, e.g. the configuration that is read is of very different structures (rules files are typed very narrow, editor configuration settings are more unstructured)