npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

passlint

v0.5.2

Published

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

Downloads

14

Readme

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