eslint-plugin-actions
raw JSON → 2.0.0 verified Fri May 01 auth: no javascript
An ESLint plugin that lints JavaScript code embedded in GitHub Actions workflow files (`.yml`/`.yaml`). Version 2.0.0 supports ESLint 8 and Node 12+; Node 10, 13, 15 and ESLint 6/7 are dropped. The plugin provides a processor that extracts JS from literal blocks (e.g., `script:` in `actions/github-script`) and lint them with standard ESLint rules. Recommended config `plugin:actions/recommended` enables the processor automatically. Unlike generic YAML linting tools, it gives full ESLint support for inline JS with virtual filenames for granular rule overrides. Experimental auto-fixing is available.
Common errors
error Oops! Something went wrong! :( ESLint: 8.57.0 ESLint couldn't find the plugin "eslint-plugin-actions". The plugin is not installed. ↓
cause Plugin not installed in node_modules.
fix
Run
npm install eslint-plugin-actions --save-dev. error Configuration for rule "indent" is invalid: Value "outerIIFEBody" is not defined. ↓
cause Missing outerIIFEBody option in indent rule configuration.
fix
Add outerIIFEBody: 0 to the indent rule options.
Warnings
breaking Node 10, 13, 15 and ESLint 6, 7 are no longer supported. ↓
fix Upgrade to Node >=12.22.0 and ESLint >=8.0.0.
deprecated ESLint 6 and 7 support removed in v2.0.0. ↓
fix Use ESLint 8+.
gotcha Autofixing is experimental and may change whitespace. Always review results. ↓
fix Avoid --fix in production; manually check diffs.
gotcha Only literal blocks (`|`) are supported; folded blocks (`>`) or other YAML multi-line strings are not linted. ↓
fix Use `|` for script content in workflows.
gotcha Rules like `indent` require `outerIIFEBody: 0` because scripts are wrapped in an IIFE. ↓
fix Set indent rule option: ['error', 2, { outerIIFEBody: 0 }].
Install
npm install eslint-plugin-actions yarn add eslint-plugin-actions pnpm add eslint-plugin-actions Imports
- plugin wrong
const plugin = require('eslint-plugin-actions')correctmodule.exports = { plugins: ['actions'] } - configs.recommended wrong
extends: ['actions/recommended']correctextends: ['plugin:actions/recommended'] - processor wrong
processor: 'eslint-plugin-actions/actions'correctprocessor: 'actions/actions'
Quickstart
// .eslintrc.json
{
"extends": ["plugin:actions/recommended"],
"ignorePatterns": ["!/.github"]
}