{"id":23458231,"url":"https://github.com/moxio/captainhook-eslint","last_synced_at":"2025-08-31T16:33:04.813Z","repository":{"id":53715540,"uuid":"217545189","full_name":"Moxio/captainhook-eslint","owner":"Moxio","description":"Captain Hook Plugin to validate files using ESLint","archived":false,"fork":false,"pushed_at":"2021-03-18T14:52:50.000Z","size":30,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-08T14:45:36.777Z","etag":null,"topics":["captainhook","eslint","git","git-hooks"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/Moxio.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}},"created_at":"2019-10-25T13:55:29.000Z","updated_at":"2023-12-03T00:01:02.000Z","dependencies_parsed_at":"2022-08-25T16:12:10.127Z","dependency_job_id":null,"html_url":"https://github.com/Moxio/captainhook-eslint","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-eslint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-eslint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-eslint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Moxio%2Fcaptainhook-eslint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Moxio","download_url":"https://codeload.github.com/Moxio/captainhook-eslint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813824,"owners_count":21165631,"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":["captainhook","eslint","git","git-hooks"],"created_at":"2024-12-24T05:17:50.361Z","updated_at":"2025-04-14T02:51:21.651Z","avatar_url":"https://github.com/Moxio.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://github.com/Moxio/captainhook-eslint/workflows/CI/badge.svg)\n[![Latest Stable Version](https://poser.pugx.org/moxio/captainhook-eslint/v/stable)](https://packagist.org/packages/moxio/captainhook-eslint)\n\nmoxio/captainhook-eslint\n========================\nThis project is a plugin for [CaptainHook](https://github.com/captainhookphp/captainhook) to check JavaScript files\nusing [ESLint](https://eslint.org/) in a git pre-commit hook. By default all `*.js` and `*.mjs` files are checked, and\nthe commit is blocked when one or more errors are found. Warnings produced by ESLint are ignored.\n\nInstallation\n------------\nInstall as a development dependency using composer:\n```\n$ composer require --dev moxio/captainhook-eslint\n```\n\nUsage\n-----\nAdd ESLint validation as a `pre-commit` to your `captainhook.json` configuration file:\n```json\n{\n    \"pre-commit\": {\n        \"enabled\": true,\n        \"actions\": [\n            {\n                \"action\": \"\\\\Moxio\\\\CaptainHook\\\\ESLint\\\\ESLintAction\"\n            }\n        ]\n    }\n}\n```\n\nThe action expects [ESLint](https://eslint.org/) to be installed as a local NPM package (i.e. available at\n`node_modules/.bin/eslint`). It should be [configured](https://eslint.org/docs/user-guide/configuring#configuring-eslint)\nin a way that automatically finds the appropriate configuration, e.g. as an `.eslintrc.*` file or with the `eslintConfig`\nfield in `package.json`.\n\n### Conditional usage\nIf you want to perform ESLint validation only when ESLint is installed (i.e. available at `node_modules/.bin/eslint`),\nyou can add a corresponding condition to the action:\n```json\n{\n    \"pre-commit\": {\n        \"enabled\": true,\n        \"actions\": [\n            {\n                \"action\": \"\\\\Moxio\\\\CaptainHook\\\\ESLint\\\\ESLintAction\",\n                \"conditions\": [\n                    {\n                        \"exec\": \"\\\\Moxio\\\\CaptainHook\\\\ESLint\\\\Condition\\\\ESLintInstalled\"\n                    }\n                ]\n            }\n        ]\n    }\n}\n```\nThis may be useful in scenarios where you have a shared CaptainHook configuration file that is\n[included](https://captainhookphp.github.io/captainhook/configure.html#includes) both in projects that use ESLint and\nprojects that don't. If ESLint is installed, the action is run. In projects without ESLint, the validation is skipped.\n\n### Configuring checked file extensions\n\nBy default, committed files with a `.js` or `.mjs` extension will be checked. If you want to customize this,\ne.g. to also validate TypeScript files, you can do so with the `extensions` option, which accepts an array\nwith extensions of files to lint:\n```json\n{\n    \"pre-commit\": {\n        \"enabled\": true,\n        \"actions\": [\n            {\n                \"action\": \"\\\\Moxio\\\\CaptainHook\\\\ESLint\\\\ESLintAction\",\n                \"options\": {\n                    \"extensions\": [ \"js\", \"mjs\", \"ts\", \"tsx\" ]\n                }\n            }\n        ]\n    }\n}\n```\n\nVersioning\n----------\nThis project adheres to [Semantic Versioning](http://semver.org/).\n\nLicense\n-------\nThis project is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxio%2Fcaptainhook-eslint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoxio%2Fcaptainhook-eslint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoxio%2Fcaptainhook-eslint/lists"}