Thanks for taking the time to contribute! 😄
- Fork and clone this repository
- Branch from the default
master
branch using a descriptive new branch name - Install dependencies with
npm ci
- Refer to the ESLint documentation and the Custom Rules page
To add a new rule:
- Follow the instructions in the ESLint generator-eslint documentation to install Yeoman and the generator
- Run the new rule generator
yo eslint:rule
and answer the questions- select "ESLint Plugin"
- for "Type a short description of this rule" provide text which starts with one of "enforce", "require" or "disallow" (all lower case)
- Yeoman creates three boilerplate files:
docs/rules/<rule-id>.md
lib/rules/<rule-id>.js
test/rules/<rule-id>.js
- Run
npm run lint-fix
- Address the linting errors by editing
lib/rules/<rule-id>.js
- Add a
meta.messages
property (see MessageIds) - Select the appropriate
meta.type
property usingproblem
,suggestion
, orlayout
- Add a
- Complete the new rule by adding content to the three files previously created
- Run
eslint-doc-generator
to generate automated documentation sections (see Document generation below) - Review documentation changes
- Run
npm run lint
- Run
npm test
to run Jest (or runnpm start
to run Jest in watchAll mode where it remains active and reruns when source changes are made) - Make sure all tests are passing
- Add the rule to legacy.js and to flat.js
- Create a git commit with a commit message similar to:
feat: add rule <description>
(see commit message conventions) - Create a PR from your branch
This plugin uses the ESLint eslint-doc-generator to generate consistent documentation.
- Install with
npm install eslint-doc-generator -g
- Run
eslint-doc-generator
in the root directory of the plugin
- The directory tests-legacy contains tests which are compatible with the legacy ESLint v8 RuleTester utility. It is not expected to add new rules to this set of tests.
- The directory tests is for tests compatible with the current ESLint RuleTester.
This information is for Cypress.io Members or Collaborators who merge pull requests:
-
When merging a pull request, use the Squash and merge option to squash all commits into one.
-
Make sure the commit subject and body follow semantic commit convention, for instance:
feat: added new parameter fix: fixed a bug
If you need to bump the major version, mark it as breaking change in the body of the commit's message like:
fix: upgrade dependency X BREAKING CHANGE: requires minimum Node.js 20 to run
-
New versions of this module will be released automatically by the CI pipeline when any PR with a triggering commit message is merged to the
master
branch: see therelease
job of circle.yml. This will create a new GitHub release and publish it to eslint-plugin-cypress on the npm registry. -
The module's CI is configured to use the default Angular release rules. This means that only
feat:
,fix:
andperf:
trigger a new release. Other Angular commit types listed in the Angular commit message guidelines can be used for documentation purposes, however they are ignored by the currently configured release process.