0.5.2 • Published 4 years ago

passlint v0.5.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

npm npm

passlint

Quickly check syntax errors with acorn ( syntax-error ) - if this fails your code is definitely not going to work, probably.

Default ECMAScript version is 6 ( 2015 ) - change it with -e <number> argument variable

Easy to use

passlint **/*.js && echo 'no javascript errors was found'
passlint **/*.css && echo 'no css errors was found'

Example

passlint **/*.js **/*.css
  components/mics.js:245:7: SyntaxError: Unexpected token (245:7)
  js/admin-controller.js:2:1: SyntaxError: Unexpected token (2:1)
  public/bundle.css:40:20: error: Expected RBRACE at line 40, col 20.

API

Test JavaScript files

var passlint = require( 'passlint' )

var defaultEcmaVersion = 6 // 2015
var filename = 'test/output.js'
var text = require( 'fs' ).readFileSync( filename, 'utf8' )
var errline = passlint( text, defaultEcmaVersion )
if ( errline ) console.error( filename + errline )
  test/output.js:484:40: SyntaxError: Unexpected token (484:40)
  stage/bundle-error.css:182:10: error: Expected COLON at line 182, col 10.

Test CSS files

var passlint = require( 'passlint' )

var filename = 'stage/bundle-error.css'
var text = require( 'fs' ).readFileSync( filename, 'utf8' )
var errline = passlint( text, 'css' )
if ( errline ) console.error( filename + errline )
  stage/bundle-error.css:182:10: error: Expected COLON at line 182, col 10.

Arguments

$ passlint --help
Usage: passlint [optinos]

Arguments:

--ecma-version, -e <number>     specify ecma version to check against
                                defaults to 6 ( 2015 )

                                example: `passlint -e 6 src/**`

--version, -V                   print version and exit

--help, -h                      help ( this text )

Install

locally ( project specific, for use with npm scripts )

npm install passlint

globally

npm install -g passlint

Why

To quickly capture absolutely essential errors. Some projects have messy or no linting rules at all. Even with linting setup not everything gets fixed or gets forgotten.

passlint is the dirty final gate that needs to be passed for your code to run regardless of style rules.

Alternatives

You can use node's -c flag for similar functionality. Note the variablity between node versions, passlint tests against ES 2015 by default and also formats the output more concisely.

node -c **/*.js

How

acorn

syntax-error

csslint

Test

npm test
0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago