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

compliancejs

v0.0.12

Published

A javascript code best practices checker that let you define your own coding rules.

Downloads

9

Readme

#ComplianceJS

JavaScript coding best practices validator written with NodeJS.

##Status

Alpha

##Features

  • Write your own rules
  • Write your own plugins
  • Write your own report templates

##Install

npm install -g compliancejs

Dependencies

  • [NodeJS] (http://nodejs.org/)
  • [cli-color] (https://github.com/medikoo/cli-color)
  • [node-glob] (https://github.com/isaacs/node-glob)
  • [fs-extra] (https://github.com/jprichardson/node-fs-extra)

##Usage

compliance [--verbose] [--config=config-file]

--config is an optional parameter where compliance options are configured. If --config is not present, the application will look for compliance-config.json in the directory where the command was issued.

--verbose optional parameter to show all console logs.

##Configuration

Configuration is JSON formatted text file with the following table of keys.

Key | Value Type | Required | Default | Description ------------- | ---------------------|-----------|---------| ----------- files | Array of String | Yes | | This is an array of path pointing to the files that needs to be validated. You can use abosulte or glob pattern for the filename. reports | Array of JSON Object | No | | Reports configuration ignoreRuleFileError | boolean | No|true|If set to false, ComplianceJS will stop and throw exception when error is detected from rule files. exclude | JSON Object | No | | Exclude some rules from being validated against the files configured in "files". rules | Array of String | No | rules/** | An array of path pointing to the files that contains the rule definition. Values can be absolute or glob pattern. plugins | Array of String | No | plugins/** | An array of path pointing to the files that contains plugin codes. Values can be absolute or glob pattern.

###Key "reports"

Key | Value Type | Required | Default | Description --- | ----------| --------| -------| ----------- template | String | Yes | | Report template name type | String | Yes | | Report format. Supports the following values : html or text dist | String | Yes | | The path to where the reports will be generated.

###Key "exclude"

Key | Value Type | Required | Default | Description ----| -----------|----------|---------|------------ [Rule Collection Name] | Array of String | Yes | | Key is dynamic and must be the rule collection name defined in the rule file. The values for this key must be the name or id of the rule that needs to be excluded.

###Configuration File Example compliance-config.json

{
    
    "plugins" : [
      "plugins/**/*.js"
    ],
    
    "rules" : [
      "rules"
    ],
    
    "exclude" : {
        "Basic" : ["eqeqeq"]
    },
    
    "files" : [
        "test/**/*.js"
    ],
    
    "reports" : [
        {
            "template" : "default",
            "type"  : "html",
            "dist" : "reports"
        }
    ], 
    
    "ignoreRuleFileError" : true,
    
    "overrides" : [
        {
            "group" : "Basic", 
            "id" : "maxComplexity",
            "param" : {"max" : 8}
        }
    ]
}

##How to create and add your custom rules?

See [Writing Custom Rules] (https://github.com/s4m0k/compliancejs/wiki/Rules)

##How to create and add your own plugins?

##Report Template