gscan 4.49.5 → 4.49.7
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/app/tpl/index.hbs
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
<span class="gh-input-icon select-arrow">{{> icon-arrow-up}}</span>
|
|
23
23
|
<span class="gh-input-icon select-arrow active">{{> icon-arrow-down}}</span>
|
|
24
24
|
<select class="gh-input gh-select" name="version" id="version">
|
|
25
|
+
<option value="v6">{{ghostVersions.v6.major}}</option>
|
|
25
26
|
<option value="v5" selected>{{ghostVersions.v5.major}}</option>
|
|
26
27
|
<option value="v4">{{ghostVersions.v4.major}}</option>
|
|
27
28
|
<option value="v3">{{ghostVersions.v3.major}}</option>
|
|
@@ -12,6 +12,8 @@ module.exports = {
|
|
|
12
12
|
'GS090-NO-PRICE-DATA-CURRENCY-GLOBAL': require('./lint-no-price-data-currency-global'),
|
|
13
13
|
'GS090-NO-PRICE-DATA-CURRENCY-CONTEXT': require('./lint-no-price-data-currency-context'),
|
|
14
14
|
'GS090-NO-PRICE-DATA-MONTHLY-YEARLY': require('./lint-no-price-data-monthly-yearly'),
|
|
15
|
+
'GS090-NO-LIMIT-ALL-IN-GET-HELPER': require('./lint-no-limit-all-in-get-helper'),
|
|
16
|
+
'GS090-NO-LIMIT-OVER-100-IN-GET-HELPER': require('./lint-no-limit-over-100-in-get-helper'),
|
|
15
17
|
'GS110-NO-UNKNOWN-PAGE-BUILDER-USAGE': require('./lint-no-unknown-page-properties'),
|
|
16
18
|
'GS120-NO-UNKNOWN-GLOBALS': require('./lint-no-unknown-globals'),
|
|
17
19
|
'no-multi-param-conditionals': require('./lint-no-multi-param-conditionals'),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const Rule = require('./base');
|
|
2
|
+
const {getNodeName} = require('../helpers');
|
|
3
|
+
|
|
4
|
+
module.exports = class NoLimitAllInGetHelper extends Rule {
|
|
5
|
+
_checkForLimitAll(node) {
|
|
6
|
+
const nodeName = getNodeName(node);
|
|
7
|
+
|
|
8
|
+
if (nodeName === 'get' && node.hash && node.hash.pairs && node.hash.pairs.length > 0) {
|
|
9
|
+
const limitPair = node.hash.pairs.find(pair => pair.key === 'limit');
|
|
10
|
+
|
|
11
|
+
if (limitPair && limitPair.value) {
|
|
12
|
+
// Handle both string literals and quoted values
|
|
13
|
+
const limitValue = limitPair.value.value || limitPair.value.original;
|
|
14
|
+
|
|
15
|
+
if (limitValue === 'all') {
|
|
16
|
+
this.log({
|
|
17
|
+
line: node.loc && node.loc.start.line,
|
|
18
|
+
column: node.loc && node.loc.start.column,
|
|
19
|
+
source: this.sourceForNode(node)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
visitor() {
|
|
27
|
+
return {
|
|
28
|
+
BlockStatement: this._checkForLimitAll.bind(this)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const Rule = require('./base');
|
|
2
|
+
const {getNodeName} = require('../helpers');
|
|
3
|
+
|
|
4
|
+
module.exports = class NoLimitOver100InGetHelper extends Rule {
|
|
5
|
+
_checkForLimitOver100(node) {
|
|
6
|
+
const nodeName = getNodeName(node);
|
|
7
|
+
|
|
8
|
+
if (nodeName === 'get' && node.hash && node.hash.pairs && node.hash.pairs.length > 0) {
|
|
9
|
+
const limitPair = node.hash.pairs.find(pair => pair.key === 'limit');
|
|
10
|
+
|
|
11
|
+
if (limitPair && limitPair.value) {
|
|
12
|
+
// Handle both string literals and quoted values
|
|
13
|
+
const limitValue = limitPair.value.value || limitPair.value.original;
|
|
14
|
+
|
|
15
|
+
// Parse the limit value as a number
|
|
16
|
+
const numericLimit = parseInt(limitValue, 10);
|
|
17
|
+
|
|
18
|
+
if (!isNaN(numericLimit) && numericLimit > 100) {
|
|
19
|
+
this.log({
|
|
20
|
+
line: node.loc && node.loc.start.line,
|
|
21
|
+
column: node.loc && node.loc.start.column,
|
|
22
|
+
source: this.sourceForNode(node)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
visitor() {
|
|
30
|
+
return {
|
|
31
|
+
BlockStatement: this._checkForLimitOver100.bind(this)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
package/lib/specs/v6.js
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
|
+
const oneLineTrim = require('common-tags/lib/oneLineTrim');
|
|
2
3
|
const previousSpec = require('./v5');
|
|
4
|
+
const docsBaseUrl = `https://ghost.org/docs/themes/`;
|
|
3
5
|
|
|
4
6
|
const previousKnownHelpers = previousSpec.knownHelpers;
|
|
5
7
|
const previousTemplates = previousSpec.templates;
|
|
6
8
|
const previousRules = previousSpec.rules;
|
|
7
9
|
|
|
8
10
|
// assign new or overwrite existing knownHelpers, templates, or rules here:
|
|
9
|
-
// Currently no new rules for v6
|
|
10
11
|
let knownHelpers = [];
|
|
11
12
|
let templates = [];
|
|
12
|
-
let rules = {
|
|
13
|
+
let rules = {
|
|
14
|
+
'GS090-NO-LIMIT-ALL-IN-GET-HELPER': {
|
|
15
|
+
level: 'warning',
|
|
16
|
+
rule: 'Using <code>limit="all"</code> in <code>{{#get}}</code> helper is not supported',
|
|
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>.`,
|
|
19
|
+
helper: '{{#get}}'
|
|
20
|
+
},
|
|
21
|
+
'GS090-NO-LIMIT-OVER-100-IN-GET-HELPER': {
|
|
22
|
+
level: 'warning',
|
|
23
|
+
rule: 'Using <code>limit</code> values greater than 100 in <code>{{#get}}</code> helper is not supported',
|
|
24
|
+
details: oneLineTrim`Ghost automatically caps <code>limit</code> values at 100, so using higher values will not return more results.
|
|
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>.`,
|
|
27
|
+
helper: '{{#get}}'
|
|
28
|
+
},
|
|
29
|
+
'GS001-DEPR-AMP-TEMPLATE': {
|
|
30
|
+
level: 'warning',
|
|
31
|
+
rule: 'AMP templates are no longer supported in Ghost 6.0',
|
|
32
|
+
details: 'AMP support was removed in Ghost 6.0. Remove AMP templates and use responsive design instead.',
|
|
33
|
+
// Matches <html amp> or <html ⚡>, with or without other attributes mixed in
|
|
34
|
+
regex: /<html\s+(?:amp|⚡)(?:\s|>)|<html\s+[^>]*\s(?:amp|⚡)(?:\s|>)/i
|
|
35
|
+
}
|
|
36
|
+
};
|
|
13
37
|
|
|
14
38
|
knownHelpers = _.union(previousKnownHelpers, knownHelpers);
|
|
15
39
|
templates = _.union(previousTemplates, templates);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gscan",
|
|
3
|
-
"version": "4.49.
|
|
3
|
+
"version": "4.49.7",
|
|
4
4
|
"description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ghost",
|
|
@@ -71,7 +71,7 @@
|
|
|
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.1",
|
|
75
75
|
"node-fetch": "3.3.2",
|
|
76
76
|
"nodemon": "2.0.7",
|
|
77
77
|
"rewire": "6.0.0",
|