You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With this option, all errors that can be fixed will be fixed and all other errors will be outputted as usual.
The performed fixes are also part of the CLI output (ResultCliModel), but a very consice output like "9 fixes applied" would be sufficient.
Proposed Internal Implementation
IRule is extended with an optional fix method. It outputs a new ResultFixModel containing the fixed ResultErrorModel array and the modified/fixed FileLanguageModel (aka. specified translations in en.json).
After running all lints and excluding ignoredKeys, we run all available fix methods. If the outputted FileLanguageModel differs from the original, we persist those changes. We also remove all errors that were being fixed.
Alternatives
I considered extending the ErrorTypes enum with a fix value but this would have some disadvantages:
The purpose of the enum would be ambiguous. The enum should only describe the significance of the error ("disabled", "warning", "error") and not what we should do with it.
It would be overkill. We either want "just lint" or we want to apply fixes. There is no need for something more flexible.
It would deviate from eslint's API convention for no good reason.
Considerations
Does this feature fit well within the scope of this project or would it make more sense to consider it a separate project? Personally, I think it fits well because this feature would benefit from existing functionality and configurations such as ignoredKeys, customRegExpToFindKeys etc.
@itekaf What do you think about this proposal and would you consider looking into a PR (from anyone) addressing this feature?
The text was updated successfully, but these errors were encountered:
Feature: Fix Option for Removing Zombies
As a devoloper, I would like to run this linter with a fix option so that all zombies are automatically removed.
When is this useful?
Propsed API
I propose adding a --fix flag, similar to eslint.
With this option, all errors that can be fixed will be fixed and all other errors will be outputted as usual.
The performed fixes are also part of the CLI output (ResultCliModel), but a very consice output like "9 fixes applied" would be sufficient.
Proposed Internal Implementation
IRule
is extended with an optionalfix
method. It outputs a newResultFixModel
containing the fixedResultErrorModel
array and the modified/fixed FileLanguageModel (aka. specified translations in en.json).After running all lints and excluding
ignoredKeys
, we run all available fix methods. If the outputted FileLanguageModel differs from the original, we persist those changes. We also remove all errors that were being fixed.Alternatives
I considered extending the
ErrorTypes
enum with afix
value but this would have some disadvantages:Considerations
Does this feature fit well within the scope of this project or would it make more sense to consider it a separate project? Personally, I think it fits well because this feature would benefit from existing functionality and configurations such as
ignoredKeys
,customRegExpToFindKeys
etc.@itekaf What do you think about this proposal and would you consider looking into a PR (from anyone) addressing this feature?
The text was updated successfully, but these errors were encountered: