Plugin that offers spacing possibilities in Angular's templates using ESLint
npm install @betsys-eslint/eslint-plugin-angular-template-spacing
ESLint plugin that ensures your angular interpolations and pipes are consistent across the project
---
#### Installing automatically
To install the configuration with all the necessary configuration changes, use the following:
``bash`
npx @betsys-eslint/install plugin angular-template-spacing
To read more about our installation script visit: @betsys-eslint/install.
:warning: This package currently works only with .eslintrc.json file. We plan to support other configuration files (.js and .yml) in the future.
#### Installing manually
You can install the plugin without using the installation script above, see the following:
`bash`
npm install --save-dev @betsys-eslint/eslint-plugin-angular-template-spacing
after installation, add the plugin to you ESLint config:
`json5`
{
// Root configuration of your Angular project
"overrides": [
{
files: ["*.html"],
// Locate configuration for your HTML files
"plugins": [
// ...
"@betsys-eslint/angular-template-spacing"
],
"extends": [
// ...
"plugin:@betsys-eslint/angular-template-spacing/recommended"
]
}
]
}
#### @betsys-eslint/angular-template-spacing/interpolation
We follow common ESLint configuration practices:
- First parameter is ESLint severity level
- Second parameter
- always requires whitespace between | (pipe) characternever
- disallows whitespace between | (pipe) characterallowNewlines
- Third parameter is an object with additional options
- option:true
- defaults to false
- disallows newlines to be treated as "whitespace"true
- allows newlines to be treated as "whitespace"
Example:
`json5`
{
"@betsys-eslint/angular-template-spacing/interpolation": ["error", "always", { "allowNewlines": false }]
}
#### @betsys-eslint/angular-template-spacing/pipe
We follow common ESLint configuration practices:
- First parameter is ESLint severity level
- Second parameter
- always requires whitespace between | (pipe) characternever
- disallows whitespace between | (pipe) character
Example:
`json5`
{
"@betsys-eslint/angular-template-spacing/pipe": ["error", "always"]
}
#### Recommended (@betsys-eslint/angular-template-spacing/recommended)
`json5``
{
"@betsys-eslint/angular-template-spacing/interpolation": ["error", "always", { "allowNewlines": false }],
"@betsys-eslint/angular-template-spacing/pipe": ["error", "always"]
}