Download the PHP package moxio/captainhook-eslint without Composer
On this page you can find all versions of the php package moxio/captainhook-eslint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download moxio/captainhook-eslint
More information about moxio/captainhook-eslint
Files in moxio/captainhook-eslint
Package captainhook-eslint
Short Description Captain Hook Plugin to validate files using ESLint
License MIT
Informations about the package captainhook-eslint
moxio/captainhook-eslint
This project is a plugin for CaptainHook to check JavaScript files
using ESLint 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
Install as a development dependency using composer:
Usage
Add ESLint validation as a pre-commit
to your captainhook.json
configuration file:
The action expects ESLint to be installed as a local NPM package (i.e. available at
node_modules/.bin/eslint
). It should be configured
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
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:
This may be useful in scenarios where you have a shared CaptainHook configuration file that is included 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
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:
Versioning
This project adheres to Semantic Versioning.
License
This project is released under the MIT license.
All versions of captainhook-eslint with dependencies
captainhook/captainhook Version ^4.4 || ^5.0
sebastianfeldmann/cli Version ^3.0
sebastianfeldmann/git Version ^2.2 || ^3.0