ESLint Plugin Enact
raw JSON → 2.0.4 verified Sat Apr 25 auth: no javascript
Enact specific linting rules for ESLint, designed for applications built with the Enact framework (LG webOS). Current stable version is 2.0.4, released in 2024. The plugin provides rules like kind-name, display-name (superseding react/display-name), and no-module-exports-import. It requires ESLint >=9.0.0 and Node >=20.0.0 or >=22.0.0. Key differentiator: it prevents false-flagging of Enact components (kind, hoc) by standard React lint rules, making it essential for Enact projects. Release cadence is irregular; minor updates focus on dependency bumps. Only supports flat config (ESLint v9+), breaking from v1's legacy config.
Common errors
error Error: Failed to load plugin 'enact': Cannot find module 'eslint-plugin-enact' ↓
cause Plugin not installed or ESLint cannot resolve it.
fix
Run
npm install eslint-plugin-enact --save-dev and ensure node_modules path is correct. error Error: Invalid config: plugins[0].rules.unknown-rule not found in plugin 'enact' ↓
cause Referenced rule name does not exist in the plugin.
fix
Check available rules: 'enact/kind-name', 'enact/display-name', 'enact/no-module-exports-import'. Remove unknown rule.
error Error: Could not find 'plugin:enact/recommended' in config. ESLint v9 does not support extends with plugins. ↓
cause Using deprecated configurations referencing 'plugin:enact/recommended' (not a valid config key).
fix
Use flat config:
import enact from 'eslint-plugin-enact' and spread enact.configs.recommended if available. Warnings
breaking Version 2.x requires ESLint >=9.0.0 and flat config; legacy eslintrc format no longer supported. ↓
fix Migrate to flat config (eslint.config.js) and upgrade ESLint to v9+.
breaking Node engine requirement changed to ^20.0.0 || >=22.0.0 in v2, dropping Node 18 and below. ↓
fix Use Node 20 or 22+.
deprecated Rule enact/prop-types was removed in v2.0.0-beta.1. ↓
fix Disable the rule or migrate to react/prop-types if needed.
gotcha The enact/display-name rule supersedes react/display-name; you should disable the React plugin rule to avoid conflicts. ↓
fix Disable the react/display-name rule in your ESLint config.
gotcha Settings like kind and hoc are regex patterns, not plain strings. Incorrect usage may cause no matches. ↓
fix Use regex strings (e.g., 'kind' or '/^kind$/') in the settings object.
Install
npm install eslint-plugin-enact yarn add eslint-plugin-enact pnpm add eslint-plugin-enact Imports
- plugin wrong
const enact = require('eslint-plugin-enact')correctimport enact from 'eslint-plugin-enact' - rules wrong
const { rules } = require('eslint-plugin-enact')correctimport { rules } from 'eslint-plugin-enact' - configs
import { configs } from 'eslint-plugin-enact'
Quickstart
// eslint.config.js
import enact from 'eslint-plugin-enact'
export default [
{
plugins: { enact },
rules: {
'enact/kind-name': 'warn',
'enact/display-name': 'warn',
'enact/no-module-exports-import': 'error',
},
settings: {
enact: {
kind: 'kind',
hoc: 'hoc'
}
}
}
]