@jupyter/eslint-plugin 1.2.0 → 1.4.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/lib/index.d.ts +27 -1
- package/lib/index.js +21 -3
- package/lib/rules/command-id-convention.d.ts +5 -0
- package/lib/rules/command-id-convention.js +87 -0
- package/lib/rules/galata-prefer-context-menu-helper.d.ts +6 -0
- package/lib/rules/galata-prefer-context-menu-helper.js +394 -0
- package/lib/rules/galata-prefer-menu-helper.js +18 -102
- package/lib/rules/no-untranslated-string.d.ts +2 -1
- package/lib/rules/no-untranslated-string.js +191 -113
- package/lib/rules/plugin-activation-args.d.ts +3 -3
- package/lib/rules/plugin-activation-args.js +173 -142
- package/lib/rules/plugin-description.js +12 -9
- package/lib/rules/plugin-id-convention.d.ts +6 -0
- package/lib/rules/plugin-id-convention.js +199 -0
- package/lib/rules/prefer-lazy-imports.d.ts +2 -2
- package/lib/rules/prefer-lazy-imports.js +257 -58
- package/lib/rules/prefer-signal-this-arg.d.ts +2 -3
- package/lib/rules/prefer-signal-this-arg.js +2 -10
- package/lib/rules/require-disposable-ownership.d.ts +1 -2
- package/lib/rules/require-disposable-ownership.js +3 -26
- package/lib/rules/require-disposable-transfer.d.ts +1 -2
- package/lib/rules/require-disposable-transfer.js +14 -14
- package/lib/rules/require-signal-cleanup.d.ts +2 -3
- package/lib/rules/require-signal-cleanup.js +2 -10
- package/lib/rules/require-signal-this-arg.d.ts +1 -2
- package/lib/rules/require-signal-this-arg.js +2 -10
- package/lib/utils/ast.d.ts +12 -0
- package/lib/utils/ast.js +49 -0
- package/lib/utils/commands.d.ts +17 -0
- package/lib/utils/commands.js +205 -0
- package/lib/utils/disposables.d.ts +12 -0
- package/lib/utils/disposables.js +101 -10
- package/lib/utils/lazy-imports.d.ts +27 -3
- package/lib/utils/lazy-imports.js +130 -36
- package/lib/utils/module-size.d.ts +7 -1
- package/lib/utils/module-size.js +10 -1
- package/lib/utils/package-json.d.ts +8 -0
- package/lib/utils/package-json.js +76 -0
- package/lib/utils/playwright-selectors.d.ts +15 -0
- package/lib/utils/playwright-selectors.js +80 -0
- package/lib/utils/plugin-utils.d.ts +66 -6
- package/lib/utils/plugin-utils.js +485 -59
- package/lib/utils/shared-packages.js +6 -16
- package/lib/utils/signals.d.ts +2 -8
- package/lib/utils/signals.js +7 -42
- package/lib/utils/type-services.d.ts +13 -0
- package/lib/utils/type-services.js +27 -0
- package/package.json +1 -1
|
@@ -5,30 +5,64 @@
|
|
|
5
5
|
*/
|
|
6
6
|
const commands_1 = require("../utils/commands");
|
|
7
7
|
const plugin_utils_1 = require("../utils/plugin-utils");
|
|
8
|
+
const translation_1 = require("../utils/translation");
|
|
8
9
|
const create_rule_1 = require("../utils/create-rule");
|
|
9
10
|
function hasLetters(str) {
|
|
10
11
|
return /\p{L}/u.test(str);
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Returns every raw string a value expression can evaluate to, empty when it
|
|
15
|
+
* can evaluate to none.
|
|
16
|
+
*
|
|
17
|
+
* A conditional has more than one result, and each one reaches the user on its
|
|
18
|
+
* own: `visible ? 'Hide' : 'Show'` displays either branch, `label ?? 'Untitled'`
|
|
19
|
+
* displays either operand. Collecting them all means a half-translated
|
|
20
|
+
* conditional reports only the branch that is still raw.
|
|
21
|
+
*/
|
|
22
|
+
function getRawStrings(node) {
|
|
23
|
+
const inner = (0, translation_1.unwrapExpression)(node);
|
|
24
|
+
switch (inner.type) {
|
|
25
|
+
case 'Literal':
|
|
26
|
+
return typeof inner.value === 'string'
|
|
27
|
+
? [{ node: inner, value: inner.value }]
|
|
28
|
+
: [];
|
|
29
|
+
case 'TemplateLiteral':
|
|
30
|
+
return inner.expressions.length === 0
|
|
31
|
+
? [
|
|
32
|
+
{
|
|
33
|
+
node: inner,
|
|
34
|
+
value: inner.quasis.map(q => q.value.cooked ?? '').join('')
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
: [];
|
|
38
|
+
case 'ArrowFunctionExpression':
|
|
39
|
+
return inner.body.type === 'BlockStatement'
|
|
40
|
+
? []
|
|
41
|
+
: getRawStrings(inner.body);
|
|
42
|
+
case 'ConditionalExpression':
|
|
43
|
+
return [
|
|
44
|
+
...getRawStrings(inner.consequent),
|
|
45
|
+
...getRawStrings(inner.alternate)
|
|
46
|
+
];
|
|
47
|
+
case 'LogicalExpression':
|
|
48
|
+
// `a && 'text'` evaluates to the left operand only when that operand is
|
|
49
|
+
// falsy, and the only falsy string is blank, which this rule never
|
|
50
|
+
// reports. `a || 'text'` and `a ?? 'text'` evaluate to either operand.
|
|
51
|
+
return [
|
|
52
|
+
...(inner.operator === '&&' ? [] : getRawStrings(inner.left)),
|
|
53
|
+
...getRawStrings(inner.right)
|
|
54
|
+
];
|
|
55
|
+
default:
|
|
56
|
+
return [];
|
|
22
57
|
}
|
|
23
|
-
return null;
|
|
24
58
|
}
|
|
25
59
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
60
|
+
* Folds the hyphenated and camelCase spellings of a name together so that a
|
|
61
|
+
* single configured entry covers both, e.g. the `aria-label` attribute and the
|
|
62
|
+
* `ariaLabel` DOM property.
|
|
28
63
|
*/
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
return rawValue !== null && rawValue.trim().length > 0;
|
|
64
|
+
function normalizeName(name) {
|
|
65
|
+
return name.replace(/-/g, '').toLowerCase();
|
|
32
66
|
}
|
|
33
67
|
function isSetAttributeCall(node) {
|
|
34
68
|
return (node.callee.type === 'MemberExpression' &&
|
|
@@ -54,12 +88,43 @@ function isDialogButtonCall(node) {
|
|
|
54
88
|
node.callee.property.type === 'Identifier' &&
|
|
55
89
|
DIALOG_BUTTON_BUILDERS.includes(node.callee.property.name));
|
|
56
90
|
}
|
|
91
|
+
// Properties checked only on the call they belong to, because the name alone
|
|
92
|
+
// does not imply user-facing text anywhere else.
|
|
57
93
|
const MONITORED_COMMAND_PROPS = ['label', 'caption', 'usage'];
|
|
58
|
-
const MONITORED_A11Y_ATTRS = ['aria-label', 'aria-description', 'title'];
|
|
59
|
-
const MONITORED_SET_ATTRIBUTE_ATTRS = MONITORED_A11Y_ATTRS;
|
|
60
|
-
const MONITORED_ASSIGNMENT_PROPS = ['title', 'ariaLabel'];
|
|
61
94
|
const MONITORED_DIALOG_PROPS = ['title', 'body'];
|
|
62
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Names checked in every generic position: object literal properties, JSX
|
|
97
|
+
* attributes, `setAttribute()` attribute names and assignment targets.
|
|
98
|
+
*/
|
|
99
|
+
const DEFAULT_CHECK_PROPERTIES = [
|
|
100
|
+
'alt',
|
|
101
|
+
'aria-description',
|
|
102
|
+
'aria-label',
|
|
103
|
+
'caption',
|
|
104
|
+
'category',
|
|
105
|
+
'label',
|
|
106
|
+
'placeholder',
|
|
107
|
+
'title',
|
|
108
|
+
'tooltip',
|
|
109
|
+
'textContent',
|
|
110
|
+
'innerText'
|
|
111
|
+
];
|
|
112
|
+
/**
|
|
113
|
+
* Returns the static name of a non-computed object property key, or null when
|
|
114
|
+
* the key is computed or not a plain identifier/string.
|
|
115
|
+
*/
|
|
116
|
+
function getPropertyKeyName(node) {
|
|
117
|
+
if (node.computed) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
if (node.key.type === 'Identifier') {
|
|
121
|
+
return node.key.name;
|
|
122
|
+
}
|
|
123
|
+
if (node.key.type === 'Literal' && typeof node.key.value === 'string') {
|
|
124
|
+
return node.key.value;
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
63
128
|
const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
64
129
|
name: 'no-untranslated-string',
|
|
65
130
|
meta: {
|
|
@@ -72,25 +137,85 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
72
137
|
untranslatedCommandProp: 'Command property "{{ prop }}" has an untranslated string literal. Wrap it with trans.__().',
|
|
73
138
|
untranslatedSetAttribute: 'setAttribute("{{ attr }}", ...) has an untranslated string literal. Wrap the value with trans.__().',
|
|
74
139
|
untranslatedPropertyAssign: 'Assignment to "{{ prop }}" has an untranslated string literal. Wrap it with trans.__().',
|
|
75
|
-
untranslatedTitleProp: 'Assignment to "title.{{ prop }}" has an untranslated string literal. Wrap it with trans.__().',
|
|
76
140
|
untranslatedDialogOption: 'Dialog/showDialog "{{ prop }}" option has an untranslated string literal. Wrap it with trans.__().',
|
|
77
141
|
untranslatedDialogButtonLabel: 'Dialog button "label" option has an untranslated string literal. Wrap it with trans.__().',
|
|
78
|
-
untranslatedJsxText: 'JSX text content has an untranslated string literal. Wrap it with {trans.__(...)}'
|
|
142
|
+
untranslatedJsxText: 'JSX text content has an untranslated string literal. Wrap it with {trans.__(...)}',
|
|
143
|
+
untranslatedJsxAttribute: 'JSX attribute "{{ prop }}" has an untranslated string literal. Wrap it with {trans.__(...)}',
|
|
144
|
+
untranslatedProperty: 'Property "{{ prop }}" has an untranslated string literal. Wrap it with trans.__().'
|
|
79
145
|
},
|
|
80
146
|
schema: [
|
|
81
147
|
{
|
|
82
148
|
type: 'object',
|
|
83
149
|
properties: {
|
|
84
|
-
enforcePunctuation: { type: 'boolean' }
|
|
150
|
+
enforcePunctuation: { type: 'boolean' },
|
|
151
|
+
checkProperties: {
|
|
152
|
+
type: 'array',
|
|
153
|
+
items: { type: 'string' },
|
|
154
|
+
uniqueItems: true
|
|
155
|
+
}
|
|
85
156
|
},
|
|
86
157
|
additionalProperties: false
|
|
87
158
|
}
|
|
88
159
|
]
|
|
89
160
|
},
|
|
90
|
-
defaultOptions: [
|
|
161
|
+
defaultOptions: [
|
|
162
|
+
{
|
|
163
|
+
enforcePunctuation: false,
|
|
164
|
+
checkProperties: DEFAULT_CHECK_PROPERTIES
|
|
165
|
+
}
|
|
166
|
+
],
|
|
91
167
|
create(context) {
|
|
92
|
-
const
|
|
93
|
-
|
|
168
|
+
const options = context.options[0];
|
|
169
|
+
const enforcePunctuation = options?.enforcePunctuation ?? false;
|
|
170
|
+
const checkProperties = new Set((options?.checkProperties ?? DEFAULT_CHECK_PROPERTIES).map(normalizeName));
|
|
171
|
+
function isMonitoredName(name) {
|
|
172
|
+
return checkProperties.has(normalizeName(name));
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Returns true if the text should be wrapped in a translation call.
|
|
176
|
+
*
|
|
177
|
+
* Blank strings are never reported. A string with no letters is read as a
|
|
178
|
+
* bare number when it has digits ('1970', '100%'), which this rule never
|
|
179
|
+
* reports, and as punctuation otherwise ('/', '-'), which it reports only
|
|
180
|
+
* when `enforcePunctuation` is on.
|
|
181
|
+
*/
|
|
182
|
+
function isReportableText(value) {
|
|
183
|
+
if (value.trim().length === 0) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
// No letters: a bare number is never reported, punctuation only on request.
|
|
187
|
+
return hasLetters(value) || (enforcePunctuation && !/\p{N}/u.test(value));
|
|
188
|
+
}
|
|
189
|
+
// Literals already reported by a more specific branch (e.g. addCommand or
|
|
190
|
+
// a Dialog button builder), so the generic checks do not duplicate them.
|
|
191
|
+
// Enclosing calls are visited before the properties they contain, so the
|
|
192
|
+
// specific branch always runs first.
|
|
193
|
+
const reportedNodes = new Set();
|
|
194
|
+
function report(node, messageId, data) {
|
|
195
|
+
reportedNodes.add(node);
|
|
196
|
+
context.report({ node, messageId, data });
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Reports every string literal behind `value` that has not been reported
|
|
200
|
+
* already.
|
|
201
|
+
*/
|
|
202
|
+
function reportRawString(value, messageId, data) {
|
|
203
|
+
for (const raw of getRawStrings(value)) {
|
|
204
|
+
if (reportedNodes.has(raw.node) || !isReportableText(raw.value)) {
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
report(raw.node, messageId, data);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Reports a monitored JSX attribute whose value is a raw string.
|
|
212
|
+
*/
|
|
213
|
+
function checkJsxAttributeValue(attrName, value) {
|
|
214
|
+
if (!attrName || !isMonitoredName(attrName)) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
reportRawString(value, 'untranslatedJsxAttribute', { prop: attrName });
|
|
218
|
+
}
|
|
94
219
|
return {
|
|
95
220
|
CallExpression(node) {
|
|
96
221
|
// Branch A: commands.addCommand(id, { label, caption, usage })
|
|
@@ -105,17 +230,15 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
105
230
|
const properties = (0, plugin_utils_1.getObjectProperties)(optionsArg);
|
|
106
231
|
for (const propName of MONITORED_COMMAND_PROPS) {
|
|
107
232
|
const prop = properties.get(propName);
|
|
108
|
-
if (prop
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
messageId: 'untranslatedCommandProp',
|
|
112
|
-
data: { prop: propName }
|
|
233
|
+
if (prop) {
|
|
234
|
+
reportRawString(prop.value, 'untranslatedCommandProp', {
|
|
235
|
+
prop: propName
|
|
113
236
|
});
|
|
114
237
|
}
|
|
115
238
|
}
|
|
116
239
|
return;
|
|
117
240
|
}
|
|
118
|
-
// Branch B: element.setAttribute('aria-label'
|
|
241
|
+
// Branch B: element.setAttribute('aria-label', string)
|
|
119
242
|
if (isSetAttributeCall(node)) {
|
|
120
243
|
if (node.arguments.length < 2) {
|
|
121
244
|
return;
|
|
@@ -123,17 +246,12 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
123
246
|
const attrNameArg = node.arguments[0];
|
|
124
247
|
if (attrNameArg.type !== 'Literal' ||
|
|
125
248
|
typeof attrNameArg.value !== 'string' ||
|
|
126
|
-
!
|
|
249
|
+
!isMonitoredName(attrNameArg.value)) {
|
|
127
250
|
return;
|
|
128
251
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
node: attrValueArg,
|
|
133
|
-
messageId: 'untranslatedSetAttribute',
|
|
134
|
-
data: { attr: attrNameArg.value }
|
|
135
|
-
});
|
|
136
|
-
}
|
|
252
|
+
reportRawString(node.arguments[1], 'untranslatedSetAttribute', {
|
|
253
|
+
attr: attrNameArg.value
|
|
254
|
+
});
|
|
137
255
|
return;
|
|
138
256
|
}
|
|
139
257
|
// Branch C: showDialog({ title, body })
|
|
@@ -148,11 +266,9 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
148
266
|
const properties = (0, plugin_utils_1.getObjectProperties)(optionsArg);
|
|
149
267
|
for (const propName of MONITORED_DIALOG_PROPS) {
|
|
150
268
|
const prop = properties.get(propName);
|
|
151
|
-
if (prop
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
messageId: 'untranslatedDialogOption',
|
|
155
|
-
data: { prop: propName }
|
|
269
|
+
if (prop) {
|
|
270
|
+
reportRawString(prop.value, 'untranslatedDialogOption', {
|
|
271
|
+
prop: propName
|
|
156
272
|
});
|
|
157
273
|
}
|
|
158
274
|
}
|
|
@@ -169,11 +285,8 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
169
285
|
}
|
|
170
286
|
const properties = (0, plugin_utils_1.getObjectProperties)(optionsArg);
|
|
171
287
|
const labelProp = properties.get('label');
|
|
172
|
-
if (labelProp
|
|
173
|
-
|
|
174
|
-
node: labelProp.value,
|
|
175
|
-
messageId: 'untranslatedDialogButtonLabel'
|
|
176
|
-
});
|
|
288
|
+
if (labelProp) {
|
|
289
|
+
reportRawString(labelProp.value, 'untranslatedDialogButtonLabel');
|
|
177
290
|
}
|
|
178
291
|
}
|
|
179
292
|
},
|
|
@@ -192,15 +305,16 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
192
305
|
const properties = (0, plugin_utils_1.getObjectProperties)(optionsArg);
|
|
193
306
|
for (const propName of MONITORED_DIALOG_PROPS) {
|
|
194
307
|
const prop = properties.get(propName);
|
|
195
|
-
if (prop
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
messageId: 'untranslatedDialogOption',
|
|
199
|
-
data: { prop: propName }
|
|
308
|
+
if (prop) {
|
|
309
|
+
reportRawString(prop.value, 'untranslatedDialogOption', {
|
|
310
|
+
prop: propName
|
|
200
311
|
});
|
|
201
312
|
}
|
|
202
313
|
}
|
|
203
314
|
},
|
|
315
|
+
// Any monitored assignment target: element.title = STRING,
|
|
316
|
+
// widget.label = STRING, this.label = STRING, node.textContent = STRING,
|
|
317
|
+
// and Lumino widget titles such as this.title.label = STRING
|
|
204
318
|
AssignmentExpression(node) {
|
|
205
319
|
if (node.operator !== '=') {
|
|
206
320
|
return;
|
|
@@ -208,58 +322,39 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
208
322
|
const left = node.left;
|
|
209
323
|
if (left.type !== 'MemberExpression' ||
|
|
210
324
|
left.computed ||
|
|
211
|
-
left.property.type !== 'Identifier'
|
|
325
|
+
left.property.type !== 'Identifier' ||
|
|
326
|
+
!isMonitoredName(left.property.name)) {
|
|
212
327
|
return;
|
|
213
328
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
329
|
+
reportRawString(node.right, 'untranslatedPropertyAssign', {
|
|
330
|
+
prop: left.property.name
|
|
331
|
+
});
|
|
332
|
+
},
|
|
333
|
+
// Any monitored object property: { label: 'raw string' }.
|
|
334
|
+
// Runs after the call-specific branches above, which mark the literals
|
|
335
|
+
// they already reported so a property is never reported twice.
|
|
336
|
+
Property(node) {
|
|
337
|
+
if (node.shorthand) {
|
|
222
338
|
return;
|
|
223
339
|
}
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
|
|
227
|
-
left.object.type === 'MemberExpression' &&
|
|
228
|
-
!left.object.computed &&
|
|
229
|
-
left.object.property.type === 'Identifier' &&
|
|
230
|
-
left.object.property.name === 'title' &&
|
|
231
|
-
isRawStringNode(node.right)) {
|
|
232
|
-
context.report({
|
|
233
|
-
node: node.right,
|
|
234
|
-
messageId: 'untranslatedTitleProp',
|
|
235
|
-
data: { prop: left.property.name }
|
|
236
|
-
});
|
|
340
|
+
const keyName = getPropertyKeyName(node);
|
|
341
|
+
if (!keyName || !isMonitoredName(keyName)) {
|
|
342
|
+
return;
|
|
237
343
|
}
|
|
344
|
+
reportRawString(node.value, 'untranslatedProperty', { prop: keyName });
|
|
238
345
|
},
|
|
239
|
-
//
|
|
346
|
+
// Monitored attribute with a plain string: <span aria-label="text" />
|
|
240
347
|
JSXAttribute(node) {
|
|
241
348
|
if (!node.value || node.value.type === 'JSXExpressionContainer') {
|
|
242
349
|
return;
|
|
243
350
|
}
|
|
244
351
|
const attrName = node.name.type === 'JSXIdentifier' ? node.name.name : null;
|
|
245
|
-
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
if (isRawStringNode(node.value)) {
|
|
249
|
-
context.report({
|
|
250
|
-
node: node.value,
|
|
251
|
-
messageId: 'untranslatedJsxText'
|
|
252
|
-
});
|
|
253
|
-
}
|
|
352
|
+
checkJsxAttributeValue(attrName, node.value);
|
|
254
353
|
},
|
|
255
354
|
// Raw text between JSX tags: <span>Untranslated text</span>
|
|
256
355
|
JSXText(node) {
|
|
257
|
-
if (node.value
|
|
258
|
-
(
|
|
259
|
-
context.report({
|
|
260
|
-
node,
|
|
261
|
-
messageId: 'untranslatedJsxText'
|
|
262
|
-
});
|
|
356
|
+
if (isReportableText(node.value)) {
|
|
357
|
+
report(node, 'untranslatedJsxText');
|
|
263
358
|
}
|
|
264
359
|
},
|
|
265
360
|
// String literal inside JSX expression: <span>{'raw string'}</span>
|
|
@@ -271,27 +366,10 @@ const noUntranslatedString = (0, create_rule_1.createRule)({
|
|
|
271
366
|
const attrName = node.parent.name.type === 'JSXIdentifier'
|
|
272
367
|
? node.parent.name.name
|
|
273
368
|
: null;
|
|
274
|
-
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
if (isRawStringNode(node.expression)) {
|
|
278
|
-
context.report({
|
|
279
|
-
node: node.expression,
|
|
280
|
-
messageId: 'untranslatedJsxText'
|
|
281
|
-
});
|
|
282
|
-
}
|
|
369
|
+
checkJsxAttributeValue(attrName, node.expression);
|
|
283
370
|
return;
|
|
284
371
|
}
|
|
285
|
-
|
|
286
|
-
const value = getRawStringValue(node.expression);
|
|
287
|
-
if (value !== null &&
|
|
288
|
-
(enforcePunctuation ? value.trim().length > 0 : hasLetters(value))) {
|
|
289
|
-
context.report({
|
|
290
|
-
node: node.expression,
|
|
291
|
-
messageId: 'untranslatedJsxText'
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
}
|
|
372
|
+
reportRawString(node.expression, 'untranslatedJsxText');
|
|
295
373
|
}
|
|
296
374
|
};
|
|
297
375
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const jupyterPluginActivationArgs:
|
|
1
|
+
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
declare const jupyterPluginActivationArgs: TSESLint.RuleModule<"mismatchedOrder" | "incorrectType" | "missingArgument" | "extraArgument" | "appNotFirst" | "serviceManagerFirstArgNotNull" | "invalidAppType" | "wrongArgumentCount" | "unresolvableTokenType" | "optionalNotNullable", [{
|
|
3
3
|
allowedFirstArgumentNames: string[];
|
|
4
|
-
}], unknown,
|
|
4
|
+
}], unknown, TSESLint.RuleListener> & {
|
|
5
5
|
name: string;
|
|
6
6
|
};
|
|
7
7
|
export = jupyterPluginActivationArgs;
|