{"id":13468191,"url":"https://github.com/cletusw/eslint-plugin-local-rules","last_synced_at":"2025-03-31T04:03:47.759Z","repository":{"id":37451179,"uuid":"90310563","full_name":"cletusw/eslint-plugin-local-rules","owner":"cletusw","description":"A plugin for ESLint that allows you to use project-specific rules","archived":false,"fork":false,"pushed_at":"2024-09-24T15:21:04.000Z","size":109,"stargazers_count":166,"open_issues_count":7,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T00:43:33.574Z","etag":null,"topics":["eslint","eslint-plugin","eslintplugin"],"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/cletusw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-04T21:19:10.000Z","updated_at":"2025-03-11T13:36:40.000Z","dependencies_parsed_at":"2024-01-15T20:47:33.998Z","dependency_job_id":"9a5de81c-be8b-4922-965e-3fa56910e0b3","html_url":"https://github.com/cletusw/eslint-plugin-local-rules","commit_stats":{"total_commits":32,"total_committers":8,"mean_commits":4.0,"dds":0.25,"last_synced_commit":"772984ff3c02b247625bb03fc5f2244379cb4578"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cletusw%2Feslint-plugin-local-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cletusw%2Feslint-plugin-local-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cletusw%2Feslint-plugin-local-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cletusw%2Feslint-plugin-local-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cletusw","download_url":"https://codeload.github.com/cletusw/eslint-plugin-local-rules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413232,"owners_count":20773053,"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":["eslint","eslint-plugin","eslintplugin"],"created_at":"2024-07-31T15:01:06.839Z","updated_at":"2025-03-31T04:03:47.729Z","avatar_url":"https://github.com/cletusw.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# eslint-plugin-local-rules\n\nA plugin for ESLint that allows you to use project-specific rules, similar to the deprecated [`--rulesdir`](http://eslint.org/docs/user-guide/command-line-interface#--rulesdir) command line option ([more](http://eslint.org/docs/developer-guide/working-with-rules#runtime-rules)).\n\n## Install\n\n```sh\nnpm install eslint-plugin-local-rules\n```\n\n\u003ch2 id=\"usage\"\u003eUsage (JavaScript)\u003c/h3\u003e\n\n### ./eslint-local-rules.js (or ./eslint-local-rules/index.js)\n\n```javascript\n'use strict';\n\nmodule.exports = {\n  'disallow-identifiers': {\n    meta: {\n      docs: {\n        description: 'disallow identifiers',\n        category: 'Possible Errors',\n      },\n      schema: [],\n    },\n    create: function (context) {\n      return {\n        Identifier: function (node) {\n          context.report({\n            node: node,\n            message: 'Identifiers not allowed for Super Important reasons.',\n          });\n        },\n      };\n    },\n  },\n};\n```\n\n### ./.eslintrc\n\n#### Use all rules as errors\n\n```json\n{\n  \"plugins\": [\"local-rules\"],\n  \"extends\": [\n    \"plugin:local-rules/all\"\n  ]\n}\n```\n\n#### Use all rules as warnings\n\n```json\n{\n  \"plugins\": [\"local-rules\"],\n  \"extends\": [\n    \"plugin:local-rules/all-warn\"\n  ]\n}\n```\n\n#### Customize each rule independently\n\n```json\n{\n  \"plugins\": [\"local-rules\"],\n  \"rules\": {\n    \"local-rules/disallow-identifiers\": \"error\"\n  }\n}\n```\n\n## Usage (TypeScript)\n\n```\nnpm install ts-node @types/eslint\n```\n\nYou'll also need an eslint config like the [.eslintrc](#eslintrc) above ([more info](https://eslint.org/docs/latest/use/configure/configuration-files)).\n\n### ./eslint-local-rules/index.js\n\n```javascript\nrequire(\"ts-node\").register({\n  transpileOnly: true,\n  compilerOptions: {\n    module: \"commonjs\",\n  },\n});\n\nmodule.exports = require(\"./rules\").default;\n```\n\n### ./eslint-local-rules/rules.ts\n\n```typescript\nimport type { Rule } from \"eslint\";\n\nexport default {\n  \"disallow-identifiers\": {\n    meta: {\n      docs: {\n        description: 'disallow identifiers',\n        category: 'Possible Errors',\n      },\n      schema: [],\n    },\n    create: function (context) {\n      return {\n        Identifier: function (node) {\n          context.report({\n            node: node,\n            message: 'Identifiers not allowed for Super Important reasons.',\n          });\n        },\n      };\n    },\n  },\n} satisfies Record\u003cstring, Rule.RuleModule\u003e;\n```\n\n## npm/yarn/pnpm workspaces support\n\nThis plugin supports npm/yarn/pnpm workspaces, although note that if the eslint-local-rules.js file is in the workspace subdirectory, running from the project root is unsupported.\n\nFor example, if there's an eslint-local-rules.js and index.js in ./src/app:\n\nWrong: `npx eslint src/app/index.js`\n\nRight: `(cd src/app; npx eslint index.js)`\n\nAlso note that if there is an eslint-local-rules.js file in *both* the workspace subdirectory and project root, the workspace one takes precedence (assuming you're running eslint from the workspace directory, as above).\n\n## Alternatives\n\n* [eslint-plugin-local](https://github.com/taskworld/eslint-plugin-local) - Allows specifying additonal plugin config such as [`processors`](https://eslint.org/docs/developer-guide/working-with-plugins#processors-in-plugins)\n* [eslint-plugin-rulesdir](https://github.com/not-an-aardvark/eslint-plugin-rulesdir) - Allows for a custom rules directory name\n\n## Context for this plugin\n\n* https://github.com/eslint/eslint/issues/2715\n* https://github.com/eslint/eslint/issues/8769\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcletusw%2Feslint-plugin-local-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcletusw%2Feslint-plugin-local-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcletusw%2Feslint-plugin-local-rules/lists"}