PHPackages                             moxio/captainhook-eslint - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. moxio/captainhook-eslint

ActiveLibrary[Testing &amp; Quality](/categories/testing)

moxio/captainhook-eslint
========================

Captain Hook Plugin to validate files using ESLint

v1.0.1(8mo ago)1147.9k—6.1%1MITPHPPHP ^7.2 || ^8.0CI passing

Since Oct 25Pushed 8mo ago11 watchersCompare

[ Source](https://github.com/Moxio/captainhook-eslint)[ Packagist](https://packagist.org/packages/moxio/captainhook-eslint)[ RSS](/packages/moxio-captainhook-eslint/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

[![CI](https://github.com/Moxio/captainhook-eslint/workflows/CI/badge.svg)](https://github.com/Moxio/captainhook-eslint/workflows/CI/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/9bc1bbb12e85a919187e8731a07e2bd7660dacc0c0546dbb1b838053290df72d/68747470733a2f2f706f7365722e707567782e6f72672f6d6f78696f2f6361707461696e686f6f6b2d65736c696e742f762f737461626c65)](https://packagist.org/packages/moxio/captainhook-eslint)

moxio/captainhook-eslint
========================

[](#moxiocaptainhook-eslint)

This project is a plugin for [CaptainHook](https://github.com/captainhookphp/captainhook) to check JavaScript files using [ESLint](https://eslint.org/) in a git pre-commit hook. By default all `*.js` and `*.mjs` files are checked, and the commit is blocked when one or more errors are found. Warnings produced by ESLint are ignored.

Installation
------------

[](#installation)

Install as a development dependency using composer:

```
$ composer require --dev moxio/captainhook-eslint

```

Usage
-----

[](#usage)

Add ESLint validation as a `pre-commit` to your `captainhook.json` configuration file:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\ESLint\\ESLintAction"
            }
        ]
    }
}
```

The action expects [ESLint](https://eslint.org/) to be installed as a local NPM package (i.e. available at `node_modules/.bin/eslint`). It should be [configured](https://eslint.org/docs/user-guide/configuring#configuring-eslint)in a way that automatically finds the appropriate configuration, e.g. as an `.eslintrc.*` file or with the `eslintConfig`field in `package.json`.

### Conditional usage

[](#conditional-usage)

If you want to perform ESLint validation only when ESLint is installed (i.e. available at `node_modules/.bin/eslint`), you can add a corresponding condition to the action:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\ESLint\\ESLintAction",
                "conditions": [
                    {
                        "exec": "\\Moxio\\CaptainHook\\ESLint\\Condition\\ESLintInstalled"
                    }
                ]
            }
        ]
    }
}
```

This may be useful in scenarios where you have a shared CaptainHook configuration file that is [included](https://captainhookphp.github.io/captainhook/configure.html#includes) both in projects that use ESLint and projects that don't. If ESLint is installed, the action is run. In projects without ESLint, the validation is skipped.

### Configuring checked file extensions

[](#configuring-checked-file-extensions)

By default, committed files with a `.js` or `.mjs` extension will be checked. If you want to customize this, e.g. to also validate TypeScript files, you can do so with the `extensions` option, which accepts an array with extensions of files to lint:

```
{
    "pre-commit": {
        "enabled": true,
        "actions": [
            {
                "action": "\\Moxio\\CaptainHook\\ESLint\\ESLintAction",
                "options": {
                    "extensions": [ "js", "mjs", "ts", "tsx" ]
                }
            }
        ]
    }
}
```

Versioning
----------

[](#versioning)

This project adheres to [Semantic Versioning](http://semver.org/).

License
-------

[](#license)

This project is released under the MIT license.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance60

Regular maintenance activity

Popularity36

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~306 days

Recently: every ~511 days

Total

8

Last Release

256d ago

Major Versions

v0.2.0 → v1.0.02021-03-18

PHP version history (2 changes)v0.0.1PHP ^7.2

v1.0.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/815524?v=4)[Arnout Boks](/maintainers/aboks)[@aboks](https://github.com/aboks)

![](https://avatars.githubusercontent.com/u/4497863?v=4)[Moxio](/maintainers/moxio)[@Moxio](https://github.com/Moxio)

---

Top Contributors

[![aboks](https://avatars.githubusercontent.com/u/815524?v=4)](https://github.com/aboks "aboks (25 commits)")

---

Tags

captainhookeslintgitgit-hooksgiteslintpre-commitcaptainhook

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/moxio-captainhook-eslint/health.svg)

```
[![Health](https://phpackages.com/badges/moxio-captainhook-eslint/health.svg)](https://phpackages.com/packages/moxio-captainhook-eslint)
```

###  Alternatives

[captainhook/captainhook

PHP git hook manager

1.1k6.8M370](/packages/captainhook-captainhook)[hot/phpunit-runner

The lib allows to watch phpunit tests

3066.9k4](/packages/hot-phpunit-runner)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
