gscan 6.3.0 → 6.4.0
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.
|
@@ -14,6 +14,7 @@ module.exports = {
|
|
|
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
16
|
'GS090-NO-LIMIT-OVER-100-IN-GET-HELPER': require('./lint-no-limit-over-100-in-get-helper'),
|
|
17
|
+
'GS090-NO-INVALID-CONDITIONAL-ARGUMENTS': require('./lint-no-multi-param-conditionals'),
|
|
17
18
|
'GS110-NO-UNKNOWN-PAGE-BUILDER-USAGE': require('./lint-no-unknown-page-properties'),
|
|
18
19
|
'GS120-NO-UNKNOWN-GLOBALS': require('./lint-no-unknown-globals'),
|
|
19
20
|
'no-multi-param-conditionals': require('./lint-no-multi-param-conditionals'),
|
|
@@ -9,7 +9,7 @@ const message = 'The {{img_url}} helper should not be used as a parameter to {{#
|
|
|
9
9
|
module.exports = class NoMultiParamConditionals extends Rule {
|
|
10
10
|
_checkForImgUrlParam(node) {
|
|
11
11
|
const isConditional = node.path.original === 'if' || node.path.original === 'unless';
|
|
12
|
-
const hasImgUrlParam = isConditional && node.params[0].original === 'img_url';
|
|
12
|
+
const hasImgUrlParam = isConditional && node.params[0] && node.params[0].original === 'img_url';
|
|
13
13
|
let fix;
|
|
14
14
|
|
|
15
15
|
if (isConditional && hasImgUrlParam) {
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
// https://github.com/TryGhost/gscan/issues/85
|
|
2
2
|
|
|
3
3
|
const Rule = require('./base');
|
|
4
|
-
const message = '
|
|
4
|
+
const message = 'The {{#if}} and {{#unless}} helpers require exactly one argument.';
|
|
5
5
|
|
|
6
6
|
// valid:
|
|
7
7
|
// {{#if foo}}
|
|
8
8
|
// {{#unless foo}}
|
|
9
9
|
|
|
10
10
|
// invalid:
|
|
11
|
+
// {{#if}}
|
|
11
12
|
// {{#if foo bar}}
|
|
13
|
+
// {{#unless}}
|
|
12
14
|
// {{#unless foo bar}}
|
|
13
15
|
|
|
14
16
|
module.exports = class NoMultiParamConditionals extends Rule {
|
|
15
17
|
_checkForMultipleParams(node) {
|
|
16
18
|
const isConditional = node.path.original === 'if' || node.path.original === 'unless';
|
|
17
|
-
const
|
|
19
|
+
const hasInvalidParamCount = node.params.length !== 1;
|
|
18
20
|
|
|
19
|
-
if (isConditional &&
|
|
21
|
+
if (isConditional && hasInvalidParamCount) {
|
|
20
22
|
this.log({
|
|
21
23
|
message,
|
|
22
24
|
line: node.loc && node.loc.start.line,
|
package/lib/specs/v6.js
CHANGED
|
@@ -11,6 +11,12 @@ const previousRules = previousSpec.rules;
|
|
|
11
11
|
let knownHelpers = ['split', 'json', 'color_to_rgba', 'contrast_text_color', 'raw', 'search', 'social_accounts'];
|
|
12
12
|
let templates = [];
|
|
13
13
|
let rules = {
|
|
14
|
+
'GS090-NO-INVALID-CONDITIONAL-ARGUMENTS': {
|
|
15
|
+
level: 'error',
|
|
16
|
+
fatal: true,
|
|
17
|
+
rule: 'Use exactly one argument in <code>{{#if}}</code> and <code>{{#unless}}</code> helpers',
|
|
18
|
+
details: oneLineTrim`The <code>{{#if}}</code> and <code>{{#unless}}</code> helpers only support one argument. To compare values, use a supported helper such as <code>{{#match}}</code>, for example <code>{{#match statusCode 404}}</code>.`
|
|
19
|
+
},
|
|
14
20
|
'GS090-NO-LIMIT-ALL-IN-GET-HELPER': {
|
|
15
21
|
level: 'warning',
|
|
16
22
|
rule: 'Using <code>limit="all"</code> in <code>{{#get}}</code> helper is not supported',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gscan",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ghost",
|
|
@@ -43,23 +43,23 @@
|
|
|
43
43
|
"gscan": "./bin/cli.js"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@sentry/node": "10.
|
|
47
|
-
"@tryghost/config": "2.
|
|
48
|
-
"@tryghost/debug": "2.
|
|
49
|
-
"@tryghost/errors": "3.
|
|
50
|
-
"@tryghost/logging": "5.0
|
|
51
|
-
"@tryghost/nql": "0.
|
|
52
|
-
"@tryghost/pretty-cli": "3.
|
|
53
|
-
"@tryghost/server": "3.0
|
|
54
|
-
"@tryghost/zip": "3.
|
|
46
|
+
"@sentry/node": "10.58.0",
|
|
47
|
+
"@tryghost/config": "2.3.0",
|
|
48
|
+
"@tryghost/debug": "2.3.0",
|
|
49
|
+
"@tryghost/errors": "3.3.0",
|
|
50
|
+
"@tryghost/logging": "5.1.0",
|
|
51
|
+
"@tryghost/nql": "0.13.1",
|
|
52
|
+
"@tryghost/pretty-cli": "3.3.0",
|
|
53
|
+
"@tryghost/server": "3.1.0",
|
|
54
|
+
"@tryghost/zip": "3.4.0",
|
|
55
55
|
"chalk": "5.6.2",
|
|
56
56
|
"express": "5.2.1",
|
|
57
57
|
"express-handlebars": "8.0.1",
|
|
58
58
|
"glob": "13.0.6",
|
|
59
59
|
"handlebars": "4.7.9",
|
|
60
60
|
"lodash": "4.18.1",
|
|
61
|
-
"multer": "2.
|
|
62
|
-
"semver": "7.8.
|
|
61
|
+
"multer": "2.2.0",
|
|
62
|
+
"semver": "7.8.4",
|
|
63
63
|
"validator": "^13.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"@eslint/eslintrc": "3.3.5",
|
|
68
68
|
"@eslint/js": "10.0.1",
|
|
69
69
|
"@tryghost/pro-ship": "1.0.10",
|
|
70
|
-
"@vitest/coverage-v8": "4.1.
|
|
71
|
-
"eslint": "10.
|
|
70
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
71
|
+
"eslint": "10.5.0",
|
|
72
72
|
"eslint-plugin-ghost": "3.5.0",
|
|
73
73
|
"nodemon": "3.1.14",
|
|
74
|
-
"vitest": "4.1.
|
|
74
|
+
"vitest": "4.1.9"
|
|
75
75
|
},
|
|
76
76
|
"files": [
|
|
77
77
|
"lib",
|