Powerful CLI for any lint (JSLint/JSHint +) solution.
- Built-in support for JSLint and JSHint linters
- Picks all .js and executable Node.js files from all directories recursively (nest level is configurable)
- Provides simple external configuration file standard that allows to keep options out of program files
- If needed understands .gitignore rules
- Additional ignore rules can be defined in .lintignore files
- Optional caching mechanism (no re-evaluation with same options on not modified files)
- Provides live console, that updates when code or configuration files are updated
- Covered by over 150 unit tests
$ xlint [options] [<paths>]
$ xlint --linter=path/to/jslint-module.js project/path
Interested in live console?
$ xlint --watch --linter=path/to/jslint-module.js project/path
$ npm install -g xlint
path- Path to linter module. It must be CJS module, see e.g. xlint-jslint for JSLint provided as one
bool- Whether to cache generated reports. Very useful if we rerun the script on large projects. Cached reports are saved into .lintcache file in your project main directory [default: true]
bool- Colorize console output [default: true]
number- How deeply to recurse into subdirectories [default: Infinity]
string- Whether to obey rules found in ignore files (Currently just git for .giitignore rules is supported). It's backed by fs2.isIgnored [default: git]
bool- Whether to generate reports on the go (as soon as first filenames are obtained) [default: true]
bool- Output reports in live console which updates after code or configuration files are updated [default: false]
Apart of support for .gitignore rules, XLint also looks for rules in .lintignore files. Syntax rules for those files is same as for .gitignore files.
XLint supports external .lint configuration files, through which we may setup options that are passed to linter. There can be many_.lint_ files placed in any directory within project
File format is similar to conf files as we know them from *nix systems:
# This is a comment, any of this are ignored by the parser@root # Root of a project, means that any rules found in upper directories won't have effectplusplus # Regular boolean optionindent 2 # Numeric optionpredef console, window # Array of strings./foo.js # Options that would only address foo.js file!plusplus # Overridden boolean option (set to false)predef+ XMLHttpRequest # Add token to array optionpredef- console # Remove token from array option./some-dir # Options that address only files within given directorypredef foo, bar # Override array optionotherarr one, # Other array option, if we set just one token, we need to post-fix it with comma
XLint doesn't support options defined in
JSHint separates global variable settings from other options, but in XLint configuration files, global should be defined same as other options (as e.g. predef for JSLint), it will be passed to JSHint as expected.
$ npm test