eslint-plugin-format-message
Advanced tools
Comparing version 4.0.0 to 4.0.1
# Changelog | ||
## 4.0.1 | ||
* **Bug Fix** | ||
* fixed compatibility with ESLint 1.10 | ||
* fixed variables declared without initializer, later called as functions causing error | ||
## 4.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -17,2 +17,3 @@ 'use strict' | ||
node.type === 'VariableDeclarator' && | ||
node.init && | ||
node.init.type === 'CallExpression' && | ||
@@ -19,0 +20,0 @@ node.init.callee.type === 'Identifier' && |
@@ -8,33 +8,40 @@ 'use strict' | ||
var settings = context.settings['format-message'] || {} | ||
if (typeof settings.generateId !== 'function') { | ||
var translations = settings.translations || (settings.translations = {}) | ||
if (typeof translations === 'string') { | ||
try { | ||
translations = settings.translations = | ||
require(pathUtil.resolve(translations)) | ||
} catch (err) { | ||
console.warn(err.message) | ||
translations = settings.translations = {} | ||
} | ||
var resolved = {} | ||
resolved.sourceLocale = settings.sourceLocale | ||
var translations = {} | ||
if (typeof settings.translations === 'string') { | ||
try { | ||
translations = require(pathUtil.resolve(settings.translations)) | ||
} catch (err) { | ||
console.warn(err.message) | ||
} | ||
Object.keys(translations).forEach(function (locale) { | ||
if (typeof translations[locale] === 'string') { | ||
} else if (typeof settings.translations === 'object') { | ||
Object.keys(settings.translations).forEach(function (locale) { | ||
var localeData = settings.translations[locale] | ||
if (typeof localeData === 'string') { | ||
try { | ||
translations[locale] = require(pathUtil.resolve(translations[locale]))[locale] | ||
localeData = require(pathUtil.resolve(localeData)) | ||
if (localeData[locale]) localeData = localeData[locale] | ||
} catch (err) { | ||
localeData = {} | ||
console.warn(err.message) | ||
translations[locale] = null | ||
} | ||
} | ||
translations[locale] = localeData | ||
}) | ||
var generateId = generate[settings.generateId] || generate.underscored_crc32 | ||
settings.generateId = function (pattern) { | ||
try { | ||
return generateId(pattern) | ||
} catch (_) { | ||
return null | ||
} | ||
} | ||
resolved.translations = translations | ||
var generateId = generate[settings.generateId] || generate.underscored_crc32 | ||
resolved.generateId = function (pattern) { | ||
try { | ||
return generateId(pattern) | ||
} catch (_) { | ||
return null | ||
} | ||
} | ||
return settings | ||
return resolved | ||
} |
{ | ||
"name": "eslint-plugin-format-message", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "format-message i18n specific rules for ESLint", | ||
@@ -5,0 +5,0 @@ "author": "Andy VanWagoner <thetalecrafter@gmail.com> (https://thetalecrafter.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
23108
445
0