question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`autofix` option for lint messages?

See original GitHub issue

In addition to the existing column, line, ruleId, message, severity, etc. properties defined for a lint message, would you be open to supporting an autofix property (and updating many of the built-in rules to use it)?

For example, a JavaScript linter that tells you that you are missing a semicolon should provide the user the option to just add the semicolon in the right spot. This is something that could easily have an autofix option.

I was thinking the value of autofix could be either a string diff to apply to the file to fix the lint or a JavaScript function that would take the source as input and return the “fixed” source as output (or it could return the diff as a string). The latter is not JSON-serializable, but might be useful for lazily generating the value from autofix. In an IDE that runs the linter repeatedly, it’s important that the linter runs quickly, so I want to avoid a situation where autofix support slows things down.

Arcanist Lint supports the autofix property, though it appears to be a severity level and the patches are a separate property. There isn’t a code example there, but it sounds like there can be an array of patches, which seems sensible.

See also https://github.com/AtomLinter/Linter/issues/418

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:29 (12 by maintainers)

github_iconTop GitHub Comments

11reactions
bolinfestcommented, Feb 7, 2015

It always seems a little lame when a computer can tell me that I’m missing a semicolon yet can’t add it for me.

0reactions
gyandeepscommented, May 22, 2015

I am going to close this issue as this is one of the items on this issue: https://github.com/eslint/eslint/issues/2203 For further discussions lets talk on the above mentioned issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Enable Linting on Save with Visual Studio Code ...
Learn how to lint your code on every file save using ESLint rules and VS Code settings.
Read more >
sass-lint-auto-fix
Automatically resolve sass-linting issues through CLI. Latest version: 0.21.2, last published: 2 years ago. Start using sass-lint-auto-fix ...
Read more >
Auto-fix patch is wrong when multiple issue affect the same line
Autofix only adjusts prompt behavior and lint has always included many beautification rules since day one, and has always assumed that the majority...
Read more >
[lint] cmd/golint: introduce auto fix option (--fix)
This patch introduces an option to fix pointed out warnings automatically. This one provides such function partially; actually it has the only naming...
Read more >
Auto fix TSLint Warnings - angular
After updating this, go to any file and try giving some spaces and it shows tslint warning message as "trailing whitespace" and when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found