librelist archives

« back to archive

Linting with Node.js?

Linting with Node.js?

From:
Justin Clift
Date:
2012-09-28 @ 04:31
As another thought, does anyone have experience using linters
with Node.js?

Doing a search for jslint in npm shows roughly 30 odd potential
modules (below).

As a potential alternative "jshint" sounds reasonable, but I
haven't used it:

  http://anton.kovalyov.net/2011/02/20/why-i-forked-jslint-to-jshint/

It's npm module:

  https://github.com/jshint/node-jshint

We should probably find one that works well for what we want, and
standardise on it.

So... thoughts on the ones below, or try jshint, or ?

+ Justin

****************************************************************

$ npm search jslint
NAME                  DESCRIPTION
AUTHOR                DATE              KEYWORDS
anvil.jslint          JSLint plugin for anvil.js
=elijahmanor          2012-09-26 01:15  anvil jslint
autolint              Autolint watches your files for jslint-errors.
=magnars              2012-06-18 11:52  JavaScript lint jslint jshint
buster-lint           Buster-extension: jslint/jshint your files as part 
of test run. =magnars =cjohansen =augustl 2012-06-21 12:43
fixmyjs               Automatically fixes silly errors from jshint
=goatslacker          2012-08-20 02:39  jshint hint lint jslint
grunt-jslint          Validates JavaScript files with JSLint
=stephenmathieson     2012-09-26 18:55  gruntplugin
jslint                The JavaScript Code Quality Tool
=reid                 2012-08-07 23:20  lint
JSLint-commonJS       JSLint with commonJS exportability and package.json
=mikebannister        (prehistoric)
jslint-core           The JavaScript Code Quality Tool
=bramstein            2011-01-17 11:33  JavaScript lint jslint jslint-core
fulljslin
jslint-strict         A fork of Douglas Crockford's JSLint for Node.JS 
that auto-updates =coolaj86        2011-08-19 03:00
jslint-tap            A CLI for running JSLint with some helpers.
=irae                 2012-03-22 18:36
jslint_tool           让犯错变得困难
=jacksontian          2012-04-16 00:25
JSLintCli             JSLint implementation for command line
=rodrigok             2012-01-04 16:11
jsrevival             A javascript lib and cli linter using JSLint
=sdolard              2012-09-26 11:58  jslint linter cli
lint                  This package provide lint validation library + 
node-lint command line tool allows you to check for problems using JSLint.
You can specify your own
linter                Code quality tools collection in one module
=kof                  2011-03-23 14:13  code quality code style 
stylechecker lint js
lintnode              A JSLint server for more expedient linting.
=keturn               (prehistoric)
nlint                 Full project linting.
=codenothing          2012-08-02 13:44  lint jshint jslint jsonlint 
csslint
node-assert-lint-free JSLint assertion for unit testing in node.js
=mikebannister        (prehistoric)
node-jslint-all       A JSLint based JavaScript code quality tool
=davybrion            2011-08-21 20:46  jslint
node.f2ehint          custom css/js hint
=xunuo                2012-07-18 03:48  node.f2ehint csshint jshint js 
check tool js
node.jshit            jshint ext
=xunuo                2012-06-19 17:18  jshint js check tool jslint jshit
nodelint              The nodelint command line tool allows you to check 
for problems using JSLint. You can specify your own --config file to use 
alternate JSLint optio
ready.js              continuous javascript integration
=dsimard              2012-05-09 03:25  continuous integration jslint 
javascript min
readyjslint
=dsimard              2012-03-09 17:40
unittest-jslint       JSLint test case for unit testing
=mikebannister        (prehistoric)
voodoo                website checker/optimizer/cleaner
=jeroenbourgois       2012-08-02 13:44  continuous integration jslint 
javascript min
y                     y.js? Why not? - The little known (jslint-able) 
utility library for node.js or web browsers, and you! =javascriptismagic 
2012-08-03 21:06
yui-lint              Default JSlint rules used by YUI in it's various 
packages     =davglass             2012-08-20 18:34

****************************************************************


--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Linting with Node.js?

From:
Justin Clift
Date:
2012-09-30 @ 02:24
On 28/09/2012, at 2:31 PM, Justin Clift wrote:
> As another thought, does anyone have experience using linters
> with Node.js?


Looking more at JSHint, it seems to have configuration options
that fit our coding convention.

From it's docs page (www.jshint.com/docs/), these seem relevant
to us:

  camelcase: true
  curly: true
  indent: 4
  quotmark: "single"
  trailing: true
  
Not sure about these, but possibly useful too:

  eqeqeq

Still getting this stuff figured out though. ;)

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Linting with Node.js?

From:
Justin Clift
Date:
2012-09-30 @ 07:58
On 30/09/2012, at 12:24 PM, Justin Clift wrote:
> On 28/09/2012, at 2:31 PM, Justin Clift wrote:
>> As another thought, does anyone have experience using linters
>> with Node.js?
> 
> 
> Looking more at JSHint, it seems to have configuration options
> that fit our coding convention.
> 
>> From it's docs page (www.jshint.com/docs/), these seem relevant
> to us:
> 
>  camelcase: true
>  curly: true
>  indent: 4
>  quotmark: "single"
>  trailing: true
> 
> Not sure about these, but possibly useful too:
> 
>  eqeqeq
> 
> Still getting this stuff figured out though. ;)


William, do you have time to review this pull request?

  https://github.com/browserquest/BrowserQuest/pull/22

It's just the server side area.js file, cleaned up so
JSHint is happy with it.

In practise, it seems to work.  However, I'm not sure
of some things:

 + 'use strict'

   Sounds like a good idea, but unsure.


 + Moved the module export to the end

   Seems to let things work with the 'use strict',
   but I don't understand javascript class inheritance
   yet, so suspecting there's a better way.

?

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Linting with Node.js?

From:
Justin Clift
Date:
2012-10-02 @ 14:11
On 30/09/2012, at 5:58 PM, Justin Clift wrote:
<snip>
> In practise, it seems to work.  However, I'm not sure
> of some things:
> 
> + 'use strict'
> 
>   Sounds like a good idea, but unsure.

As a data point, the 'use strict' turned out to be a bad
idea for now.

It causes the source files to need every dependency
explicitly spelled out.

  ie var FOO = require('./foo');

That doesn't sound like a bad thing, except doing it
caused all kinds of weird errors.  They're probably
fixable, but I don't (yet) have the required knowledge
to do so. ;)

So, an update removing the 'use strict' bit has been pushed
to the master branch.

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org