@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/index.js
CHANGED
|
@@ -2286,7 +2286,7 @@ function splitByTopLevelComma(str) {
|
|
|
2286
2286
|
return result;
|
|
2287
2287
|
}
|
|
2288
2288
|
|
|
2289
|
-
const STRICT_LOCALS_PATTERN = /^locals:\s
|
|
2289
|
+
const STRICT_LOCALS_PATTERN = /^locals:\s+\([^)]*\)\s*$/;
|
|
2290
2290
|
function isValidStrictLocalsFormat(content) {
|
|
2291
2291
|
return STRICT_LOCALS_PATTERN.test(content);
|
|
2292
2292
|
}
|
|
@@ -2316,6 +2316,9 @@ function detectSingularLocal(content) {
|
|
|
2316
2316
|
function detectMissingColonBeforeParens(content) {
|
|
2317
2317
|
return /^locals\s+\(/.test(content);
|
|
2318
2318
|
}
|
|
2319
|
+
function detectMissingSpaceAfterColon(content) {
|
|
2320
|
+
return /^locals:\(/.test(content);
|
|
2321
|
+
}
|
|
2319
2322
|
function detectMissingParentheses(content) {
|
|
2320
2323
|
return /^locals:\s*[^(]/.test(content);
|
|
2321
2324
|
}
|
|
@@ -2462,6 +2465,10 @@ class ERBStrictLocalsCommentSyntaxVisitor extends BaseRuleVisitor {
|
|
|
2462
2465
|
this.addOffense("Use `locals:` with a colon before the parentheses, not `locals (`.", node.location);
|
|
2463
2466
|
return;
|
|
2464
2467
|
}
|
|
2468
|
+
if (detectMissingSpaceAfterColon(commentContent)) {
|
|
2469
|
+
this.addOffense("Missing space after `locals:`. Rails Strict Locals require a space after the colon: `<%# locals: (...) %>`.", node.location);
|
|
2470
|
+
return;
|
|
2471
|
+
}
|
|
2465
2472
|
if (detectMissingParentheses(commentContent)) {
|
|
2466
2473
|
this.addOffense("Wrap parameters in parentheses: `locals: (name:)` or `locals: (name: default)`.", node.location);
|
|
2467
2474
|
return;
|