gscan 4.8.1 → 4.9.3

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.
@@ -50,6 +50,7 @@ const canaryPackageJSONValidationRules = _.extend({},
50
50
  {missingCustomThemeSettingsSelectDefault: 'GS010-PJ-CUST-THEME-SETTINGS-SELECT-DEFAULT'},
51
51
  {invalidCustomThemeSetingBooleanDefault: 'GS010-PJ-CUST-THEME-SETTINGS-BOOLEAN-DEFAULT'},
52
52
  {invalidCustomThemeSetingColorDefault: 'GS010-PJ-CUST-THEME-SETTINGS-COLOR-DEFAULT'},
53
+ {invalidCustomThemeSetingImageDefault: 'GS010-PJ-CUST-THEME-SETTINGS-IMAGE-DEFAULT'},
53
54
  canaryPackageJSONConditionalRules
54
55
  );
55
56
 
@@ -173,6 +174,11 @@ _private.validatePackageJSONFields = function validatePackageJSONFields(packageJ
173
174
  markFailed('invalidCustomThemeSetingColorDefault');
174
175
  }
175
176
  break;
177
+ case 'image':
178
+ if (entry.default) {
179
+ markFailed('invalidCustomThemeSetingImageDefault');
180
+ }
181
+ break;
176
182
  default:
177
183
  //do nothing here
178
184
  }
@@ -4,6 +4,12 @@ const {versions, normalizePath} = require('../utils');
4
4
  const ASTLinter = require('../ast-linter');
5
5
 
6
6
  function processFileFunction(files, failures, rules) {
7
+ // This rule is needed to find partials
8
+ // Partials are needed for a full parsing
9
+ if (!rules['mark-used-partials']) {
10
+ rules['mark-used-partials'] = require(`../ast-linter/rules/mark-used-partials`);
11
+ }
12
+
7
13
  return function processFile(linter, themeFile) {
8
14
  if (themeFile.parsed.error) {
9
15
  // Ignore parsing errors, they are handled in 005
@@ -74,6 +74,12 @@ function applyRule(rule, theme) {
74
74
  function parseWithAST({theme, log, file, rules, callback}){
75
75
  const linter = new ASTLinter();
76
76
 
77
+ // This rule is needed to find partials
78
+ // Partials are needed for a full parsing
79
+ if (!rules['mark-used-partials']) {
80
+ rules['mark-used-partials'] = require(`../ast-linter/rules/mark-used-partials`);
81
+ }
82
+
77
83
  function processFile(themeFile) {
78
84
  if (themeFile.parsed.error) {
79
85
  // Ignore parsing errors, they are handled in 005
package/lib/read-theme.js CHANGED
@@ -103,10 +103,10 @@ const readFiles = function readFiles(theme, options = {}) {
103
103
  theme.customSettings = {};
104
104
  }
105
105
 
106
- const packageJsonMatch = themeFile.file.match(/^package\.json/);
106
+ const packageJsonMatch = themeFile.file === 'package.json';
107
107
  if (packageJsonMatch) {
108
108
  const packageJson = JSON.parse(themeFile.content);
109
- if (packageJson.config.custom) {
109
+ if (packageJson.config && packageJson.config.custom) {
110
110
  theme.customSettings = packageJson.config.custom;
111
111
  }
112
112
  }
@@ -84,6 +84,12 @@ let rules = {
84
84
  details: oneLineTrim`Please make sure the <code>"default"</code> property is either <code>null</code>, an empty string <code>''</code> or a valid 6-hexadecimal-digit color code like <code>#15171a</code>.<br>
85
85
  Check the <a href="${docsBaseUrl}packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.`
86
86
  },
87
+ 'GS010-PJ-CUST-THEME-SETTINGS-IMAGE-DEFAULT': {
88
+ level: 'error',
89
+ rule: '<code>package.json</code> objects defined in <code>"config.custom"</code> of type <code>"image"</code> can\'t have a <code>"default"</code> value.',
90
+ details: oneLineTrim`Make sure the <code>"default"</code> property is either <code>null</code>, an empty string <code>''</code> or isn't present.<br>
91
+ Check the <a href="${docsBaseUrl}packagejson/" target=_blank><code>package.json</code> documentation</a> for further information.`
92
+ },
87
93
  'GS001-DEPR-LABS-MEMBERS': {
88
94
  level: 'warning',
89
95
  rule: 'The <code>{{@labs.members}}</code> helper should not be used.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gscan",
3
- "version": "4.8.1",
3
+ "version": "4.9.3",
4
4
  "description": "Scans Ghost themes looking for errors, deprecations, features and compatibility",
5
5
  "keywords": [
6
6
  "ghost",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@sentry/node": "6.13.3",
44
- "@tryghost/pretty-cli": "1.2.21",
45
- "@tryghost/zip": "1.1.17",
44
+ "@tryghost/pretty-cli": "1.2.22",
45
+ "@tryghost/zip": "1.1.18",
46
46
  "bluebird": "3.7.2",
47
47
  "chalk": "4.1.2",
48
48
  "common-tags": "1.8.0",