Feature request: how to fail a build for particular code fixes? #25105
Labels
Out of Scope
This idea sits outside of the TypeScript language design constraints
Suggestion
An idea for TypeScript
Search Terms
code fix warn error fail build lint tslint
Suggestion
Some code fixes, such as @elizabethdinella's super exciting #25082, are important enough that some projects would want to fail a build if any code actions of that particular type are suggested. Fixes such as async/await conversion and unused variable removals would be helpful, while optional fixes such as converting members to getter+setter pairs likely wouldn't be. Projects would likely need to configure their own preferences.
Use Cases
Suppose you have a repository that's been fully converted to
async
/await
and someone sends a pull request containing a.then
can can be converted away using a code fix. We would want to fail the build for the user not having done so. How?Examples
One option would be for TypeScript to have a setting on the CLI & tsconfig.json for code fixes to emit as diagnostic errors. This would require each code fix to have a friendly name:
Alternately, we could write TSLint rules for each code fix (or one rule with settings & AST walker logic?) per code fix. no-unused-variable uses the diagnostics emit to read TS-native warnings; we could do a similar thing with crawling the tree.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: