eslint-plugin-formatjs 4.4.0 → 4.5.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": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "ESLint plugin for formatjs",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -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,UAuKhB,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,UA0KhB,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -7,8 +7,8 @@ const propMatcherSchema = {
7
7
  type: 'array',
8
8
  items: {
9
9
  type: 'array',
10
- items: [{ type: 'string' }, { type: 'string' }]
11
- }
10
+ items: [{ type: 'string' }, { type: 'string' }],
11
+ },
12
12
  };
13
13
  const defaultPropIncludePattern = [
14
14
  ['*', 'aria-{label,description,details,errormessage}'],
@@ -41,7 +41,7 @@ const rule = {
41
41
  description: 'Disallow untranslated literal strings without translation.',
42
42
  category: 'Errors',
43
43
  recommended: false,
44
- url: 'https://formatjs.io/docs/tooling/linter#no-literal-string-in-jsx'
44
+ url: 'https://formatjs.io/docs/tooling/linter#no-literal-string-in-jsx',
45
45
  },
46
46
  schema: [
47
47
  {
@@ -51,16 +51,16 @@ const rule = {
51
51
  type: 'object',
52
52
  properties: {
53
53
  include: {
54
- ...propMatcherSchema
54
+ ...propMatcherSchema,
55
55
  },
56
56
  exclude: {
57
- ...propMatcherSchema
58
- }
59
- }
60
- }
61
- }
57
+ ...propMatcherSchema,
58
+ },
59
+ },
60
+ },
61
+ },
62
62
  },
63
- ]
63
+ ],
64
64
  },
65
65
  // TODO: Vue support
66
66
  create(context) {
@@ -109,7 +109,7 @@ const rule = {
109
109
  (node.quasis.length > 1 || node.quasis[0].value.raw.length > 0))) {
110
110
  context.report({
111
111
  node: node,
112
- message: 'Cannot have untranslated text in JSX'
112
+ message: 'Cannot have untranslated text in JSX',
113
113
  });
114
114
  }
115
115
  else if (node.type === 'BinaryExpression' && node.operator === '+') {
@@ -120,6 +120,10 @@ const rule = {
120
120
  checkJSXExpression(node.consequent);
121
121
  checkJSXExpression(node.alternate);
122
122
  }
123
+ else if (node.type === 'LogicalExpression') {
124
+ checkJSXExpression(node.left);
125
+ checkJSXExpression(node.right);
126
+ }
123
127
  };
124
128
  return {
125
129
  JSXElement: (node) => {
@@ -146,7 +150,7 @@ const rule = {
146
150
  node.value.value.length > 0) {
147
151
  context.report({
148
152
  node: node,
149
- message: 'Cannot have untranslated text in JSX'
153
+ message: 'Cannot have untranslated text in JSX',
150
154
  });
151
155
  }
152
156
  else if (node.value.type === 'JSXExpressionContainer' &&
@@ -161,7 +165,7 @@ const rule = {
161
165
  }
162
166
  context.report({
163
167
  node: node,
164
- message: 'Cannot have untranslated text in JSX'
168
+ message: 'Cannot have untranslated text in JSX',
165
169
  });
166
170
  },
167
171
  // Children expression container
@@ -169,8 +173,8 @@ const rule = {
169
173
  if (node.expression.type !== 'JSXEmptyExpression') {
170
174
  checkJSXExpression(node.expression);
171
175
  }
172
- }
176
+ },
173
177
  };
174
- }
178
+ },
175
179
  };
176
180
  exports.default = rule;