Enabling the fix flag for stdio
See original GitHub issueThe problem
I’m using SublimeLinter-contrib-eslint and I noticed that it operates on stdio. This is probably because the linter also works on non-yet-saved-files. I wanted to enable autofixing of the code, but it was not built-in and when manually passing the --fix
flag I saw that ESLint just exits with an error message. I decided that enabling --fix
and --stdin
together was the right first step to autofixing with the linter plugin.
The solution
Currently there are three proposed solutions:
- The one I’ve prepared a PR for (#9073), that utilizes a non-standard file descriptor (number 3, just after 0, 1, 2 for stdin, stdout, stderr respectively) for providing the fixed output.
- The one that comes from @not-an-aardvark, that suggests just removing the existing restriction and allowing the use of a custom formatter to retrieve the output.
- Add a new flag like
--fix-dry-run
that can be used with--stdin
, but doesn’t output fixes to the filesystem.
I’d be happy to go with either of them, and frankly, the second one feels like a more convenient option to use.
(edited by @not-an-aardvark to add the third proposed solution)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:20 (20 by maintainers)
Top Results From Across the Web
Configure - GCC, the GNU Compiler Collection
Select a target-specific I/O package. At the moment, the only choice is to use 'stdio', a generic "C" abstraction. The default is 'stdio'....
Read more >What is the alternative for -fpermssive flag in windows (visual ...
I tried adding the flags such as '/fpermissive' , '/Ze' in module properties->C/C++->command Line->Additional options. But it did not resolve ...
Read more >ToolChain/CompilerFlags - Ubuntu Wiki
This page documents the Ubuntu-specific default compiler flags in the toolchain used to help provide additional security features to Ubuntu.
Read more >/std (Specify Language Standard Version) | Microsoft Learn
This option disables compiler and standard library support for features that are new or changed after C++17. It specifically disables post-C++17 ...
Read more >New features in Android Studio Preview
If you need to enable RenderScript compilation, set the flag explicitly to true . This build feature should be enabled only in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@platinumazure Any thoughts on the updated proposal in https://github.com/eslint/eslint/issues/9076#issuecomment-320484888? If that proposal addresses your objections, then I’d like to add this to the TSC agenda for approval. Otherwise, we can discuss more to hopefully find the best solution.
No – to clarify, by “output” I mean the object that is usually passed to a formatter, which looks something like this:
Result list
Note that this includes the autofix output in the
"output"
property. (This output came from a run where theno-undef
andsemi
rules were enabled, and thesemi
problem was autofixed, so only theno-undef
problem was included in the problem list.)Yes, that’s the idea. You wouldn’t even need a custom formatter – you could use the built-in
json
formatter, which just takes objects like the one above and outputs them as JSON.