npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cypress/eslint-plugin-dev

v5.3.3

Published

Common ESLint rules shared by Cypress development-only packages

Downloads

5,961

Readme

⚠️ This package for internal development of Cypress. Here's the Official Cypress ESLint Plugin meant for users of Cypress.

Installation

npm install --save-dev @cypress/eslint-plugin-dev

Usage

  1. install the following devDependencies:
@cypress/eslint-plugin-dev
eslint-plugin-json-format
@typescript-eslint/parser
@typescript-eslint/eslint-plugin
eslint-plugin-mocha

# if you have coffeescript files
@fellow/eslint-plugin-coffee
babel-eslint

# if you have react/jsx files
eslint-plugin-react
babel-eslint
  1. add the following to your root level .eslintrc.json:
{
  "plugins": [
    "@cypress/dev"
  ],
  "extends": [
    "plugin:@cypress/dev/general",
  ]
}

Note: also add "plugin:@cypress/dev/react", if you are using React

Note: if you have a test/ directory, you should create a .eslintrc.json file inside of it, and add:

{
  "extends": [
    "plugin:@cypress/dev/tests"
  ]
}
  1. add the following to your .eslintignore:
# don't ignore hidden files, useful for formatting json config files
!.*
  1. (optional) Install and configure your text editor's ESLint Plugin Extension to lint and auto-fix files using ESLint, detailed below

  2. (optional) Install husky and enable the lint pre-commit hook:

package.json:

  "husky": {
    "hooks": {
      "pre-commit": "lint-pre-commit"
    }
  },

Note: the lint-pre-commit hook will automatically lint your staged files, and only --fix and git add them if there are no unstaged changes existing in that file (this protects partially staged files from being added in the hook).
To auto-fix all staged & unstaged files, run ./node_modules/.bin/lint-changed --fix

Presets

general

Should usually be used at the root of the package.

requires you to install the following devDependencies:

eslint-plugin-json-format
@typescript-eslint/parser
@typescript-eslint/eslint-plugin

tests

Test-specific configuration and rules. Should be used within the test/ directory.

requires you to install the following devDependencies:

eslint-plugin-mocha

react

React and JSX-specific configuration and rules.

requires you to install the following devDependencies:

babel-eslint
eslint-plugin-react

Configuration Examples

Change some linting rules:

// .eslintrc.json
{
  "extends": [
    "plugin:@cypress/dev/general"
  ],
  "rules": {
    "comma-dangle": "off",
    "no-debugger": "warn"
  }
}

Stop your package.json from being formatted:

{
  "settings": {
    "json/sort-package-json": false
  }
}

Custom Rules:

name | description | options | example -|-|-|- @cypress/dev/arrow-body-multiline-braces | Enforces braces in arrow functions ONLY IN multiline function definitions | [[always|never] always set this to 'always'] | '@cypress/dev/arrow-body-multiline-braces': ['error', 'always'] @cypress/dev/skip-comment | Enforces a comment (// NOTE:) explaining a .skip added to it, describe, or context test blocks | { commentTokens: [array] tokens that indicate .skip explanation (default: ['NOTE:', 'TODO:', 'FIXME:'])} | '@cypress/dev/skip-comment': ['error', { commentTokens: ['TODO:'] }] @cypress/dev/no-return-before | Disallows return statements before certain configurable tokens | { tokens: [array] tokens that cannot be preceded by 'return' (default: ['it', 'describe', 'context', 'expect'])} | '@cypress/dev/no-return-before': ['error', { tokens: ['myfn'] }]

Editors

VSCode

Use plugin ESLint by Dirk Baeumer to lint and auto fix JS files using ESLint.
After installing, add the following to your User or Workspace (.vscode/settings.json) settings:

{
  "eslint.validate": [
    { 
      "language": "javascript",
      "autoFix": true
    },
    {
      "language": "javascriptreact",
      "autoFix": true
    },
    {
      "language": "typescript",
      "autoFix": true
    },
    {
      "language": "typescriptreact",
      "autoFix": true
    },
    {
      "language": "json",
      "autoFix": true
    },
    {
      "language": "coffeescript",
      "autoFix": false
    },
  ],
}

Atom

Install package linter-eslint (and its dependencies) to enable linting. Go into the settings for this package and enable "Fix on save" option to auto-fix white space issues and other things.

Sublime Text

Install ESLint-Formatter, then set the following settings:

{
  "format_on_save": true,
  "debug": true
}

License

This project is licensed under the terms of the MIT license.

Changelog

Changelog