eslint-plugin-ember-template-lint 0.6.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ISC License (ISC)
2
2
 
3
- Copyright 2017, Patrick Pircher
3
+ Copyright 2023, Patrick Pircher
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
6
6
  purpose with or without fee is hereby granted, provided that the above
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 `hbs` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
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
 
@@ -28,6 +28,7 @@ module.exports = {
28
28
  const comments = [];
29
29
  const types = new Set(['Program']);
30
30
  const ast = {};
31
+ ast.body = [];
31
32
  ast.tokens = [ast];
32
33
  ast.range = [0, code.length];
33
34
  const lines = code.split('\n');
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(/\s+/)?.[0].length || 0;
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-ember-template-lint",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Provide linting for ember template",
5
5
  "keywords": [
6
6
  "eslint",