eslint-plugin-eta-3
raw JSON → 3.0.1 verified Fri May 01 auth: no javascript
An ESLint plugin that lints Eta v3 template files. Version 3.0.1 is current and stable, with a low release cadence. It processes .eta files through a custom processor, enabling ESLint rules on Eta templates. Key differentiators: built specifically for Eta v3, supports JavaScript-like syntax inside templates, and integrates seamlessly with standard ESLint workflows. Alternatives like eslint-plugin-eta target older Eta versions. Requires ESLint >=8 and eta >=3 as peer dependencies.
Common errors
error Error: Failed to load plugin 'eta-3' declared in '.eslintrc': Cannot find module 'eslint-plugin-eta-3' ↓
cause Package not installed or missing from node_modules.
fix
Run npm install --save-dev eslint-plugin-eta-3
error Error: Cannot find module 'eta' ↓
cause Missing peer dependency eta.
fix
Run npm install eta@^3
error TypeError: Cannot read properties of undefined (reading 'eta') ↓
cause Processor reference 'eta-3/eta' is incorrect or missing.
fix
In ESLint config, use processor: 'eta-3/eta' under the override.
error Warning: Rule 'no-unused-vars' severity 'error' has unknown options ↓
cause ESLint version mismatch; rules may have changed in newer ESLint.
fix
Ensure ESLint version is 8.x; check rule documentation.
Warnings
gotcha Plugin only works with Eta v3; using with other versions may break. ↓
fix Ensure eta package is version 3.x.
deprecated Named export for processor is not available; must use string path. ↓
fix In ESLint config, use processor: 'eta-3/eta'.
gotcha Plugin requires ESLint >=8; older versions are incompatible. ↓
fix Upgrade ESLint to version 8 or higher.
gotcha Overrides with files pattern must match .eta extension exactly. ↓
fix Use files: ['*.eta'] (not '.eta' or '**/*.eta').
Install
npm install eslint-plugin-eta-3 yarn add eslint-plugin-eta-3 pnpm add eslint-plugin-eta-3 Imports
- plugin (as object) wrong
import { eta3Plugin } from 'eslint-plugin-eta-3';correctconst eta3Plugin = require('eslint-plugin-eta-3'); - Processor wrong
import { EtaProcessor } from 'eslint-plugin-eta-3';correct// Not directly exported; use 'eta-3/eta' in ESLint config - Plugin name wrong
plugins: ["eslint-plugin-eta-3"]correctplugins: ["eta-3"]
Quickstart
// Install
npm install --save-dev eslint eslint-plugin-eta-3 eta@^3
// .eslintrc.js
module.exports = {
root: true,
env: { browser: true, es2021: true },
plugins: ["eta-3"],
overrides: [
{
files: ["*.eta"],
processor: "eta-3/eta",
rules: {
// Example rules
"no-unused-vars": "error",
"no-undef": "error"
}
}
]
};
// Example Eta template: template.eta
// <% let name = "World" %>
// <h1>Hello <%= name %></h1>
// Run linter
npx eslint template.eta