gscan 4.26.1 → 4.29.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.
- package/bin/cli.js +8 -3
- package/lib/ast-linter/rules/index.js +2 -0
- package/lib/ast-linter/rules/lint-no-member-products-data-helper.js +24 -0
- package/lib/ast-linter/rules/lint-no-price-data-helper.js +24 -0
- package/lib/ast-linter/rules/lint-no-product-data-helper.js +2 -2
- package/lib/ast-linter/rules/lint-no-products-data-helper.js +2 -2
- package/lib/ast-linter/rules/lint-no-products-helper.js +2 -2
- package/lib/checks/050-koenig-css-classes.js +1 -1
- package/lib/specs/canary.js +221 -157
- package/lib/specs/v1.js +20 -20
- package/lib/specs/v2.js +71 -62
- package/lib/specs/v3.js +2 -1
- package/lib/specs/v4.js +7 -6
- package/lib/utils/package-json.js +2 -11
- package/package.json +13 -13
package/bin/cli.js
CHANGED
|
@@ -131,12 +131,17 @@ function outputResult(result, options) {
|
|
|
131
131
|
if (result.failures && result.failures.length) {
|
|
132
132
|
if (options.verbose) {
|
|
133
133
|
ui.log(''); // extra line-break
|
|
134
|
-
ui.log(`${chalk.bold('Files:')}`);
|
|
134
|
+
ui.log(`${chalk.bold('Affected Files:')}`);
|
|
135
135
|
result.failures.forEach((failure) => {
|
|
136
|
-
|
|
136
|
+
let message = failure.ref;
|
|
137
|
+
|
|
138
|
+
if (failure.message) {
|
|
139
|
+
message += `- ${failure.message}`;
|
|
140
|
+
}
|
|
141
|
+
ui.log(message);
|
|
137
142
|
});
|
|
138
143
|
} else {
|
|
139
|
-
ui.log(`${chalk.bold('Files:')} ${_.map(result.failures, 'ref')}`);
|
|
144
|
+
ui.log(`${chalk.bold('Affected Files:')} ${_.map(result.failures, 'ref')}`);
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
147
|
|
|
@@ -6,6 +6,8 @@ module.exports = {
|
|
|
6
6
|
'GS090-NO-PRODUCTS-HELPER': require('./lint-no-products-helper'),
|
|
7
7
|
'GS090-NO-PRODUCT-DATA-HELPER': require('./lint-no-product-data-helper'),
|
|
8
8
|
'GS090-NO-PRODUCTS-DATA-HELPER': require('./lint-no-products-data-helper'),
|
|
9
|
+
'GS090-NO-MEMBER-PRODUCTS-DATA-HELPER': require('./lint-no-member-products-data-helper'),
|
|
10
|
+
'GS090-NO-PRICE-DATA-HELPER': require('./lint-no-price-data-helper'),
|
|
9
11
|
'no-multi-param-conditionals': require('./lint-no-multi-param-conditionals'),
|
|
10
12
|
'no-nested-async-helpers': require('./lint-no-nested-async-helpers'),
|
|
11
13
|
'no-prev-next-post-outside-post-context': require('./lint-no-prev-next-post-outside-post-context'),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const Rule = require('./base');
|
|
2
|
+
const {getNodeName, logNode} = require('../helpers');
|
|
3
|
+
|
|
4
|
+
module.exports = class NoMemberProductsHelper extends Rule {
|
|
5
|
+
_checkForHelperName(node) {
|
|
6
|
+
const nodeName = getNodeName(node);
|
|
7
|
+
const isMatchingHelper = (nodeName === '@member.products');
|
|
8
|
+
|
|
9
|
+
if (isMatchingHelper) {
|
|
10
|
+
this.log({
|
|
11
|
+
message: `${logNode(node)} should not be used`,
|
|
12
|
+
line: node.loc && node.loc.start.line,
|
|
13
|
+
column: node.loc && node.loc.start.column,
|
|
14
|
+
source: this.sourceForNode(node)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
visitor() {
|
|
20
|
+
return {
|
|
21
|
+
MustacheStatement: this._checkForHelperName.bind(this)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const Rule = require('./base');
|
|
2
|
+
const {getNodeName, logNode} = require('../helpers');
|
|
3
|
+
|
|
4
|
+
module.exports = class NoPriceDataHelper extends Rule {
|
|
5
|
+
_checkForHelperName(node) {
|
|
6
|
+
const nodeName = getNodeName(node);
|
|
7
|
+
const isMatchingHelper = (nodeName.startsWith('@price.'));
|
|
8
|
+
|
|
9
|
+
if (isMatchingHelper) {
|
|
10
|
+
this.log({
|
|
11
|
+
message: `${logNode(node)} should not be used`,
|
|
12
|
+
line: node.loc && node.loc.start.line,
|
|
13
|
+
column: node.loc && node.loc.start.column,
|
|
14
|
+
source: this.sourceForNode(node)
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
visitor() {
|
|
20
|
+
return {
|
|
21
|
+
MustacheStatement: this._checkForHelperName.bind(this)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -2,7 +2,7 @@ const Rule = require('./base');
|
|
|
2
2
|
const {getNodeName, logNode} = require('../helpers');
|
|
3
3
|
|
|
4
4
|
module.exports = class NoProductsHelper extends Rule {
|
|
5
|
-
|
|
5
|
+
_checkForHelperName(node) {
|
|
6
6
|
const nodeName = getNodeName(node);
|
|
7
7
|
const isProductsHelper = (nodeName === '@product');
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ module.exports = class NoProductsHelper extends Rule {
|
|
|
18
18
|
|
|
19
19
|
visitor() {
|
|
20
20
|
return {
|
|
21
|
-
MustacheStatement: this.
|
|
21
|
+
MustacheStatement: this._checkForHelperName.bind(this)
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -2,7 +2,7 @@ const Rule = require('./base');
|
|
|
2
2
|
const {getNodeName, logNode} = require('../helpers');
|
|
3
3
|
|
|
4
4
|
module.exports = class NoProductsHelper extends Rule {
|
|
5
|
-
|
|
5
|
+
_checkForHelperName(node) {
|
|
6
6
|
const nodeName = getNodeName(node);
|
|
7
7
|
const isProductsHelper = (nodeName === '@products');
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ module.exports = class NoProductsHelper extends Rule {
|
|
|
18
18
|
|
|
19
19
|
visitor() {
|
|
20
20
|
return {
|
|
21
|
-
MustacheStatement: this.
|
|
21
|
+
MustacheStatement: this._checkForHelperName.bind(this)
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -2,7 +2,7 @@ const Rule = require('./base');
|
|
|
2
2
|
const {getNodeName, logNode} = require('../helpers');
|
|
3
3
|
|
|
4
4
|
module.exports = class NoProductsHelper extends Rule {
|
|
5
|
-
|
|
5
|
+
_checkForHelperName(node) {
|
|
6
6
|
const nodeName = getNodeName(node);
|
|
7
7
|
const isProductsHelper = (nodeName === 'products');
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ module.exports = class NoProductsHelper extends Rule {
|
|
|
18
18
|
|
|
19
19
|
visitor() {
|
|
20
20
|
return {
|
|
21
|
-
MustacheStatement: this.
|
|
21
|
+
MustacheStatement: this._checkForHelperName.bind(this)
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
};
|
|
@@ -12,7 +12,7 @@ const checkKoenigCssClasses = function checkKoenigCssClasses(theme, options) {
|
|
|
12
12
|
|
|
13
13
|
// Following the introduction of card assets, we disable certain rules
|
|
14
14
|
// when it's enabled by the theme.
|
|
15
|
-
const packageJson = getPackageJSON(theme);
|
|
15
|
+
const packageJson = getPackageJSON(theme, ruleSet.defaultPackageJSON);
|
|
16
16
|
const cardAssetsEnabled = packageJson
|
|
17
17
|
&& packageJson.config
|
|
18
18
|
&& packageJson.config.card_assets === true;
|