{"id":13715009,"url":"https://github.com/eggjs/eslint-plugin-eggache","last_synced_at":"2025-05-05T16:44:33.973Z","repository":{"id":57229890,"uuid":"120574210","full_name":"eggjs/eslint-plugin-eggache","owner":"eggjs","description":"custom eslint rule for egg, especially for the RTFM issues","archived":false,"fork":false,"pushed_at":"2022-09-29T14:47:28.000Z","size":20,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-27T11:38:38.713Z","etag":null,"topics":["egg","eslint","eslint-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggjs.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-07T06:39:37.000Z","updated_at":"2023-07-22T06:51:53.000Z","dependencies_parsed_at":"2022-09-14T15:02:02.928Z","dependency_job_id":null,"html_url":"https://github.com/eggjs/eslint-plugin-eggache","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Feslint-plugin-eggache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Feslint-plugin-eggache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Feslint-plugin-eggache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggjs%2Feslint-plugin-eggache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggjs","download_url":"https://codeload.github.com/eggjs/eslint-plugin-eggache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252535380,"owners_count":21763954,"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":["egg","eslint","eslint-plugin"],"created_at":"2024-08-03T00:00:52.956Z","updated_at":"2025-05-05T16:44:33.924Z","avatar_url":"https://github.com/eggjs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# eslint-plugin-eggache\n\ncustom eslint rule for egg RTFM questions\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![NPM download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/eslint-plugin-eggache.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/eslint-plugin-eggache\n[travis-image]: https://img.shields.io/travis/eggjs/eslint-plugin-eggache.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/eslint-plugin-eggache\n[codecov-image]: https://codecov.io/gh/eggjs/eslint-plugin-eggache/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/eggjs/eslint-plugin-eggache\n[david-image]: https://img.shields.io/david/eggjs/eslint-plugin-eggache.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/eslint-plugin-eggache\n[snyk-image]: https://snyk.io/test/npm/eslint-plugin-eggache/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/eslint-plugin-eggache\n[download-image]: https://img.shields.io/npm/dm/eslint-plugin-eggache.svg?style=flat-square\n[download-url]: https://npmjs.org/package/eslint-plugin-eggache\n\n## Usage\n\n```bash\nnpm i eslint-plugin-eggache --save\n```\n\nAdd `eggache` to the plugins section of your `.eslintrc` configuration file.\n\n```js\n// ${app_root}/.eslintrc\n{\n  \"extends\": [\n    \"plugin:eggache/recommended\"\n  ]\n}\n```\n\nBy default it enable all the recommended rules, if you want to custom, just configure the rules section.\n\n```js\n// ${app_root}/.eslintrc\n{\n  \"extends\": [\n    \"plugin:eggache/recommended\"\n  ],\n  \"rules\": {\n    'eggache/no-override-exports': [ 'error' ],\n    'eggache/no-unexpected-plugin-keys': 'error',\n  }\n}\n```\n\n## Rules\n\n### no-override-exports\n\nA common mistake that newbie will make - override `module.exports` and `exports`.\n\n```js\n/* eslint eggache/no-override-exports: [ 'error' ] */\n\n// config/config.default.js\nexports.view = {};\n\nmodule.exports = appInfo =\u003e {\n  const config = exports = {};\n  config.keys = '123456';\n  return config;\n}\n```\n\n**Options**:\n\nThe first options is a boolean, default to false, means only check:\n- `config/config.*.js`\n- `config/plugin.*.js`\n\nset it to `true` means to check all files.\n\n```js\n/* eslint eggache/no-override-exports: [ 'error', true ] */\n\n// due to options `true`, this will pass the lint\n// ${app_root}/app.js\nmodule.exports = exports = {};\nexports.keys = '123456';\n```\n\n### no-unexpected-plugin-keys\n\nSometimes, developer will confuse `plugin.js` and `config.default.js`.\n\n`plugin.js` only allow `[ 'enable', 'package', 'path', 'env' ]` and it control whether to load a plugin.\n\nThe plugin's `config` should write to `config/config.{env}.js`.\n\n```js\n/* eslint eggache/no-unexpected-plugin-keys: [ 'error' ] */\n\n// config/plugin.js\nmodule.exports = {\n  test: {\n    enable: true,\n    package: 'egg-test',\n    someConfig: 'should not place here',\n  },\n}\n```\n\n### no-only-tests\n\nA common mistake that developer will make - forget to remove `.only` in tests before committing.\n\n```js\n/* eslint eggache/no-only-tests: [ 'error' ] */\ndescribe.only('desc something', function() {\n  it.only('assert somnething', function() {\n    // do nothing\n  });\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Feslint-plugin-eggache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggjs%2Feslint-plugin-eggache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggjs%2Feslint-plugin-eggache/lists"}