Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peerigon/scriptlint
an enforceable script naming standard for package.json
https://github.com/peerigon/scriptlint
Last synced: about 2 months ago
JSON representation
an enforceable script naming standard for package.json
- Host: GitHub
- URL: https://github.com/peerigon/scriptlint
- Owner: peerigon
- License: unlicense
- Created: 2019-12-02T11:58:29.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-19T01:32:23.000Z (11 months ago)
- Last Synced: 2024-07-19T05:44:03.254Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 2.19 MB
- Stars: 132
- Watchers: 15
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![scriptlint status](https://img.shields.io/endpoint?url=https://scriptlint.peerigon.io/api/shield/scriptlint/latest)](https://scriptlint.peerigon.io/issues/scriptlint/latest)
[![npm version badge](https://img.shields.io/npm/v/scriptlint?style=flat-square)](https://npmjs.com/package/scriptlint)
[![dependency badge](https://img.shields.io/librariesio/release/npm/scriptlint?style=flat-square)](https://libraries.io/npm/scriptlint)
[![Issue badge](https://img.shields.io/github/issues/peerigon/scriptlint?style=flat-square)](https://github.com/peerigon/scriptlint/issues)
[![CI badge](https://github.com/peerigon/scriptlint/workflows/ci/badge.svg)](https://github.com/peerigon/scriptlint/actions?query=workflow%3Aci)# 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 :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](https://github.com/sezna/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](https://github.com/peerigon/scriptlint/wiki/The-scriptlint-%22standard%22-tl%3Bdr)
## Usage
Install locally:
`npm install scriptlint -D` (or `yarn add scriptlint -D`)
… then run `npx scriptlint --strict`
[Read about configuration here](https://github.com/peerigon/scriptlint/wiki/Configuration)
# Documentation
- Motivation
- The
scriptlint "standard" tl;dr
The
scriptlint
"standard"
- Rules enforceable via the scriptlint CLI
Minimum
rules
- Strict rules
uses-allowed-namespace
alphabetic-order
correct-casing
no-aliases
prepost-trigger-defined
no-unix-double-ampersand
no-unix-single-ampersand- Best
practices- The scriptlint CLI
- 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:
```markdown
[![scriptlint status](https://img.shields.io/endpoint?url=https://scriptlint.peerigon.io/api/shield/scriptlint/latest)](https://scriptlint.peerigon.io/issues/scriptlint/latest)
```---
## Sponsors
[](https://peerigon.com)