0.2.0 • Published 7 years ago

check-syntax v0.2.0

Weekly downloads
33
License
MIT
Repository
github
Last release
7 years ago

check-syntax

Checks the syntax of an entry point and it's (application-level) dependencies as per the currently installed Node version.

About

The node -c command allows us to check the syntax of a single file.

The check-syntax module allows us to check the syntax of all the files in a dependency tree (excluding any dependencies in the node_modules folder).

CLI

Install

npm install -g check-syntax

Use

check-syntax <entry-point>

API

Install

npm install check-syntax

Use

var checkSyntax = require('check-syntax')
var someEntryPoint = 'my/js/file.js'
console.log(checkSyntax(someEntryPoint)) // outputs an array of objects, {loc, code, msg}

Reporter

To use the CLI reporter programatically:

var report = require('check-syntax/report')
var someEntryPoint = 'my/js/file.js'
report(someEntryPoint) // same as output as check-syntax command, will exit immediately 

If a pass callback is supplied, the process won't exit but instead will call the callback with the first arg set to either true or false based on whether the syntax check was successful.

report(someEntryPoint, (pass) => {
  if (pass) console.log('hooray')
  else console.log('boo')
})

License

MIT

0.2.0

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago