作者:流血的云_-86097 | 来源:互联网 | 2023-08-31 21:34
Currently,
exits with a non-zero status code when it can't find a config file.
This is great for certain use cases, e.g. as a reminder for when you have forgotten to add a
file to a project directory.
But for other situations, e.g. when you have configured your editor to send any opened "*.js" file to
, and your editor warns you when the program exits with a non-zero status code, then it can be quite annoying to try and edit files from projects which do not use JSCS, as you will be bombarded with "No configuration found." messages.
Trivially, this is the particular case for a GNU Emacs + Flycheck setup defined as follows in a user's
file:
1 2 3 4 5 6 7 8
| lisp
(flycheck-define-checker Javascript-jscs
"JSCS - Javascript Code Style"
:command ("jscs" "--reporter=checkstyle" source-inplace)
:error-parser flycheck-parse-checkstyle
:modes (js-mode js2-mode js3-mode))
(add-to-list 'flycheck-checkers 'Javascript-jscs) |
One workaround is to
1
| echo '{}' >> ~/.jscsrc |
, but it's not a very good solution, especially if a user doesn't know to do that. This option allows you to no-op your way through the program if a config file is not found.
该提问来源于开源项目:jscs-dev/node-jscs
I do think that exit codes would be good in principle, but currently they would only benefit a single linter out of the set of linter packages you support.
Here's how they each handle errors:
- Atom: console.warns all errors
- Brackets: Doesn't use CLI
- Grunt: Doesn't use CLI
- Gulp: Doesn't use CLI
- Sublime: Doesn't handle exit codes
- Vim: Does handle exit codes
- Visual Studio: Doesn't use CLI
- IntelliJ et al: Exit code handling is commented-out
- and Flycheck: Doesn't differentiate exit codes
So your Vim users might appreciate (3), but it won't have any impact on the other linter packages without significant additions to those packages' APIs. I probably sound like a broken record at this point, but unless you plan on submitting a lot of PRs to improve the above situation, I recommend against creating an exit code lexicon.
I would be fine with (1), (2) or (4), since any of those solve my particular problem.