• Stars
    star
    132
  • Rank 274,205 (Top 6 %)
  • Language
    TypeScript
  • License
    The Unlicense
  • Created almost 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

an enforceable script naming standard for package.json


scriptlint status
npm version badge
dependency badge
Issue badge
CI badge

scriptlint

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

⚠️ Requires nodejs >= 14.x.x

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 ❤️ 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

More Repositories

1

updtr

Update outdated npm modules with zero pain™
JavaScript
2,224
star
2

phridge

A bridge between node and PhantomJS
JavaScript
519
star
3

parse-domain

Splits a hostname into subdomains, domain and (effective) top-level domains.
TypeScript
505
star
4

markdown-loader

markdown loader for webpack
JavaScript
376
star
5

extract-loader

webpack loader to extract HTML and CSS from the bundle
JavaScript
317
star
6

modernizr-loader

Get your modernizr build bundled with webpack
JavaScript
163
star
7

angular-expressions

Angular expressions as standalone module
JavaScript
94
star
8

unzip-crx

Unzip chrome extension files
JavaScript
52
star
9

nof5

A tool which runs unit tests (based on mocha) if a file has changed on the server in a browser
JavaScript
52
star
10

inspect-loader

Webpack loader designed for loader testing and debugging. Calls a function with the received input.
JavaScript
50
star
11

wasm-image

an image manipulation wrapper, JS API for Rust `image`
JavaScript
41
star
12

unicons

Cross-platform unicode icon toolkit
JavaScript
37
star
13

xunit-file

Basically the same reporter as mocha's xunit reporter, but writes the output in a file.
JavaScript
37
star
14

talks

Everything @peerigon talks about...
JavaScript
35
star
15

scrapegoat

Fetches calendar/event objects from a CalDav server
JavaScript
31
star
16

alamid

Framework for RESTful JavaScript web applications that run both on the server- and clientside.
JavaScript
23
star
17

clockodo

Unofficial JavaScript/TypeScript SDK for Clockodo
TypeScript
20
star
18

erroz

Streamlined errors with descriptive error messages through metadata and error codes
TypeScript
18
star
19

socket.io-session-middleware

share connect/express sessions with socket.io
JavaScript
18
star
20

JavaScript.js

Compiles JavaScript to JavaScript - and that's it™
JavaScript
15
star
21

link-package

No more require("./../../../../../../../../some/other/file.js")
JavaScript
15
star
22

alamid-schema

Extendable mongoose-like schemas for node.js and the browser
JavaScript
14
star
23

dynamic-config

Loads configuration files depending on the given env
JavaScript
14
star
24

legacy-loader

Webpack loader that prevents scripts from extending the window object.
JavaScript
12
star
25

eslint-config-peerigon

Peerigon coding rules as eslint config
JavaScript
11
star
26

webpack-universal-dev-server

JavaScript
10
star
27

sevdesk

💵 Unofficial JavaScript SDK for sevdesk.com
TypeScript
9
star
28

piwik-wrap

A Promise-based wrapper for the Piwik JavaScript Tracking Client providing an enjoyable API
JavaScript
8
star
29

servus.js

Servus as a Service (SaaS)
JavaScript
8
star
30

v8-docs

V8 API Reference Guide generated from the header files
7
star
31

batch-replace

Perform multiple str.replace() with one operation.
JavaScript
7
star
32

value

Convenient high-performance type-checking for JavaScript
JavaScript
6
star
33

github-ssh-keys

Fetch SSH keys from GitHub for given usernames. Optionally save them to `authorized_keys`.
JavaScript
6
star
34

slogan.js

Slogan as a service (SaaS)
JavaScript
6
star
35

svg-spinners

Scalabe loading indicators
JavaScript
6
star
36

alium

Save CLI commands as aliases on a directory basis
TypeScript
5
star
37

mattermost-theme

4
star
38

alamid-class

Easy prototype inheritance.
JavaScript
3
star
39

uberschrift

Magic heading levels for React
TypeScript
3
star
40

alamid-api

Abstracting http/websocket requests
JavaScript
3
star
41

nodeclass

Smart classes for node.js
JavaScript
3
star
42

webpack-demo

This is a small example repo that can be used to demonstrate some webpack features in a "live coding" fashion.
JavaScript
3
star
43

fshelpers

Some helpers for more convenient file system operations in nodeJS.
JavaScript
2
star
44

peerigon-tito-api

_Very simple_ layer to the ti.to api.
JavaScript
2
star
45

metaclass

Provides some basic classes to describe the structure of a software project.
JavaScript
2
star
46

alamid-plugin

Monkey-patch everything™
JavaScript
2
star
47

bananabomb

Provides some REST-API-clients for Twitter, Facebook, etc. in node.js
JavaScript
2
star
48

node2browser

DEPRECATED: Use webpack :)
JavaScript
2
star
49

alamid-api-client

Abstracts transports to a remote API
JavaScript
2
star
50

create-package

A template for a TypeScript package
TypeScript
1
star
51

svstat

a node.js wrapper for daemontools svstat
JavaScript
1
star
52

npm-stats

stats of our npm modules
JavaScript
1
star
53

alamid-sorted-array

Turns an array into a sorted array
JavaScript
1
star
54

react-and-caviar

hackathon!
JavaScript
1
star
55

hsa

1
star
56

turbo-pnpm-prune-git-dependency-issue

Dockerfile
1
star
57

email-i18n

DEPRECATED: E-mail precompiler with support for i18n and optimization via premailer
JavaScript
1
star
58

sharelock

Awesome encryption for social networks
JavaScript
1
star
59

alamid-view

Encapsulates dom nodes as a re-usable component
JavaScript
1
star
60

meetup-bridge

Bridging the meetup API to show events on our webpage - https://peerigon.com
JavaScript
1
star
61

telemetrydeck-vue

A library for using TelemetryDeck in your Vue 3 app
TypeScript
1
star