-
Notifications
You must be signed in to change notification settings - Fork 91
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
add command to check style #292
Comments
the funny thing is that JSCS started as a code style checker and is adding support to automatically format code and we started as a formatter and are planning to add features to check style 😉 |
My initial motivation when I got involved here was to build something like the style checking that jscs does. I now use both jscs and esformatter, one for checking, one for formatting. I still like the test output of esformatter - if that gets reduced to relevant lines, with annotated line and column numbers, but keeping the red/green actual/expected output, I'd try to use this in place of jscs, still. |
maybe @piuccio is interested in merging his work into esformatter itself (https://github.com/piuccio/esformatter-diff) |
I couldn't find a tool that did what I needed (output pretty diffs keeping only lines that are useful for "context" and also displaying invisible chars) so I ended up writing my own: https://github.com/millermedeiros/disparity now it should be easy to integrate it into esformatter |
also simplify the way errors are logged
also simplify the way errors are logged
in the end it isn't a # check if "test.js" matches style and output diff to stdout
esformatter --diff test.js
# check if "test.js" matches style and output unified diff to stdout
esformatter --diff-unified test.js
# check if "test.js" matches "options.json" style and output diff to stdout
esformatter --diff --config options.json test.js
# check all files inside "lib/" and it's subfolders
esformatter --diff lib/**/*.js |
I was initially thinking on keeping this project as simple as possible and let other tools derive from it, but I think we should have our own
check
command (always be in sync with latest release). eg:# check if file is formatted properly esformatter check foo.js
ideally do something similar to what we do during the unit tests (highlight expected tokens as green and actual tokens as red) but displaying only the lines that have differences.
we should also add an option for unified diff (with and without color) since other tools can consume this format and some terminals don't support color.
# unified diff without color esformatter check --unified-no-color foo.js
the diff module is a good option.
The text was updated successfully, but these errors were encountered: