@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.js
CHANGED
|
@@ -161,7 +161,7 @@ class Token {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
164
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
164
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/errors.ts.erb
|
|
165
165
|
class HerbError {
|
|
166
166
|
type;
|
|
167
167
|
message;
|
|
@@ -726,7 +726,7 @@ function convertToUTF8(string) {
|
|
|
726
726
|
}
|
|
727
727
|
|
|
728
728
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
729
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
729
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/nodes.ts.erb
|
|
730
730
|
class Node {
|
|
731
731
|
type;
|
|
732
732
|
location;
|
|
@@ -2980,7 +2980,7 @@ class ParseResult extends Result {
|
|
|
2980
2980
|
}
|
|
2981
2981
|
|
|
2982
2982
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2983
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
2983
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/node-type-guards.ts.erb
|
|
2984
2984
|
/**
|
|
2985
2985
|
* Type guard functions for AST nodes.
|
|
2986
2986
|
* These functions provide type checking by combining both instanceof
|
|
@@ -3683,7 +3683,7 @@ function didyoumean(input, list, threshold) {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
|
|
3685
3685
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
3686
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.
|
|
3686
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.9/templates/javascript/packages/core/src/visitor.ts.erb
|
|
3687
3687
|
class Visitor {
|
|
3688
3688
|
visit(node) {
|
|
3689
3689
|
if (!node)
|
|
@@ -8275,7 +8275,7 @@ function splitByTopLevelComma(str) {
|
|
|
8275
8275
|
return result;
|
|
8276
8276
|
}
|
|
8277
8277
|
|
|
8278
|
-
const STRICT_LOCALS_PATTERN = /^locals:\s
|
|
8278
|
+
const STRICT_LOCALS_PATTERN = /^locals:\s+\([^)]*\)\s*$/;
|
|
8279
8279
|
function isValidStrictLocalsFormat(content) {
|
|
8280
8280
|
return STRICT_LOCALS_PATTERN.test(content);
|
|
8281
8281
|
}
|
|
@@ -8305,6 +8305,9 @@ function detectSingularLocal(content) {
|
|
|
8305
8305
|
function detectMissingColonBeforeParens(content) {
|
|
8306
8306
|
return /^locals\s+\(/.test(content);
|
|
8307
8307
|
}
|
|
8308
|
+
function detectMissingSpaceAfterColon(content) {
|
|
8309
|
+
return /^locals:\(/.test(content);
|
|
8310
|
+
}
|
|
8308
8311
|
function detectMissingParentheses(content) {
|
|
8309
8312
|
return /^locals:\s*[^(]/.test(content);
|
|
8310
8313
|
}
|
|
@@ -8451,6 +8454,10 @@ class ERBStrictLocalsCommentSyntaxVisitor extends BaseRuleVisitor {
|
|
|
8451
8454
|
this.addOffense("Use `locals:` with a colon before the parentheses, not `locals (`.", node.location);
|
|
8452
8455
|
return;
|
|
8453
8456
|
}
|
|
8457
|
+
if (detectMissingSpaceAfterColon(commentContent)) {
|
|
8458
|
+
this.addOffense("Missing space after `locals:`. Rails Strict Locals require a space after the colon: `<%# locals: (...) %>`.", node.location);
|
|
8459
|
+
return;
|
|
8460
|
+
}
|
|
8454
8461
|
if (detectMissingParentheses(commentContent)) {
|
|
8455
8462
|
this.addOffense("Wrap parameters in parentheses: `locals: (name:)` or `locals: (name: default)`.", node.location);
|
|
8456
8463
|
return;
|