JSPM

@jkuebart/jslint

20180516.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 638
  • Score
    100M100P100Q92090F
  • License BSD-3-Clause

Douglas Crockford's JSLint, packaged for Node.js.

Package Exports

  • @jkuebart/jslint

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jkuebart/jslint) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Douglas Crockford's JSLint

This package provides Douglas Crockford's JSLint library as a Node.js package. The package version indicates the upstream »edition«.

Both a universal CommonJS/AMD module and an ECMAScript 6 module are provided.

Notable features of this package are:

  • it is easily updated when a new edition of JSLint is released
  • it contains unaltered JSLint source code
  • the code is itself JSLint-clean

Usage

The jslint function expects up to three arguments source, option_object and global_array as explained in the JSLint documentation.

const jslint = require("@jkuebart/jslint");

jslint(source, option_object, global_array);

For more detailed examples, see the documentation.

Using JSLint as a JavaScript parser

Apart from a list of warnings, JSLint also returns a full abstract syntax tree of the given code. This can be useful for automatic refactorings, static analysis, and much more…

const jslint = require("@jkuebart/jslint");

function dumpTree(tree) {
    // ...
}

const report = jslint(source, option_object, global_array);
dumpTree(report.tree);

Updating

A shell script is provided for building new packages when the upstream project is updated. It can be run using

npm run editions

This creates branches and tags based on the »edition« of the upstream project. Packages still need to be generated and published manually.

The local branches and tags can be viewed using

npm run show-branches
npm run show-tags

This can be used to automate some tasks, for example:

npm run show-branches --silent \
| while read b
    do
        git checkout "${b#refs/heads/}"
        git push --set-upstream origin "${b#refs/heads/}"
    done

or

npm run show-tags --silent \
| while read t
    do
        git checkout "${t#refs/tags/}"
        npm publish --access public
    done

To easily remove automatically created local branches and tags, use

npm run reset