ESLint Plugin Ignore ERB

raw JSON →
0.1.1 verified Sat Apr 25 auth: no javascript abandoned

An ESLint plugin (v0.1.1, last updated ~2016, no recent releases) that suppresses all linting errors on lines containing ERB (<% %>) expressions in Ruby on Rails views. It works by registering a custom rule that overrides reported problems. Only compatible with ESLint < 9.x. No longer maintained; superseded by better parsing solutions or direct ESLint ignore comments.

error ESLint couldn't find the plugin "eslint-plugin-ignore-erb".
cause Plugin not installed or not in node_modules, or ESLint is running globally.
fix
Install locally: npm install eslint-plugin-ignore-erb --save-dev, or ensure global installation matches.
error Configuration for rule "ignore-erb/ignore-erb" is invalid: Severity should be one of the following: 0 = off, 1 = warn, 2 = error.
cause Misconfigured rule severity (e.g., string value instead of number).
fix
Use numeric severity: "ignore-erb/ignore-erb": "error" (or 2).
error Failed to load plugin 'ignore-erb': Cannot find module 'eslint-plugin-ignore-erb'.
cause Plugin package missing or ESLint cannot resolve it.
fix
Ensure the package is installed and the .eslintrc file is in the project root.
deprecated Plugin is unmaintained and may not work with ESLint >= 9.x due to flat config changes.
fix Use ESLint ignore comments or switch to a maintained alternative like eslint-plugin-erb.
gotcha Plugin only suppresses errors on lines containing ERB tags; it does not parse or validate ERB syntax.
fix Ensure ERB files are not linted for syntax; consider using separate linters for Ruby.
gotcha Global installation mismatch: if ESLint is global, this plugin must also be installed globally.
fix Use local installations for consistency: npm install eslint and this plugin as devDependencies.
npm install eslint-plugin-ignore-erb
yarn add eslint-plugin-ignore-erb
pnpm add eslint-plugin-ignore-erb

Shows how to configure the plugin in .eslintrc to ignore ERB expressions on lines.

// .eslintrc.json
{
  "plugins": ["ignore-erb"],
  "rules": {
    "ignore-erb/ignore-erb": "error"
  }
}

// Example ERB file (app/views/test.html.erb)
// Without plugin: error on template syntax
<% if @user %>
  <p>Hello</p>
<% end %>
// With plugin: no errors on lines with <% %>