This document covers information needed for the contribution to and release of the eslint rules.
Some overarching principles that are used for defining the rulesets:
- Start strict and then loosen. We prefer to start with a strict set of opinionated rules and then loosen the ruleset with experience developing under them.
- Use
error
oroff
; nowarn
. Allowingwarn
tends to increase noise when running lints and hide new or useful messages.
Several scripts are provided for local development to help audit changes to the ruleset.
When updating dependencies the npm run print-available-rules
command can be used to print all the available rules.
Note: This command does not print what rules are currently used but instead prints all the rules that are available.
The TypeScript extension rules (which are rules that extend the behavior of exisiting eslint rules) must be used in place of corresponding eslint rules. Printing the available rules is useful for manually auditing what extension rules need to be used.
The rules build on several exisiting rulesets such as the airbnb ruleset, the eslint recommended ruleset, the TypeScript recommended ruleset, etc. The npm run print-evaluated-rules
commands helps to audit the final resolved rule values.
When the command is run it will print the result of some audits that try to detect patterns we want to avoid, such as rules configured with a warn
severity level.
The /tests
folder contains different smoke tests for basic validation of the lint rules. The smoke tests represent a project that has integrated the relevant eslint configuration and has a simple test file that the toolchain is evaluated on.
The goal of the smoke tests is basic validation that the eslint configurations can be run in a project without error.
This repository uses beachball to automate publishing its packages to NPM. The basic workflow is as follows:
- Every pull request that affects a published package must contain a "change file" which specifies how it affects the versions of each package and includes a description of the change. Developers generate this change file by running
npm run change
before creating the pull request. - After the pull request completes, a CI pipeline will inspect the change files to generate changelogs, bump versions in package.json, and publish the newly built packages to NPM.
The following are guidelines for when to release as patch
, minor
, or major
versions:
-
Release a
patch
for documentation changes. -
Make a
minor
release for new rules or changes to rules.This results in most updates to the lint rules resulting in breakages during continuous integration and requiring source changes despite a
minor
version change. This was deemed acceptable as projects are expected to usepackage-lock.json
files so updates are intentional and we expect updates to be infrequent. -
Make a
major
release when changes to dependencies are performed such as requiring a newer node.js version, an eslint version update, or peer dependencies are changed.