gscan 4.49.6 → 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.
@@ -13,6 +13,7 @@ module.exports = {
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
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'),
16
17
  'GS110-NO-UNKNOWN-PAGE-BUILDER-USAGE': require('./lint-no-unknown-page-properties'),
17
18
  'GS120-NO-UNKNOWN-GLOBALS': require('./lint-no-unknown-globals'),
18
19
  'no-multi-param-conditionals': require('./lint-no-multi-param-conditionals'),
@@ -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
@@ -18,12 +18,20 @@ let rules = {
18
18
  Find more information about the <code>{{#get}}</code> helper <a href="${docsBaseUrl}helpers/get/" target=_blank>here</a>.`,
19
19
  helper: '{{#get}}'
20
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
+ },
21
29
  'GS001-DEPR-AMP-TEMPLATE': {
22
30
  level: 'warning',
23
31
  rule: 'AMP templates are no longer supported in Ghost 6.0',
24
32
  details: 'AMP support was removed in Ghost 6.0. Remove AMP templates and use responsive design instead.',
25
33
  // Matches <html amp> or <html ⚡>, with or without other attributes mixed in
26
- regex: /<html\s+(?:amp|⚡)(?:\s|>)|<html\s+[^>]*\s(?:amp|⚡)(?:\s|>)/i
34
+ regex: /<html\s+(?:amp|⚡)(?:\s|>)|<html\s+[^>]*\s(?:amp|⚡)(?:\s|>)/i
27
35
  }
28
36
  };
29
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.49.6",
3
+ "version": "4.49.7",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",