{"id":31898306,"url":"https://github.com/crabnebula-dev/vscode-eslint-protection","last_synced_at":"2026-07-04T19:31:22.260Z","repository":{"id":316415182,"uuid":"1000835759","full_name":"crabnebula-dev/vscode-eslint-protection","owner":"crabnebula-dev","description":"protect parts of your code with an eslint comment","archived":false,"fork":false,"pushed_at":"2025-11-18T10:18:11.000Z","size":233,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-12T23:38:05.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crabnebula-dev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-12T11:52:27.000Z","updated_at":"2025-11-20T06:13:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f309920-9368-44f9-b0f5-9b44ed2c52ca","html_url":"https://github.com/crabnebula-dev/vscode-eslint-protection","commit_stats":null,"previous_names":["crabnebula-dev/vscode-eslint-protection","crabnebula-dev/vscode-eslint-protected"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/crabnebula-dev/vscode-eslint-protection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crabnebula-dev%2Fvscode-eslint-protection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crabnebula-dev%2Fvscode-eslint-protection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crabnebula-dev%2Fvscode-eslint-protection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crabnebula-dev%2Fvscode-eslint-protection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crabnebula-dev","download_url":"https://codeload.github.com/crabnebula-dev/vscode-eslint-protection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crabnebula-dev%2Fvscode-eslint-protection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30382645,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-10-13T11:59:14.789Z","updated_at":"2026-03-11T13:15:55.584Z","avatar_url":"https://github.com/crabnebula-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vscode-eslint-protected\n\nThe extension `vscode-eslint-protected` lets you add special comments with hashes that the [`eslint-protection`](https://github.com/crabnebula-dev/eslint-protection) can then use to detect unconscious code changes.\n\n![\"//@protection 20 SbFd2QwGhPgdKvw/DXcF+w==\"](./vscode-eslint-protected.png)\n\n## Adding `@crabnebula/eslint-protection` to your project\n\nIf you have not already, add `eslint` and `@crabnebula/eslint-protection` to your project:\n\n```sh\nnpm add --save-dev eslint @crabnebula/eslint-protection\n# or\nyarn add -D eslint @crabnebula/eslint-protection\n# or\npnpm add -D eslint @crabnebula/eslint-protection\n```\n\nNow configure `eslint` to use the plugin in `eslint.config.mjs`:\n\n```js\nimport { defineConfig } from \"eslint/config\";\nimport protection from \"@crabnebula/eslint-protection\";\n\nexport default defineConfig({    \n    plugins: { protection },\n    rules: {\n        \"protection/protect\": \"error\"\n    }\n});\n```\n\nIdeally, you set up `eslint` as a guarding mechanism for commits using e.g. `husky`; first, install the required dependencies:\n\n```sh\nnpm add --save-dev husky lint-staged @crabnebula/husky-protection\n# or\nyarn add -D husky lint-staged @crabnebula/husky-protection\n# or\npnpm add -D husky lint-staged @crabnebula/husky-protection\n```\n\nNext, initialize Husky:\n\n```sh\nnpx husky-init \u0026\u0026 npm install\n# or\nnpx husky-init \u0026\u0026 yarn\n# or\npnpx husky-init \u0026\u0026 pnpm i\n```\n\nLastly, add a pre-commit hook:\n\n```sh\nnpx husky add .husky/pre-commit \"npx lint-staged\"\nnpx husky add .husky/pre-commit \"node_modules/@crabnebula/husky-protection/index.js\"\n# or\npnpx husky add .husky/pre-commit \"npx lint-staged\"\npnpx husky add .husky/pre-commit \"node_modules/@crabnebula/husky-protection/index.js\"\n\n# in either case, make it executable:\nchmod +x .husky/pre-commit .husky/_/husky.sh\n```\n\nThis will add the linter and another protection commit hook that will block commits that remove more protection comments than they add.\n\n## Select lines to protect\n\n* Command: `eslint-protect.selected`\n* Keyboard binding (Windows/Linux): \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003el\u003c/kbd\u003e\n* Keyboard binding (Mac): \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eCommand\u003c/kbd\u003e + \u003ckbd\u003el\u003c/kbd\u003e\n\nIf no selection is made, the command will create a comment to protect a single line. For a selection, the full lines the selection is touching will be protected.\n\n## Protect a whole file\n\n* Command: `eslint-protect.file`\n* Keyboard binding (Windows/Linux): \u003ckbd\u003eShift\u003c/kbd\u003e + \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003el\u003c/kbd\u003e\n* Keyboard binding (Mac): \u003ckbd\u003eShift\u003c/kbd\u003e + \u003ckbd\u003eCtrl\u003c/kbd\u003e + \u003ckbd\u003eCommand\u003c/kbd\u003e + \u003ckbd\u003el\u003c/kbd\u003e\n\nThis command will create a comment at the top that protects the whole file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrabnebula-dev%2Fvscode-eslint-protection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrabnebula-dev%2Fvscode-eslint-protection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrabnebula-dev%2Fvscode-eslint-protection/lists"}