scriptlint
an enforcable script naming standard for package.json
Last updated a month ago by peeri .
Unlicense · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install scriptlint 
SYNC missed versions from official npm registry.


scriptlint status
npm version badge
dependency badge
Issue badge
CI badge

scriptlint

Enforceable standards for your package.json scripts – like eslint for npm run

Intro

package.json scripts are an integral part of the Node dev experience: we use them to start our projects, run our dev environments and for all kinds of formatting, linting and tooling in general. They are just as important as our code. Yet we don't treat them with the same meticulous attention to detail. Scripts need :heart: too!

One of the main goals for scriptlint was to enable people to use memorable and consistent script names across their projects. Tools like nps are great when you have to organize scripts with a certain level of complexity, but they don't help you with the structure and naming of your scripts.

This is where the scriptlint CLI shines: it makes best practices outlined in this documentation enforceable throughout your project(s). Think of it as eslint for your "scripts" section.

Rules

Here's the tl;dr of all the best practices we consider the "scriptlint standard"

Your package.json's "scripts" section should…

  • have a test script that is not the default script from npm init
  • have a dev script and a start script
  • abstract script names from their implementation (test, not jest)
  • use namespaces to categorize scripts ("test:unit": "jest")
  • use : as a namespace separator
  • have the scripts in alphabetic order
  • have a trigger script for all hooks (ex: if you have prefoobar, there must be a foobar script)
  • use camelCase for all script names
  • not alias devDependencies (no "jest": "jest")
  • not use && or & for sequential or parallel script execution

(italic = strict rule)

Read more about the standard rules here

Usage

Install locally:

npm install scriptlint -D (or yarn add scriptlint -D)

… then run npx scriptlint --strict

Read about configuration here

Documentation

  1. Motivation
  2. The scriptlint "standard" tl;dr
  3. The scriptlint "standard"
    1. Rules enforceable via the scriptlint CLI
      1. Minimum rules
        1. mandatory-start
        2. mandatory-dev
        3. mandatory-test
        4. no-default-test
      2. Strict rules
        1. uses-allowed-namespace
        2. alphabetic-order
        3. correct-casing
        4. no-aliases
        5. prepost-trigger-defined
        6. no-unix-double-ampersand
        7. no-unix-single-ampersand
    2. Best practices
  4. The scriptlint CLI
    1. Installation
    2. Usage
    3. Configuration
    4. Extending
    5. Use as a JavaScript module
  5. Contributing to scriptlint

Badge

Would you like a scriptlint badge for your project readme? No problem! Have a look at https://scriptlint.peerigon.io/ or adapt the snippet below:

[![scriptlint status](https://img.shields.io/endpoint?url=https://scriptlint.peerigon.io/api/shield/scriptlint/latest)](https://scriptlint.peerigon.io/issues/scriptlint/latest)

Sponsors

Current Tags

  • 2.1.2                                ...           latest (a month ago)

17 Versions

  • 2.1.2                                ...           a month ago
  • 2.1.1                                ...           7 months ago
  • 2.1.0                                ...           7 months ago
  • 2.0.5                                ...           7 months ago
  • 2.0.4                                ...           8 months ago
  • 2.0.3                                ...           8 months ago
  • 2.0.2                                ...           8 months ago
  • 2.0.1                                ...           8 months ago
  • 2.0.0                                ...           8 months ago
  • 1.4.0                                ...           8 months ago
  • 1.3.2                                ...           9 months ago
  • 1.3.1                                ...           9 months ago
  • 1.3.0                                ...           9 months ago
  • 1.2.0                                ...           9 months ago
  • 1.1.1                                ...           9 months ago
  • 1.1.0                                ...           9 months ago
  • 0.0.1                                ...           9 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 27
Dependencies (5)
Dev Dependencies (20)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |