@herb-tools/linter 0.8.8 → 0.8.9
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/README.md +2 -2
- package/dist/herb-lint.js +21 -14
- package/dist/herb-lint.js.map +1 -1
- package/dist/index.cjs +8 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.cjs +12 -5
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.js +12 -5
- package/dist/loader.js.map +1 -1
- package/dist/package.json +7 -7
- package/dist/src/rules/erb-strict-locals-comment-syntax.js +8 -1
- package/dist/src/rules/erb-strict-locals-comment-syntax.js.map +1 -1
- package/package.json +7 -7
- package/src/rules/erb-strict-locals-comment-syntax.ts +10 -1
package/dist/loader.cjs
CHANGED
|
@@ -182,7 +182,7 @@ class Token {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
185
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
185
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/errors.ts.erb
|
|
186
186
|
class HerbError {
|
|
187
187
|
type;
|
|
188
188
|
message;
|
|
@@ -747,7 +747,7 @@ function convertToUTF8(string) {
|
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
750
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
750
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/nodes.ts.erb
|
|
751
751
|
class Node {
|
|
752
752
|
type;
|
|
753
753
|
location;
|
|
@@ -3001,7 +3001,7 @@ class ParseResult extends Result {
|
|
|
3001
3001
|
}
|
|
3002
3002
|
|
|
3003
3003
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3004
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3004
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
3005
3005
|
/**
|
|
3006
3006
|
* Type guard functions for AST nodes.
|
|
3007
3007
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3704,7 +3704,7 @@ function didyoumean(input, list, threshold) {
|
|
|
3704
3704
|
}
|
|
3705
3705
|
|
|
3706
3706
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3707
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3707
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3708
3708
|
class Visitor {
|
|
3709
3709
|
visit(node) {
|
|
3710
3710
|
if (!node)
|
|
@@ -8296,7 +8296,7 @@ function splitByTopLevelComma(str) {
|
|
|
8296
8296
|
return result;
|
|
8297
8297
|
}
|
|
8298
8298
|
|
|
8299
|
-
const STRICT_LOCALS_PATTERN = /^locals:\s
|
|
8299
|
+
const STRICT_LOCALS_PATTERN = /^locals:\s+\([^)]*\)\s*$/;
|
|
8300
8300
|
function isValidStrictLocalsFormat(content) {
|
|
8301
8301
|
return STRICT_LOCALS_PATTERN.test(content);
|
|
8302
8302
|
}
|
|
@@ -8326,6 +8326,9 @@ function detectSingularLocal(content) {
|
|
|
8326
8326
|
function detectMissingColonBeforeParens(content) {
|
|
8327
8327
|
return /^locals\s+\(/.test(content);
|
|
8328
8328
|
}
|
|
8329
|
+
function detectMissingSpaceAfterColon(content) {
|
|
8330
|
+
return /^locals:\(/.test(content);
|
|
8331
|
+
}
|
|
8329
8332
|
function detectMissingParentheses(content) {
|
|
8330
8333
|
return /^locals:\s*[^(]/.test(content);
|
|
8331
8334
|
}
|
|
@@ -8472,6 +8475,10 @@ class ERBStrictLocalsCommentSyntaxVisitor extends BaseRuleVisitor {
|
|
|
8472
8475
|
this.addOffense("Use `locals:` with a colon before the parentheses, not `locals (`.", node.location);
|
|
8473
8476
|
return;
|
|
8474
8477
|
}
|
|
8478
|
+
if (detectMissingSpaceAfterColon(commentContent)) {
|
|
8479
|
+
this.addOffense("Missing space after `locals:`. Rails Strict Locals require a space after the colon: `<%# locals: (...) %>`.", node.location);
|
|
8480
|
+
return;
|
|
8481
|
+
}
|
|
8475
8482
|
if (detectMissingParentheses(commentContent)) {
|
|
8476
8483
|
this.addOffense("Wrap parameters in parentheses: `locals: (name:)` or `locals: (name: default)`.", node.location);
|
|
8477
8484
|
return;
|