@acute-ng/eslint-plugin-clean-template
v1.0.0
Published
An ESLint plugins to keep your Angular template clean.
Downloads
9
Maintainers
Readme
@acute-ng/eslint-plugin-clean-template
Install
npm install --save-dev eslint @acute-ng/eslint-plugin-clean-templateUsage (eslint.config.js)
Requires ESLint >=8.56.0.
Use recommended or strict settings, or configure each rule in eslint.config.
If you don't use the preset, ensure you use the same languageOptions config as below.
ES Module (Recommended)
import acuteCleanTemplate from "@acute-ng/eslint-plugin-clean-template";
import templateParser from "@angular-eslint/template-parser";
export default [
{
files: ["**/*.html"],
languageOptions: {
parser: templateParser,
},
plugins: {
"@acute-ng/clean-template": acuteCleanTemplate,
},
rules: {
"@acute-ng/clean-template/html-id-case": "warn",
"@acute-ng/clean-template/no-binding-literals": "warn",
"@acute-ng/clean-template/no-template-this": "warn",
"@acute-ng/clean-template/prefer-variable-binding": "warn",
},
},
];CommonJS
"use strict";
const acuteCleanTemplate = require("@acute-ng/eslint-plugin-clean-template");
const templateParser = require("@angular-eslint/template-parser");
module.exports = [
{
languageOptions: {
parser: templateParser,
},
plugins: {
"@acute-ng/clean-template": acuteCleanTemplate,
},
rules: {
"@acute-ng/clean-template/html-id-case": "warn",
"@acute-ng/clean-template/no-binding-literals": "warn",
"@acute-ng/clean-template/no-template-this": "warn",
"@acute-ng/clean-template/prefer-variable-binding": "warn",
},
},
];Usage (legacy: .eslintrc.* or package.json)
{
"parser": "@angular-eslint/template-parser",
"plugins": ["@acute-ng/clean-template"],
"rules": {
"@acute-ng/clean-template/html-id-case": "warn",
"@acute-ng/clean-template/no-binding-literals": "warn",
"@acute-ng/clean-template/no-template-this": "warn",
"@acute-ng/clean-template/prefer-variable-binding": "warn"
}
}Rules
💼 Configurations enabled in.
⚠️ Configurations set to warn in.
✅ Set in the recommended configuration.
🔒 Set in the strict configuration.
🔧 Automatically fixable by the --fix CLI option.
| Name | Description | 💼 | ⚠️ | 🔧 |
| :--------------------------------------------------------------- | :------------------------------------------------------------ | :-- | :-- | :-- |
| html-id-case | Enforces consistent case styling of the HTML id attribute. | 🔒 | ✅ | 🔧 |
| no-binding-literals | Prevent binding properties to string literals. | 🔒 | ✅ | 🔧 |
| no-template-this | Help prevent using unnecessary this in templates. | 🔒 | ✅ | 🔧 |
| prefer-variable-binding | Enforces property binding over simple variable interpolation. | 🔒 | ✅ | 🔧 |
