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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jscs-styleguide

v0.5.10

Published

Create Human readable Style Guide from JSCS configuration

Downloads

15

Readme

jscs-styleguide

Generate a human-readable Style Guide from a JSCS configuration.

Installation

npm install jscs-styleguide

Usage

// es5
var style = require("jscs-styleguide");     

// es6
import { file, html, body } from "jscs-styleguide"  

Loading rules from .jscsrc (thanks to Sergey Sharov)

var fs = require("fs");
var rules = JSON.parse(fs.readFileSync(".jscsrc", "utf8"));

var Checker = require("jscs");
var checker = new Checker();
checker.registerDefaultRules();
checker.configure(rules);

var config = checker.getProcessedConfig();

Generating HTML styleguide

// es5
// get html body only for stylesheet, as string
// to create an HTML file in your own way
var body = style.body(config, {title: "My Style Guide"});

// get html document for stylesheet, as string
// to do with as you please
var html = style.html(config, {title: "My Style Guide"});

// create stylesheet.html in current folder
style.file(config, {title: "My Style Guide"});

// es6
var _body = body(config, {title: "My Style Guide"});

var _html = html(config, {title: "My Style Guide"});

file(config, {title: "My Style Guide"});

Default css

jscs-styleguide includes a default.css in the /example folder that you can use in lieu of building your own. If you plan to use it, just copy it to your project before running jscs-styleguide

Run example

jscs-styleguide contains a complete sample application which you can use to generate an HTML style guide. This will make it very easy for you to understand how jscs-styleguide works. The sample application is located in the /example folder. It has a sample .jscsrc and default.css file ready to roll.

To run the example, do the following

cd node_modules/jscs-styleguide/example
npm install
npm run example     // creates file StyleGuide.html in /examples folder. Load it in your browser!

Options

{
    title: "Title of Styleguide. Default is 'Style Guide'.",
    valid_keyword: "Heading for valid usage, e.g. 'VALID', 'COOL', 'DO THIS'. Default is 'VALID'.",
    invalid_keyword: "Heading for invalid usage, e.g. 'INVALID', 'NOT COOL', 'NOT THIS'. Default is 'INVALID'.",
    theme: "Will load 'theme'.css into HTML <head>. Default is 'default'.",
    showJSCS: true, // shows the name of each JSCS rule
    fileName: "name_of_generated_file.html"
}

TODO

The following JSCS rules have been completed so far. These are the most common. More are being added until they are all there. If you really need a rule now, leave me a comment [email protected]

disallowAnonymousFunctions
disallowArrayDestructuringReturn
disallowArrowFunctions
disallowCapitalizedComments
disallowCommaBeforeLineBreak
disallowCurlyBraces
disallowDanglingUnderscores
disallowEmptyBlocks
disallowFunctionDeclarations
disallowIdenticalDestructuringNames
disallowIdentifierNames
disallowImplicitTypeConversion
disallowKeywords
disallowKeywordsInComments
disallowKeywordsOnNewLine
disallowMixedSpacesAndTabs
disallowMultiLineTernary
disallowMultipleLineBreaks
disallowMultipleLineStrings
disallowMultipleSpaces
disallowMultipleVarDecl
disallowNamedUnassignedFunctions
disallowNestedTernaries
disallowNewlineBeforeBlockStatements
disallowNotOperatorsInConditionals
disallowObjectKeysOnNewLine
disallowOperatorBeforeLineBreak
disallowSpaceAfterObjectKeys
disallowSpaceAfterPrefixUnaryOperators
disallowSpacesInAnonymousFunctionExpression
disallowSpacesInCallExpression
disallowSpacesInFunction
disallowSpacesInsideArrayBrackets
disallowSpacesInsideObjectBrackets
disallowSpacesInsideParentheses
disallowTrailingComma
disallowYodaConditions
maximumLineLength
requireCamelCaseOrUpperCaseIdentifiers
requireCapitalizedConstructors
requireCommaBeforeLineBreak
requireCurlyBraces
requireDollarBeforejQueryAssignment
requireLineFeedAtFileEnd
requireMultipleVarDecl
requireOperatorBeforeLineBreak
requireSpaceAfterBinaryOperators
requireSpaceAfterKeywords
requireSpaceBeforeBinaryOperators
requireSpaceBeforeBlockStatements
requireSpaceBeforeKeywords
requireSpaceBeforeObjectValues
requireSpaceBetweenArguments
requireSpacesInConditionalExpression
requireSpacesInForStatement
requireSpacesInFunctionExpression
validateIndentation
validateParameterSeparator
validateQuoteMarks