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

fashion-show

v3.3.3

Published

Build consistent and versioned styleguides by including and running consistent lint files across projects.

Downloads

257

Readme

fashion-show

Build consistent and versioned styleguides by including and running consistent lint files across projects.

Motivation

Your styleguide should be verisoned and consistent across all of your projects. This means that you should only have ONE .jshintrc and/or .jscsrc file anywhere. But how can this be accomplished easily? By making your own styleguide using fashion-show.

Writing your "requireable" styleguide

A fully working example at indexzero/styleguide. Basically it happens in a few steps:

  • 1. Make a new repository, your-styleguide
  • 2. Add your .elintrc and .jscsrc files:
cd your-styleguide
mkdir dist
mkdir dotfiles
touch dotfiles/.eslintrc
touch dotfiles/.jscsrc

# Also works with jshint
# touch dotfiles/.jshintrc
  • 3. Install fashion-show and your favorite linters: jscs, eslint and jshint are supported.
npm install fashion-show jscs eslint --save
  • 4. "Build" your dotfiles on prepublish (i.e. remove comments)
"scripts": {
  "prepublish": "./node_modules/.bin/fashion-show-build"
}
  • 5. Write a simple wrapper script to "lint"
var path = require('path');

require('fashion-show')({
  commands: ['jscs', 'eslint'],
  rc: path.join(__dirname, '..', 'dist')
}, function (err, code) {
  if (err) { return process.exit(1); }
  process.exit(code);
});
  • 6. Expose that script as a "bin" in your-styleguide
"bin": {
  "your-styleguide": "./bin/your-styleguide"
}
  • 7. Depend on your-styleguide
cd your-styleguide
npm publish
cd some/other/project
npm install your-styleguide --save-dev
  • 8. Use the bin you created on "pretest"
"scripts": {
  "pretest": "your-styleguide lib test"
}

API Documentation

At its core fashion-show will run the CLI versions of the lint tools you choose to use it with. A comparison of JavaScript lint CLI options is available if you're interested in exploring this in depth, but fashion-show has gone to length to pick the best tool for the job where applicable so when you run:

require('fashion-show')(options, function (err, code) {
  if (err) { return process.exit(1); }
  process.exit(code);
});

The list of all available options is:

| option name | example | jshint | jscs | eslint | |:--------------|:---------------------|:--------------|:-------------|:-------------| | commands | ['jscs', 'eslint'] | --- | --- | --- | | targets | ['lib/', 'test/'] | ...args | ...args | ...args | | rc | '../rc' | --config | --config | --config | | fix | true | --- | --fix | --- | | exts | ['.jsx'] | --extra-ext | --- | --ext .js | | reporter | 'checkstyle' | --reporter | --reporter | --format | | format | 'checkstyle' | --- | --- | --format | | global | ['my-global'] | --prereq | --- | --global | | binPath | node_modules/.bin | --- | --- | --- |

All of these options are also configurable through the binary scripts that you define in Step 5 above:

| CLI option | option name | Sample usage | |:----------------|:--------------|:-----------------| | ...args | targets | lib/ test/ | | -c,--command | commands | -c jscs | | -r,--rc | rc | -d ~/.lintrcs | | -f,--fix | fix | --fix | | -e,--ext | exts | --ext .jsx | | -r,--reporter | reporter | -r checkstyle | | -g,--global | global | -g my-global |

# commands

Array of commands to actually run against. Each item in the Array can be a string command or an object:

{
  'command': 'jscs',
  'args': ['extra', 'jscs', 'specific', 'args']
}

# targets

The set of targets to run the given commands against.

# dist

Directory where all of your lint files is located. It will be default look for .{command}rc: .jscsrc, .jshintrc, .eslintrc

# reporter

Reporter passed to the linters that you are running.

# fix

If enabled will turn on auto fixing in jscs (Currently whitespace rules, EOF rule, and validateIndentation)

# exts

Set of additional extensions that you want to include running lint(s) against.

# global

Set of additional globals that you wish to enable

Tests

Tests are written with mocha and code coverage is provided by istanbul:

npm test
Author: Charlie Robbins
License: MIT