javascript - Disabling JSHint indentation check only for a specific file -
i use jshint indent enforcing option enabled , set 4, , keep way files in codebase.
in 1 specific file though, disable check.
i tried adding jshint comment @ top didn't work:
/* jshint indent: false */
this bad because syntax works other options. example, can disable camelcase enforcing option following:
/* jshint camelcase: false */
how can this?
some answers suggest indent automatically enables white option, tried following , didn't work either:
/* jshint white: false */
this not possible. jshint validates value of indent
option follows:
if (typeof val !== "number" || !isfinite(val) || val <= 0 || math.floor(val) !== val) { error("e032", nt, g[1].trim()); return; }
as you've noticed in comments on question, raise error if value not integer greater 0. doesn't put maximum limit on integer though.
depending on how running jshint may possible override default configuration files don't care indentation. example, jshint grunt task can this:
grunt.initconfig({ jshint: { options: { /* don't set indent here */ }, uses_defaults: ["somefile.js"], with_overrides: { options: { indent: 4 }, files: { src: ["someotherfile.js"] } } } });
update
i have opened pull request suggested fix issue, keep eye on , see if functionality jshint team want add.
Comments
Post a Comment