Provide linting for hbs template literals inside of JavaScript
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-hbs
:
$ npm install eslint-plugin-hbs --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-hbs
globally.
Add hbs
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"hbs"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"hbs/check-hbs-template-literals": 2
}
}
or
"rules": {
'hbs/check-hbs-template-literals': [
'error', 2,
{'ConfigFile': __dirname + '/.eslint-template-lintrc.json'}
],
}
The plugin will report the number of errors and the first line of the first error. Here's a running example. Left-hand side is the output of eslint
from the command-line, right-hand side is vim
running with eslint
(via syntastic):
- Fill in provided rules here