Skip to content

Refactor common parts of convertConfig and convertEditorConfig into runFileConversion helper #274

Closed
@MrCube42

Description

@MrCube42

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 rules
  • convertEditorConfig.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:

  1. Existing configurations are read
  2. TSLint rules or settings are converted into their ESLint configurations
  3. Additonal steps (e.g. ESLint configurations are simplified based on extended ESLint presets)
  4. The simplified configuration is written to the output config file
  5. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: aged awayNot enough activity occurred on this issue in a reasonable amount of time to justify taking action.type: cleanupCode smells, incorrect tests, build systems, or other internal shenanigans

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions