Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

jshint defaults #759

Closed
devinrhode2 opened this Issue · 7 comments

4 participants

@devinrhode2

Specifically, camelcase: true goes out the door once you're using some json api's that have underscores in some of the key names.

This thread can also serve as general discussion for jshint defaults. @antonkovalyov could probably vouch for the best set of defaults.

@devinrhode2

Another thing regarding defaults: there are 2 sets in 2 different locations, .jshintrc and in the Gruntfile

As a developer learning yeoman, I wonder: which one get's used and when? What default options are the best?

@sindresorhus
Owner

The included .jshintrc file is created with the intention to "force" a sane JS initial environment upon developers. It's meant to be changed a tiny bit, like quotmark and indent, but the rest is common sense which we recommend.

{
    "node": true,
    "browser": true,
    "es5": true,
    "esnext": true,
    "bitwise": true,
    "camelcase": true,
    "curly": true,
    "eqeqeq": true,
    "immed": true,
    "indent": 4,
    "latedef": true,
    "newcap": true,
    "noarg": true,
    "quotmark": "single",
    "regexp": true,
    "undef": true,
    "unused": true,
    "strict": true,
    "trailing": true,
    "smarttabs": true
}

Specifically, camelcase: true goes out the door once you're using some json api's that have underscores in some of the key names.

Then just override with inline rules /*jshint camelCase:false */ in those few instances.

As a developer learning yeoman, I wonder: which one get's used and when? What default options are the best?

Yeoman currently depends on a devel version of grunt which doesn't yet have support for reading .jshintrc files, but it's included for other usage; editors and stuff. Though this will be fixed in a couple of weeks.

@devinrhode2
@valueof

@devinrhode2 My personal set of defaults is pretty strict so you'll probably hate it. :-) Also, options on JSHint website worked out pretty well for a lot of developers.

@devinrhode2

that's what I was thinking, where could we easily access these?

@valueof
/*jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true,
strict:true, undef:true, unused:true, curly:true, browser:true, devel:true,
indent:4, maxerr:50 */
@zobier

I'm for putting overrides in the comments as it documents your decisions (or in the case of APIs, where you are forced) to other developers like using bitwise operators or boss mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.