eslint-plugin-microtemplates
Version:
ESLint plugin for linting Resig-style microtemplate strings.
72 lines (49 loc) • 2.13 kB
Markdown
# eslint-plugin-microtemplates
[](https://travis-ci.org/platinumazure/eslint-plugin-microtemplates)
[](https://www.npmjs.com/package/eslint-plugin-microtemplates)
[](https://www.npmjs.com/package/eslint-plugin-microtemplates)
[](http://opensource.org/licenses/MIT)
[](https://gitter.im/platinumazure/eslint-plugin-microtemplates?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
ESLint plugin for linting Resig-style microtemplate strings.
## Installation
You'll first need to install [ESLint](http://eslint.org):
```
$ npm i eslint --save-dev
```
Next, install `eslint-plugin-microtemplates`:
```
$ npm install eslint-plugin-microtemplates --save-dev
```
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-microtemplates` globally.
## Usage
### Basic Configuration
Add `microtemplates` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"microtemplates"
]
}
```
You should also ensure ESLint will process HTML files. This can be done on the cli or in the CLIEngine API.
CLI:
```shell
$> eslint --ext .js,.htm,.html <options> <paths>
```
CLIEngine:
```js
var CLIEngine = require("eslint").CLIEngine;
var engine = new CLIEngine({
extensions: [".js", ".htm", ".html"],
// etc.
});
```
## Avoiding False Positives
You will want to configure ESLint to avoid common false positives. This might mean creating a separate config file for microtemplate use.
Here are some rules that may be worth disabling for microtemplates:
```json
{
"rules": {
"no-undef": 0
}
}