{"id":22878829,"url":"https://github.com/taskworld/eslint-plugin-local","last_synced_at":"2025-10-18T03:30:47.067Z","repository":{"id":47206086,"uuid":"95863848","full_name":"taskworld/eslint-plugin-local","owner":"taskworld","description":"module.exports = require('../../.eslintplugin')","archived":false,"fork":false,"pushed_at":"2024-08-04T13:24:44.000Z","size":439,"stargazers_count":35,"open_issues_count":0,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-26T23:24:36.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/taskworld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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-06-30T07:53:07.000Z","updated_at":"2024-08-04T13:24:47.000Z","dependencies_parsed_at":"2024-04-19T08:46:35.388Z","dependency_job_id":"14c4678d-37c2-40f6-a8e7-2eb55e786cc4","html_url":"https://github.com/taskworld/eslint-plugin-local","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"cbc2f17caa1717bc72fe3aa7215ed5eaa2e78a95"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Feslint-plugin-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Feslint-plugin-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Feslint-plugin-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskworld%2Feslint-plugin-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taskworld","download_url":"https://codeload.github.com/taskworld/eslint-plugin-local/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236892808,"owners_count":19221239,"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":[],"created_at":"2024-12-13T16:32:45.940Z","updated_at":"2025-10-18T03:30:41.733Z","avatar_url":"https://github.com/taskworld.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This ESLint plugin allows you to implement a custom ESLint plugin including custom rules in your repository without installing them as a dependency.\n\nOriginally inspired by [cletusw/eslint-plugin-local-rules](https://github.com/cletusw/eslint-plugin-local-rules).\n\n## Installation\n\n```sh\nnpm install --save-dev eslint-plugin-local\n```\n\n## Usage\n\nThe JavaScript file named _eslint.local.js_ or _eslint-plugin-local.js_ or _.eslint-plugin-local/index.js_ must be created at the root of your repository, which the file has the content of an [ESLint plugin](https://eslint.org/docs/latest/extend/plugins). The extension _.cjs_ can be used in place of _.js_ in case ES module is not supported. For example:\n\n```js\nmodule.exports = {\n  rules: {\n    sample: {\n      // Optional\n      meta: {\n        // See https://eslint.org/docs/latest/extend/custom-rules#rule-structure\n      },\n\n      // Mandatory\n      create: function (context) {\n        // Implementation goes here\n        // See https://eslint.org/docs/latest/extend/custom-rules\n      },\n\n      // Optional\n      // Unit test can be triggered by `eslint-plugin-local test` command\n      // See https://eslint.org/docs/latest/integrate/nodejs-api#ruletester\n      tests: {\n        valid: [...],\n        invalid: [...],\n      }\n    }\n  }\n}\n```\n\nThen add the plugin to your _eslint.config.js_ file:\n\n```js\nconst local = require('eslint-plugin-local')\n\nmodule.exports = [{\n  plugins: {\n    local\n  },\n  rules: {\n    'local/sample': 'error'\n  }\n}]\n```\n\nAdditionally, this package provides `eslint-plugin-local test` command out of the box, which it scans for `tests: { valid: [], invalid: [] }` field in each rule and runs [`RuleTester`](https://eslint.org/docs/latest/extend/custom-rules#rule-unit-tests) internally.\n\nTo make it easy to debug your test cases, wrap one or more test objects inside the global `only()` function. Given the example below, **only the first test case and every invalid case** will be run.\n\n```js\nmodule.exports = {\n  rules: {\n    sample: {\n      tests: {\n        valid: [\n          only({\n            code: 'var foo = 1',\n          }),\n          {\n            code: 'var foo = 2',\n          }\n        ],\n        invalid: only([...]),\n      }\n    }\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskworld%2Feslint-plugin-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaskworld%2Feslint-plugin-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskworld%2Feslint-plugin-local/lists"}