eslint-plugin-formatjs 4.3.2 → 4.3.4

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": "4.3.2",
3
+ "version": "4.3.4",
4
4
  "description": "ESLint plugin for formatjs",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "homepage": "https://github.com/formatjs/formatjs#readme",
22
22
  "dependencies": {
23
- "@formatjs/icu-messageformat-parser": "2.1.8",
24
- "@formatjs/ts-transformer": "3.10.1",
23
+ "@formatjs/icu-messageformat-parser": "2.1.10",
24
+ "@formatjs/ts-transformer": "3.11.1",
25
25
  "@types/eslint": "7 || 8",
26
26
  "@types/picomatch": "^2.3.0",
27
27
  "@typescript-eslint/typescript-estree": "^5.9.1",
@@ -1 +1 @@
1
- {"version":3,"file":"no-literal-string-in-jsx.d.ts","sourceRoot":"","sources":["no-literal-string-in-jsx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAqDhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UA4JhB,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"no-literal-string-in-jsx.d.ts","sourceRoot":"","sources":["no-literal-string-in-jsx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAqDhC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UAoKhB,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -101,8 +101,12 @@ const rule = {
101
101
  };
102
102
  const checkJSXExpression = (node) => {
103
103
  // Check if this is either a string literal / template literal, or the concat of them.
104
- if ((node.type === 'Literal' && typeof node.value === 'string') ||
105
- node.type === 'TemplateLiteral') {
104
+ // It also ignores the empty string.
105
+ if ((node.type === 'Literal' &&
106
+ typeof node.value === 'string' &&
107
+ node.value.length > 0) ||
108
+ (node.type === 'TemplateLiteral' &&
109
+ (node.quasis.length > 1 || node.quasis[0].value.raw.length > 0))) {
106
110
  context.report({
107
111
  node: node,
108
112
  message: 'Cannot have untranslated text in JSX',
@@ -133,7 +137,9 @@ const rule = {
133
137
  if (!node.value) {
134
138
  return;
135
139
  }
136
- if (node.value.type === 'Literal') {
140
+ if (node.value.type === 'Literal' &&
141
+ typeof node.value.value === 'string' &&
142
+ node.value.value.length > 0) {
137
143
  context.report({
138
144
  node: node,
139
145
  message: 'Cannot have untranslated text in JSX',