yui-lint

raw JSON →
0.2.0 verified Fri May 01 auth: no javascript maintenance

yui-lint provides the default JSHint configuration used by YUI and its packages. Version 0.2.0 is the latest stable release. The package defines a set of JSHint options (e.g., browser, node, curly, eqeqeq) that enforce YUI's coding standards. It can be used as a Node module, referenced from package.json scripts with jshint --config, or symlinked as a local .jshintrc file. The project appears to be in maintenance mode, as the YUI library is no longer actively developed, and the last release was several years ago.

error ReferenceError: jshint is not defined
cause JSHint is not installed or not in PATH when using command line.
fix
Install jshint: npm install jshint --save-dev
error Can't find config file: jshintrc.json
cause Specifying the wrong config file name (jshintrc instead of jshint).
fix
Use the correct filename: jshint.json
error Error: Cannot find module 'yui-lint'
cause Package not installed or not in node_modules.
fix
Run npm install yui-lint --save-dev
deprecated YUI (Yahoo User Interface) library and its ecosystem are deprecated. yui-lint is no longer maintained and may not receive updates for newer JSHint versions.
fix Consider migrating to a maintained linter configuration or use ESLint with a modern config.
gotcha The jshint.json file in yui-lint is expected to be used with JSHint's --config flag. It is not a .jshintrc file by default.
fix Reference the path correctly: --config ./node_modules/yui-lint/jshint.json
breaking In version 0.1.4, the 'undef' flag was added and set to true by default. This may cause lint errors for undeclared variables that were previously allowed.
fix Ensure all variables are declared. Use /*global ... */ comments to declare globals if needed.
gotcha The 'jshint.json' file is shipped inside the package but may be overwritten if using a symlink that points to a removed or changed file.
fix Use the Node require pattern to avoid file path issues: var lint = require('yui-lint'); then lint.jshintConfig.
npm install yui-lint
yarn add yui-lint
pnpm add yui-lint

Installs jshint and yui-lint, then demonstrates three usage patterns: Node require, package.json script, and symlink as .jshintrc.

npm install jshint yui-lint
# Option A: Use from Node script
var lint = require('yui-lint');
console.log(lint); // { jshint options ... }

# Option B: Use in package.json scripts
# Add to package.json:
# {
#   "scripts": {
#     "pretest": "jshint --config ./node_modules/yui-lint/jshint.json ./lib/*.js"
#   }
# }
# Then run:
npm run pretest

# Option C: Symlink as global .jshintrc
ln -s ./node_modules/yui-lint/jshint.json ~/.jshintrc
jshint ./lib/*.js