@shopify/theme-check-node
Advanced tools
Comparing version 1.16.1 to 1.17.0
@@ -32,5 +32,4 @@ "use strict"; | ||
.filter(isEnabledBy(configDescription)); | ||
const settings = configDescription.checkSettings; | ||
return { | ||
settings, | ||
settings: unaliasedSettings(configDescription.checkSettings, checks), | ||
checks, | ||
@@ -58,3 +57,4 @@ ignore: configDescription.ignore, | ||
const isEnabledBy = (config) => (checkDefinition) => { | ||
const checkSettings = config.checkSettings[checkDefinition.meta.code]; | ||
var _a; | ||
const checkSettings = (_a = config.checkSettings[checkDefinition.meta.code]) !== null && _a !== void 0 ? _a : aliasedSettings(config, checkDefinition); | ||
if (!checkSettings) | ||
@@ -64,2 +64,19 @@ return false; | ||
}; | ||
function aliasedSettings(config, checkDefinition) { | ||
if (!checkDefinition.meta.aliases) | ||
return undefined; | ||
const usedAlias = checkDefinition.meta.aliases.find((alias) => config.checkSettings[alias]); | ||
if (!usedAlias) | ||
return undefined; | ||
return config.checkSettings[usedAlias]; | ||
} | ||
function unaliasedSettings(settings, checks) { | ||
return Object.fromEntries(Object.entries(settings).map(([code, value]) => { | ||
return [unaliasedCode(code, checks), value]; | ||
})); | ||
} | ||
function unaliasedCode(code, checks) { | ||
const check = checks.find((check) => { var _a; return check.meta.code === code || ((_a = check.meta.aliases) === null || _a === void 0 ? void 0 : _a.find((alias) => alias === code)); }); | ||
return check === null || check === void 0 ? void 0 : check.meta.code; | ||
} | ||
async function isNodeModuleRoot(root) { | ||
@@ -66,0 +83,0 @@ // is absolute absolute root |
{ | ||
"name": "@shopify/theme-check-node", | ||
"version": "1.16.1", | ||
"version": "1.17.0", | ||
"main": "dist/index.js", | ||
@@ -28,4 +28,4 @@ "types": "dist/index.d.ts", | ||
"dependencies": { | ||
"@shopify/theme-check-common": "1.16.1", | ||
"@shopify/theme-check-docs-updater": "1.16.1", | ||
"@shopify/theme-check-common": "1.17.0", | ||
"@shopify/theme-check-docs-updater": "1.17.0", | ||
"glob": "^8.0.3", | ||
@@ -32,0 +32,0 @@ "yaml": "^2.3.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
46040
986
+ Added@shopify/theme-check-common@1.17.0(transitive)
+ Added@shopify/theme-check-docs-updater@1.17.0(transitive)
- Removed@shopify/theme-check-common@1.16.1(transitive)
- Removed@shopify/theme-check-docs-updater@1.16.1(transitive)