New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Implement more powerful fix methods #656
Comments
Expand node selection range ⭐ Suggestionast-grep rule can only fix one target node at one time. This works fine for function statement/calls but it has always been problematic for list-item like items in an array, key-value pairs in a dictionary. We cannot delete an item because we also need to delete the surrounding comma. Similarly, the problem also applies to a statement if it has a semicolon. 💻 Use CasesAdd the
related: #746 The expand struct
|
Add prepend/append statements in fix⭐ SuggestionIt is usually desirable to prepend/append extra content to a file during a code fix. 💻 Use CasesSuppose we want to extract some repetitive code. const result = () => {
doSomeRepetitiveCode()
} to import { importedUtil } from 'utils' // note this line
const result = importedUtil() The first line should import the extracted util function from another file. Change console.log to logger.log console.log('message') to import logger from 'logger'
logger.log('message') |
This is an epic issue to track more powerful fix methods
The text was updated successfully, but these errors were encountered: