eslint-plugin-ember-template-lint 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/README.md +11 -2
- package/lib/parser/hbs-parser.js +1 -0
- package/lib/rules/lint.js +1 -1
- package/package.json +1 -1
package/LICENSE.md
CHANGED
package/README.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
# eslint-plugin-hbs-template
|
2
2
|
|
3
|
-
Provide linting for hbs templates files
|
3
|
+
Provide linting (via [ember-template-lint](https://github.com/ember-template-lint/ember-template-lint)) for hbs templates files, template string literals and gts,gjs
|
4
|
+
* no extra config file needed
|
5
|
+
|
6
|
+
* no need to run extra tool for linting
|
7
|
+
|
8
|
+
* no need to run extra tool to fix lint issues
|
9
|
+
|
10
|
+
* no need to implement & maintain editor support for ember-template-lint
|
11
|
+
|
12
|
+
* it also has the advantage that it can know the scope for some template-lint rules, like no-implicit-this, and remove those messages
|
4
13
|
|
5
14
|
## Installation
|
6
15
|
|
@@ -20,7 +29,7 @@ $ npm install eslint-plugin-ember-template-lint --save-dev
|
|
20
29
|
|
21
30
|
## Usage
|
22
31
|
|
23
|
-
Add `
|
32
|
+
Add `ember-template-lint` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
24
33
|
|
25
34
|
### 2. Modify your `.eslintrc.js`
|
26
35
|
|
package/lib/parser/hbs-parser.js
CHANGED
package/lib/rules/lint.js
CHANGED
@@ -11,7 +11,7 @@ function runTemplateLint(node, context) {
|
|
11
11
|
const filename = context.getPhysicalFilename();
|
12
12
|
let text = node.contents;
|
13
13
|
const initialLine = sourceCodeText.split('\n')[node.loc.start.line-1];
|
14
|
-
const columnOffset = initialLine.match(
|
14
|
+
const columnOffset = initialLine.match(/^\s+/)?.[0].length || 0;
|
15
15
|
const offset = (node.range[0] || 0);
|
16
16
|
const spaces = ' '.repeat(columnOffset);
|
17
17
|
const originalDocument = new DocumentLines(spaces + text);
|