diff options
Diffstat (limited to 'tools/node_modules/eslint/lib/config/config-ops.js')
-rw-r--r-- | tools/node_modules/eslint/lib/config/config-ops.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/lib/config/config-ops.js b/tools/node_modules/eslint/lib/config/config-ops.js index 6c298d3647..48f38b4905 100644 --- a/tools/node_modules/eslint/lib/config/config-ops.js +++ b/tools/node_modules/eslint/lib/config/config-ops.js @@ -370,5 +370,33 @@ module.exports = { return patternList.some(pattern => minimatch(filePath, pattern, opts)) && !excludedPatternList.some(excludedPattern => minimatch(filePath, excludedPattern, opts)); + }, + + /** + * Normalizes a value for a global in a config + * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in + * a global directive comment + * @returns {("readable"|"writeable"|"off")} The value normalized as a string + */ + normalizeConfigGlobal(configuredValue) { + switch (configuredValue) { + case "off": + return "off"; + + case true: + case "true": + case "writeable": + return "writeable"; + + case null: + case false: + case "false": + case "readable": + return "readable"; + + // Fallback to minimize compatibility impact + default: + return "writeable"; + } } }; |