reid / node-jslint

The JavaScript Code Quality Tool — for Node.js.
http://jslint.com/
Other
491 stars 101 forks source link

How to configure whitespace in es6 #156

Closed mk-pmb closed 8 years ago

mk-pmb commented 8 years ago

Somehow it cannot accept two-spaces indentation in es6 mode, why is that and can it be fixed?

+$ nl -ba hello_world.js
      1  /*jslint indent: 2, maxlen: 80, node: true */
      2  console.log('hello' +
      3    ' world');
+$ jslint hello_world.js

 hello_world.js is OK.
+$ jslint --edition=es6 hello_world.js

 hello_world.js
- #1 Bad option 'indent'.
     /*jslint indent: 2, maxlen: 80, node: true */ // Line 0, Pos 0
- #2 Expected ' world' at column 8, not column 2.
     ' world'); // Line 2, Pos 2
+$ jslint --version
 node-jslint version: 0.10.1  JSLint edition 2013-08-26
smikes commented 8 years ago

It appears that the indent option is deprecated in jslint-es6, see http://www.jslint.com/help.html

Please note that this project, node-jslint, just provides the wrapper scripts. jslint itself is written by Douglas Crockford ( https://github.com/douglascrockford/jslint ) with a discussion forum ( https://github.com/douglascrockford/jslint ) -- if you want an explanation for Douglas's decisions and/or to make feature requests about the actual linter, that's the place to do it.

If you'd like a more configurable and less strict linter, check out eslint: http://eslint.org

mk-pmb commented 8 years ago

Will do, thanks!

mk-pmb commented 8 years ago

I made a feature request and an experimental implementation of custom indentation. If anyone more well-versed in jslint could have a look, I'd appreciate that.

mk-pmb commented 8 years ago

Update: Current jslint doesn't accept any indentation config, it's hard-coded to 4 spaces, with magic numbers even. The --indent= option to node-jslint doesn't have any effect anymore. → Should node-jslint thus warn if --indent= is given for a 2015-or-later edition?

Looks like DC doesn't like to, or couldn't yet spare the time to, point me to an explanation of his decision against custom indentation.

In the time until I come to understand it, would you prefer I try and research ways to → make node-jslint emulate the now missing --indent= support? Or should I rather switch to eslint instead? In that case, do you know of a project that maintains an eslint config that mimics jslint?