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
errororoff; nowarn. Allowingwarntends 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 existing 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 existing rulesets such as the airbnb ruleset, the ESlint recommended ruleset, the TypeScript recommended ruleset, etc. The npm run print-evaluated-rules command helps to audit the final resolved rule values. 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.
There are two commands for diff'ing evaluated rules when upgrading dependencies. Before upgrading, run npm run print-evaluated-rules:no-audit to print the current rule set to file. Upgrade the dependencies, and run npm run print-evaluated-rules:diff to print the difference.
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.
Currently the repository only supports contributions by creating a branch and pull request (we hope to support a fork-pull workflow soon). Not all users can create a branch in this repo; contact @rajsite to be granted the necessary privileges.
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 changebefore 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
patchfor documentation changes. -
Make a
minorrelease 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
minorversion change. This was deemed acceptable as projects are expected to usepackage-lock.jsonfiles so updates are intentional and we expect updates to be infrequent. -
Make a
majorrelease when changes to dependencies are performed such as requiring a newer Node.js version, an ESlint version update, or peer dependencies are changed.