eslint-plugin-formatjs 2.18.0 → 2.19.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-formatjs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"description": "ESLint plugin for formatjs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/formatjs/formatjs#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@formatjs/icu-messageformat-parser": "2.0.
|
|
24
|
-
"@formatjs/ts-transformer": "3.
|
|
23
|
+
"@formatjs/icu-messageformat-parser": "2.0.15",
|
|
24
|
+
"@formatjs/ts-transformer": "3.7.0",
|
|
25
25
|
"@types/eslint": "^7.2.0",
|
|
26
26
|
"@typescript-eslint/typescript-estree": "^4.11.0",
|
|
27
27
|
"emoji-regex": "^9.2.0",
|
|
28
28
|
"tslib": "^2.1.0",
|
|
29
|
-
"typescript": "^4.
|
|
29
|
+
"typescript": "^4.5"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"eslint": "^7.4.0"
|
|
@@ -7,7 +7,7 @@ var BlacklistElement = /** @class */ (function (_super) {
|
|
|
7
7
|
(0, tslib_1.__extends)(BlacklistElement, _super);
|
|
8
8
|
function BlacklistElement(type) {
|
|
9
9
|
var _this = _super.call(this) || this;
|
|
10
|
-
_this.message = type
|
|
10
|
+
_this.message = "".concat(type, " element is blacklisted");
|
|
11
11
|
return _this;
|
|
12
12
|
}
|
|
13
13
|
return BlacklistElement;
|
package/rules/enforce-id.js
CHANGED
|
@@ -32,25 +32,25 @@ function checkNode(context, node) {
|
|
|
32
32
|
resourcePath: context.getFilename(),
|
|
33
33
|
}, idInterpolationPattern, {
|
|
34
34
|
content: description
|
|
35
|
-
? defaultMessage
|
|
35
|
+
? "".concat(defaultMessage, "#").concat(description)
|
|
36
36
|
: defaultMessage,
|
|
37
37
|
});
|
|
38
38
|
if (id !== correctId_1) {
|
|
39
39
|
context.report({
|
|
40
40
|
node: node,
|
|
41
|
-
message: "\"id\" does not match with hash pattern "
|
|
41
|
+
message: "\"id\" does not match with hash pattern ".concat(idInterpolationPattern, ".\nExpected: ").concat(correctId_1, "\nActual: ").concat(id),
|
|
42
42
|
fix: function (fixer) {
|
|
43
43
|
if (idPropNode) {
|
|
44
44
|
if (idPropNode.type === 'JSXAttribute') {
|
|
45
|
-
return fixer.replaceText(idPropNode, "id=\""
|
|
45
|
+
return fixer.replaceText(idPropNode, "id=\"".concat(correctId_1, "\""));
|
|
46
46
|
}
|
|
47
|
-
return fixer.replaceText(idPropNode, "id: '"
|
|
47
|
+
return fixer.replaceText(idPropNode, "id: '".concat(correctId_1, "'"));
|
|
48
48
|
}
|
|
49
49
|
// Insert after default message node
|
|
50
50
|
if (messagePropNode.type === 'JSXAttribute') {
|
|
51
|
-
return fixer.insertTextAfter(messagePropNode, " id=\""
|
|
51
|
+
return fixer.insertTextAfter(messagePropNode, " id=\"".concat(correctId_1, "\""));
|
|
52
52
|
}
|
|
53
|
-
return fixer.replaceText(messagePropNode, "defaultMessage: '"
|
|
53
|
+
return fixer.replaceText(messagePropNode, "defaultMessage: '".concat(defaultMessage, "', id: '").concat(correctId_1, "'"));
|
|
54
54
|
},
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -43,7 +43,7 @@ function verifyAst(ast, values, ignoreList) {
|
|
|
43
43
|
}
|
|
44
44
|
var key = el.value;
|
|
45
45
|
if (!ignoreList.has(key) && !keyExistsInExpression(key, values)) {
|
|
46
|
-
throw new PlaceholderEnforcement("Missing value for placeholder \""
|
|
46
|
+
throw new PlaceholderEnforcement("Missing value for placeholder \"".concat(el.value, "\""));
|
|
47
47
|
}
|
|
48
48
|
if ((0, icu_messageformat_parser_1.isPluralElement)(el) || (0, icu_messageformat_parser_1.isSelectElement)(el)) {
|
|
49
49
|
for (var _a = 0, _b = Object.keys(el.options); _a < _b.length; _a++) {
|
|
@@ -29,10 +29,10 @@ function verifyAst(plConfig, ast) {
|
|
|
29
29
|
for (var _a = 0, rules_1 = rules; _a < rules_1.length; _a++) {
|
|
30
30
|
var rule_1 = rules_1[_a];
|
|
31
31
|
if (plConfig[rule_1] && !el.options[rule_1]) {
|
|
32
|
-
throw new PluralRulesEnforcement("Missing plural rule \""
|
|
32
|
+
throw new PluralRulesEnforcement("Missing plural rule \"".concat(rule_1, "\""));
|
|
33
33
|
}
|
|
34
34
|
if (!plConfig[rule_1] && el.options[rule_1]) {
|
|
35
|
-
throw new PluralRulesEnforcement("Plural rule \""
|
|
35
|
+
throw new PluralRulesEnforcement("Plural rule \"".concat(rule_1, "\" is forbidden"));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
var options = el.options;
|
|
@@ -33,7 +33,7 @@ function checkNode(context, node) {
|
|
|
33
33
|
if (complexity > config.limit) {
|
|
34
34
|
context.report({
|
|
35
35
|
node: messageNode,
|
|
36
|
-
message: "Message complexity is too high ("
|
|
36
|
+
message: "Message complexity is too high (".concat(complexity, " vs limit at ").concat(config.limit, ")"),
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|