{"id":19151692,"url":"https://github.com/cypress-io/eslint-plugin-dev","last_synced_at":"2025-04-19T16:31:59.393Z","repository":{"id":57229793,"uuid":"101098898","full_name":"cypress-io/eslint-plugin-dev","owner":"cypress-io","description":"Common ESLint rules and configuration shared by Cypress packages","archived":false,"fork":false,"pushed_at":"2019-10-16T18:35:00.000Z","size":514,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":35,"default_branch":"master","last_synced_at":"2024-04-14T08:35:35.172Z","etag":null,"topics":["cypress","cypress-plugin","eslint-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cypress-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-22T19:17:08.000Z","updated_at":"2020-08-18T05:27:13.000Z","dependencies_parsed_at":"2022-09-14T14:50:30.448Z","dependency_job_id":null,"html_url":"https://github.com/cypress-io/eslint-plugin-dev","commit_stats":null,"previous_names":["cypress-io/eslint-plugin-cypress-dev"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Feslint-plugin-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Feslint-plugin-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Feslint-plugin-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cypress-io%2Feslint-plugin-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cypress-io","download_url":"https://codeload.github.com/cypress-io/eslint-plugin-dev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223800821,"owners_count":17205010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","cypress-plugin","eslint-plugin"],"created_at":"2024-11-09T08:15:28.364Z","updated_at":"2024-11-09T08:15:28.886Z","avatar_url":"https://github.com/cypress-io.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv\u003e\n    \u003c!-- \u003cimg src=\"docs/readme-logo.png\"\u003e --\u003e\n    \u003ch1\u003e[Internal] Cypress Developer ESLint Plugin\u003c/h1\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@cypress/eslint-plugin-dev\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@cypress/eslint-plugin-dev.svg?style=flat\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://circleci.com/gh/cypress-io/eslint-plugin-dev/tree/master\"\u003e\u003cimg src=\"https://img.shields.io/circleci/build/gh/cypress-io/eslint-plugin-dev.svg\"\u003e\u003c/a\u003e\n\n\u003cp\u003eCommon ESLint rules shared by Cypress packages.\u003c/p\u003e\n\n\u003c/div\u003e\n\n\u003e ⚠️ This package for _internal development_ of Cypress. Here's the [**Official Cypress ESLint Plugin**](https://github.com/cypress-io/eslint-plugin-cypress) meant for users of Cypress.\n\n\n## Installation\n\n```\nnpm install --save-dev @cypress/eslint-plugin-dev\n```\n\n## Usage\n\n1) install the following `devDependencies`:\n```sh\n@cypress/eslint-plugin-dev\neslint-plugin-json-format\n@typescript-eslint/parser\n@typescript-eslint/eslint-plugin\neslint-plugin-mocha\n\n# if you have coffeescript files\n@fellow/eslint-plugin-coffee\nbabel-eslint\n\n# if you have react/jsx files\neslint-plugin-react\nbabel-eslint\n```\n\n2) add the following to your root level `.eslintrc.json`:\n```json\n{\n  \"plugins\": [\n    \"@cypress/dev\"\n  ],\n  \"extends\": [\n    \"plugin:@cypress/dev/general\",\n  ]\n}\n```\n\n\u003e Note: also add `\"plugin:@cypress/dev/react\"`, if you are using `React`\n\n\u003e Note: if you have a `test/` directory, you should create a `.eslintrc.json` file inside of it, and add:\n```json\n{\n  \"extends\": [\n    \"plugin:@cypress/dev/tests\",\n  ]\n}\n```\n\n3) add the following to your `.eslintignore`:\n```sh\n# don't ignore hidden files, useful for formatting json config files\n!.*\n```\n\n4) (optional) Install and configure your text editor's ESLint Plugin Extension to lint and auto-fix files using ESLint, [detailed below](#editors)\n\n5) (optional) Install [`husky`](https://github.com/typicode/husky) and enable the lint `pre-commit` hook:\n\n`package.json`:\n```json\n  \"husky\": {\n    \"hooks\": {\n      \"pre-commit\": \"lint-pre-commit\"\n    }\n  },\n```\n\u003e 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).  \nTo auto-fix all staged \u0026 unstaged files, run `./node_modules/.bin/lint-changed --fix`\n\n## Presets\n\n### general\n\n_Should usually be used at the root of the package._\n- The majority of the rules. \n- auto-fixes `json` files and sorts your `package.json` via [`eslint-plugin-json-format`](https://github.com/bkucera/eslint-plugin-json-format)\n\n\n**requires you to install the following `devDependencies`**:\n```sh\neslint-plugin-json-format\n@typescript-eslint/parser\n@typescript-eslint/eslint-plugin\n```\n\n### tests\n\nTest-specific configuration and rules. Should be used within the `test/` directory.\n\n**requires you to install the following `devDependencies`**:\n```sh\neslint-plugin-mocha\n```\n\n### react\n\nReact and JSX-specific configuration and rules.\n\n**requires you to install the following `devDependencies`**:\n```sh\nbabel-eslint\neslint-plugin-react\n```\n\n## Configuration Examples\n\nChange some linting rules:\n```js\n// .eslintrc.json\n{\n  \"extends\": [\n    \"plugin:@cypress/dev/general\"\n  ],\n  \"rules\": {\n    \"comma-dangle\": \"off\",\n    \"no-debugger\": \"warn\"\n  }\n}\n```\n\nStop your `package.json` from being formatted:\n```json\n{\n  \"settings\": {\n    \"json/sort-package-json\": false\n  }\n}\n```\n\n### Custom Rules:\nname | description | options | example\n-|-|-|-\n`@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']`\n`@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:'] }]`\n`@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'] }]`\n\n## \u003ca name=\"editors\"\u003e\u003c/a\u003eEditors\n\n### VSCode\n\nUse plugin [ESLint by Dirk Baeumer](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) to lint and auto fix JS files using ESLint.  \nAfter installing, add the following to your User or Workspace (`.vscode/settings.json`) settings:\n```json\n{\n  \"eslint.validate\": [\n    { \n      \"language\": \"javascript\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"javascriptreact\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"typescript\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"typescriptreact\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"json\",\n      \"autoFix\": true\n    },\n    {\n      \"language\": \"coffeescript\",\n      \"autoFix\": false\n    },\n  ],\n}\n```\n\n### Atom\n\nInstall package [linter-eslint](https://atom.io/packages/linter-eslint)\n(and its dependencies) to enable linting. Go into the settings for this package\nand enable \"Fix on save\" option to auto-fix white space issues and other things.\n\n### Sublime Text\n\nInstall [ESLint-Formatter](https://packagecontrol.io/packages/ESLint-Formatter),\nthen set the following settings:\n\n```json\n{\n  \"format_on_save\": true,\n  \"debug\": true\n}\n```\n\n## License\n\nThis project is licensed under the terms of the [MIT license](/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypress-io%2Feslint-plugin-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcypress-io%2Feslint-plugin-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcypress-io%2Feslint-plugin-dev/lists"}