Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 3.05 KB

CONTRIBUTING.md

File metadata and controls

50 lines (38 loc) · 3.05 KB

Contributing to cypress-io/eslint-plugin-cypress

Thanks for taking the time to contribute! 😄

Preparation

  • Fork and clone this repository
  • Branch from the default master branch using a descriptive new branch name
  • Install dependencies with npm ci

Rule references

New rule

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 using problem, suggestion, or layout
  • 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 run npm 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

Document generation

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

Legacy tests