An unopinionated and configurable linter and style checker for Pug (formerly Jade)
v2 under active development. Watch this space as issues are fixed, and the rules roll in 🌈🐰
$ npm install -g pug-lint
$ pug-lint [options] <file ...>
-h, --help
: output usage information-V, --version
: output the version number-c, --config <path>
: configuration file path-r, --reporter <reporter>
: error reporter; console - default, inline
If you use SublimeLinter 3 with Sublime Text 3, you can install the SublimeLinter-pug-lint plugin using Package Control.
If you use Atom, you can install the linter-jade package.
jade-lint is part of syntastic.
If you are using vim-plug to manage your Vim plugins (recommended), you can do:
" In your ~/.vimrc
Plug 'scrooloose/syntastic'
" Then run these commands
:source %
:PlugInstall
Then to turn the jade-linter on, you will need this line in your .vimrc.
let g:syntastic_jade_checkers = ['jade_lint']
If you're using Gulp as your build system, you can use gulp-pug-lint for easier integration.
If you're using Grunt as your build system, you can use grunt-puglint for easier integration.
Options and rules can be specified in a .pug-lintrc
or .pug-lint.json
file, or via adding a "pugLintConfig"
option to package.json
.
Type: string
Values: "clock"
Presets are pre-defined sets of rules. You can specifically disable any preset rule by assigning it to null, like so:
{ "preset": "clock"
, "disallowIdLiterals": null
}
Type: Array
Default: [ "node_modules/**" ]
Disables style checking for specified paths declared with glob patterns.
Type: Array
Array of file path matching patterns to load additional rules from, e.g.:
{ "additionalRules": [ "project-rules/*.js" ]
}
You can specifically disable any rule by omitting it from your .pug-lintrc
config file or by assigning it to null, like so:
{ "disallowBlockExpansion": null
}
Some rules, if enabled at the same time, would be contradictory to one another, such as:
{ "disallowSpaceAfterCodeOperator": true
, "requireSpaceAfterCodeOperator": true
}
In this case requireSpaceAfterCodeOperator
is treated as null, and ignored.