eslint-plugin-handlebars
v1.0.4
Published
Lint Handlebars templates
Downloads
131
Maintainers
Readme
eslint-plugin-handlebars
Lint Handlebars templates
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-handlebars:
npm install eslint-plugin-handlebars --save-devUsage
In your configuration file, import the plugin eslint-plugin-handlebars and add handlebars to the plugins key:
import { defineConfig } from "eslint/config";
import handlebars from "eslint-plugin-handlebars";
export default defineConfig([
{
plugins: {
handlebars,
},
},
]);Then configure the rules you want to use under the rules key.
import { defineConfig } from "eslint/config";
import handlebars from "eslint-plugin-handlebars";
export default defineConfig([
{
plugins: {
handlebars,
},
rules: {
"handlebars/rule-name": "warn",
},
},
]);Configurations
| | Name |
| :-- | :------------ |
| ✅ | recommended |
| 🔒 | strict |
Rules
💼 Configurations enabled in.
✅ Set in the recommended configuration.
🔒 Set in the strict configuration.
🔧 Automatically fixable by the --fix CLI option.
| Name | Description | 💼 | 🔧 | | :--------------------------------------------------------------- | :---------------------------------------------------------------- | :---- | :-- | | block-spacing | Enforce consistent spacing around Handlebars blocks | ✅ 🔒 | 🔧 | | consistent-quotes | Enforce consistent quote style in Handlebars expressions | ✅ 🔒 | 🔧 | | expression-spacing | Enforce consistent spacing around Handlebars expressions | ✅ 🔒 | 🔧 | | indentation | Enforce consistent indentation in Handlebars templates | ✅ 🔒 | 🔧 | | no-missing-closing-tag | Validate that Handlebars blocks have matching closing tags | ✅ 🔒 | | | no-multiple-empty-lines | Disallow multiple consecutive empty lines in Handlebars templates | ✅ 🔒 | 🔧 | | no-trailing-spaces | Disallow trailing whitespace at the end of lines | ✅ 🔒 | 🔧 |
Development
Prerequisites
- Node.js 18+
- npm
Setup
# Install dependencies
npm ci
# Run tests
npm test
# Run linting
npm run lintCI/CD
This project uses Bitbucket Pipelines for continuous integration. The pipeline validates:
- ✅ All tests pass (94 tests)
- ✅ All linting passes (ESLint + documentation)
- ✅ Code quality standards are met
The pipeline runs on:
- Default branch: All commits
- Pull requests: All PRs
- Main branch: Manual deployment trigger
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Ensure tests and linting pass
- Submit a pull request
The CI pipeline will automatically validate your changes.
