jscs-dev / node-jscs

:arrow_heading_up: JavaScript Code Style checker (unmaintained)
https://jscs-dev.github.io
MIT License
4.97k stars 515 forks source link

not possible to include extensions with multiple "." characters #2273

Closed graingert closed 8 years ago

graingert commented 8 years ago

https://github.com/graingert/jscs-error With only .es2015.js files included:

{
    "preset": "airbnb",
    "fileExtensions": ['.es2015.js']
}

JSCS still complains if .js files have errors:

$ npm install
$ ./node_modules/.bin/jscs src
Unexpected character '#' (3:4) at src/old.js :
     1 |sdlkfjhskldjads
     2 |asdf
     3 |asdf#
------------^
     4 |asdf
     5 |asdf

1 code style error found.
markelog commented 8 years ago

Well in that case, i.e. *.es2015.js, file extension would be .js, like require("path").extname('test.a.b') would be .b. For example if you filename would be v1.0.js, extension should still be .js.

You can mitigate this by not linting the full folder, but using glob like jscs **/*.es2015.js

graingert commented 8 years ago

This is supported by eslint

graingert commented 8 years ago

Also jscs doesn't support globs it has to be expanded by the shell

markelog commented 8 years ago

You can use globs in .eslintignore yes, if that is what you mean by "supported", but you can't use it with --ext flag.

You can use glob patterns with jscs from the command line

graingert commented 8 years ago

still fails when using ".es" https://github.com/graingert/jscs-error/tree/a7a0778de32084d9b8b1dd75bfb4ca0f92d2356a

graingert commented 8 years ago

@markelog also you can use it with the ext flag: ./node_modules/.bin/eslint --ext .es2015.js src, works just fine.

graingert commented 8 years ago

@markelog can you reopen this please? Not sure what you mean by:

Well in that case, i.e. *.es2015.js, file extension would be .js, like require("path").extname('test.a.b') would be .b. For example if you filename would be v1.0.js, extension should still be .js.

You can mitigate this by not linting the full folder, but using glob like jscs */.es2015.js

Because in the case of *.es2015.js, the file extension would be .es2015.js and .js. require('lodash').endsWith('test.a.b', '.a.b') would be true and require('lodash').endsWith('test.b', '.a.b') would be false . Still when you had v1.0.js the extension would be .js. But you could also only test: 0.js files.