gscan 5.2.0 → 5.2.2
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.
|
@@ -7,9 +7,36 @@ module.exports = class MarkUsedCustomThemeSettings extends Rule {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
// `get` helpers support using handlebars expressions in their filter attribute
|
|
11
|
+
// Handlebars does not parse these expressions within StringLiterals itself,
|
|
12
|
+
// so we need to manually check for them here.
|
|
13
|
+
_checkGetHelperAttributes(node) {
|
|
14
|
+
// Only check 'get' helpers
|
|
15
|
+
if (node.path && node.path.original !== 'get') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Check hash parameters (named attributes like filter="...")
|
|
20
|
+
if (node.hash && node.hash.pairs) {
|
|
21
|
+
node.hash.pairs.forEach((pair) => {
|
|
22
|
+
// Only check the 'filter' attribute
|
|
23
|
+
if (pair.key === 'filter' && pair.value.type === 'StringLiteral') {
|
|
24
|
+
// Search for @custom.* references in the string value
|
|
25
|
+
const customThemeSettingRegex = /@custom\.([a-z0-9_]+)/g;
|
|
26
|
+
let match;
|
|
27
|
+
while ((match = customThemeSettingRegex.exec(pair.value.value)) !== null) {
|
|
28
|
+
this.scanner.context.customThemeSettings.push(match[1]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
10
35
|
visitor() {
|
|
11
36
|
return {
|
|
12
|
-
PathExpression: this._markUsedCustomThemeSettings.bind(this)
|
|
37
|
+
PathExpression: this._markUsedCustomThemeSettings.bind(this),
|
|
38
|
+
SubExpression: this._checkGetHelperAttributes.bind(this),
|
|
39
|
+
BlockStatement: this._checkGetHelperAttributes.bind(this)
|
|
13
40
|
};
|
|
14
41
|
}
|
|
15
42
|
};
|
package/lib/specs/v6.js
CHANGED
|
@@ -15,7 +15,7 @@ let rules = {
|
|
|
15
15
|
level: 'warning',
|
|
16
16
|
rule: 'Using <code>limit="all"</code> in <code>{{#get}}</code> helper is not supported',
|
|
17
17
|
details: oneLineTrim`In Ghost 6.0 and later, <code>limit="all"</code> will return at most 100 results. Consider using a specific limit number or implementing pagination instead.<br>
|
|
18
|
-
Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/get/" target=_blank>here</a>.`,
|
|
18
|
+
Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/functional/get/" target=_blank>here</a>.`,
|
|
19
19
|
helper: '{{#get}}'
|
|
20
20
|
},
|
|
21
21
|
'GS090-NO-LIMIT-OVER-100-IN-GET-HELPER': {
|
|
@@ -23,7 +23,7 @@ let rules = {
|
|
|
23
23
|
rule: 'Using <code>limit</code> values greater than 100 in <code>{{#get}}</code> helper is not supported',
|
|
24
24
|
details: oneLineTrim`Ghost automatically caps <code>limit</code> values at 100, so using higher values will not return more results.
|
|
25
25
|
Consider using pagination or setting the limit to 100 or lower.<br>
|
|
26
|
-
Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/get/" target=_blank>here</a>.`,
|
|
26
|
+
Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/functional/get/" target=_blank>here</a>.`,
|
|
27
27
|
helper: '{{#get}}'
|
|
28
28
|
},
|
|
29
29
|
'GS001-DEPR-TWITTER-URL': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gscan",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ghost",
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"c8": "8.0.1",
|
|
72
72
|
"eslint": "8.1.0",
|
|
73
73
|
"eslint-plugin-ghost": "2.1.0",
|
|
74
|
-
"mocha": "11.7.
|
|
74
|
+
"mocha": "11.7.5",
|
|
75
75
|
"node-fetch": "3.3.2",
|
|
76
76
|
"nodemon": "2.0.7",
|
|
77
77
|
"rewire": "6.0.0",
|
|
78
78
|
"should": "13.2.3",
|
|
79
|
-
"sinon": "21.0.
|
|
79
|
+
"sinon": "21.0.1"
|
|
80
80
|
},
|
|
81
81
|
"files": [
|
|
82
82
|
"lib",
|