🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

passlint

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passlint

Lint only serious errors that will definitely break your code, probably.

latest
Source
npmnpm
Version
0.5.2
Version published
Maintainers
1
Created
Source

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

Keywords

passlint

FAQs

Package last updated on 01 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts