Skip to content

Commit efd6594

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[eslint] Support no used for NotTranslated
Bug: none Change-Id: Ia1dec1d28bbbd63e2e192ff2d8f7556fc743ffd7 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6367218 Reviewed-by: Ergün Erdoğmuş <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]> Reviewed-by: Simon Zünd <[email protected]>
1 parent 6bd91a1 commit efd6594

File tree

6 files changed

+31
-60
lines changed

6 files changed

+31
-60
lines changed

front_end/models/issues_manager/CookieIssue.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@ const UIStrings = {
2626
*@description Label for the link for Schemeful Same-Site Issues
2727
*/
2828
howSchemefulSamesiteWorks: 'How Schemeful Same-Site Works',
29-
/**
30-
*@description Phrase used to describe the security of a context. Substitued like 'a secure context' or 'a secure origin'.
31-
*/
32-
aSecure: 'a secure', // eslint-disable-line rulesdir/l10n-no-unused-message
33-
/**
34-
* @description Phrase used to describe the security of a context. Substitued like 'an insecure context' or 'an insecure origin'.
35-
*/
36-
anInsecure: 'an insecure', // eslint-disable-line rulesdir/l10n-no-unused-message
3729
/**
3830
* @description Label for a link for SameParty Issues. 'Attribute' refers to a cookie attribute.
3931
*/

front_end/panels/ai_assistance/PatchWidget.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,22 @@ const UIStringsNotTranslate = {
4444
*@description Button text for staging changes to workspace.
4545
*/
4646
applyToWorkspace: 'Apply to workspace',
47-
/*
47+
/**
4848
*@description Button text to change the selected workspace
4949
*/
5050
change: 'Change',
51-
/*
51+
/**
5252
*@description Button text to cancel applying to workspace
5353
*/
5454
cancel: 'Cancel',
55-
/*
55+
/**
5656
*@description Button text to discard the suggested changes and not save them to file system
5757
*/
5858
discard: 'Discard',
59-
/*
59+
/**
6060
*@description Button text to save all the suggested changes to file system
6161
*/
6262
saveAll: 'Save all',
63-
/**
64-
*@description Button text while data is being loaded
65-
*/
66-
loading: 'Loading...',
6763
/**
6864
*@description Header text after the user saved the changes to the disk.
6965
*/

front_end/panels/ai_assistance/agents/NetworkAgent.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,10 @@ const UIStringsNotTranslate = {
7777
*@description Prefix text for request URL.
7878
*/
7979
requestUrl: 'Request URL',
80-
/**
81-
*@description Title text for request headers.
82-
*/
83-
requestHeaders: 'Request Headers',
8480
/**
8581
*@description Title text for request timing details.
8682
*/
8783
timing: 'Timing',
88-
/**
89-
*@description Title text for response headers.
90-
*/
91-
responseHeaders: 'Response Headers',
9284
/**
9385
*@description Prefix text for response status.
9486
*/

front_end/panels/ai_assistance/components/ChatView.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ const UIStringsNotTranslate = {
158158
*@description Aria label for the check mark icon to be read by screen reader
159159
*/
160160
completed: 'Completed',
161-
/**
162-
*@description Aria label for the loading icon to be read by screen reader
163-
*/
164-
inProgress: 'In progress',
165161
/**
166162
*@description Aria label for the cancel icon to be read by screen reader
167163
*/
@@ -170,14 +166,6 @@ const UIStringsNotTranslate = {
170166
*@description Text displayed when the chat input is disabled due to reading past conversation.
171167
*/
172168
pastConversation: 'You\'re viewing a past conversation.',
173-
/**
174-
*@description Text displayed for showing change summary view.
175-
*/
176-
changeSummary: 'Changes summary',
177-
/**
178-
*@description Button text for staging changes to workspace.
179-
*/
180-
applyToWorkspace: 'Apply to workspace',
181169
/**
182170
*@description Title for the take screenshot button.
183171
*/
@@ -202,18 +190,6 @@ const UIStringsNotTranslate = {
202190
*@description Alt text for image when it is not available.
203191
*/
204192
imageUnavailable: 'Image unavailable',
205-
/**
206-
*@description Button text to change the selected workspace
207-
*/
208-
change: 'Change',
209-
/**
210-
*@description Button text while data is being loaded
211-
*/
212-
loading: 'Loading...',
213-
/**
214-
*@description Label for the selected workspace/folder
215-
*/
216-
selectedFolder: 'Selected folder:'
217193
} as const;
218194

219195
const str_ = i18n.i18n.registerUIStrings('panels/ai_assistance/components/ChatView.ts', UIStrings);

scripts/eslint_rules/lib/l10n-helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'use strict';
66

77
function isUIStringsIdentifier(node) {
8-
return node.type === 'Identifier' && node.name === 'UIStrings';
8+
return node.type === 'Identifier' && node.name.startsWith('UIStrings');
99
}
1010

1111
function isModuleScope(context, node) {

scripts/eslint_rules/lib/l10n-no-unused-message.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const TRACE_INSIGHTS_UI_STRINGS_FILENAME_REGEX = /models\/trace\/insights\/.*\.(
1313
* Returns true iff the passed expression is of the form `UIStrings.bar`.
1414
*/
1515
function isStandardUIStringsMemberExpression(expr) {
16-
if (expr.object.type !== 'Identifier' || expr.object.name !== 'UIStrings') {
16+
if (expr.object.type !== 'Identifier' || !expr.object.name.startsWith('UIStrings')) {
1717
return false;
1818
}
1919

@@ -31,10 +31,13 @@ module.exports = {
3131
category: 'Possible Errors',
3232
},
3333
fixable: 'code',
34-
schema: [] // no options
34+
schema: [], // no options
3535
},
36-
create: function(context) {
37-
const filename = (context.filename ?? context.getFilename()).replaceAll('\\', '/');
36+
create: function (context) {
37+
const filename = (context.filename ?? context.getFilename()).replaceAll(
38+
'\\',
39+
'/',
40+
);
3841
const sourceCode = context.sourceCode ?? context.getSourceCode();
3942
const declaredUIStringsKeys = new Map();
4043
const usedUIStringsKeys = new Set();
@@ -46,7 +49,8 @@ module.exports = {
4649
// some standard formatting. Otherwise we would have to fiddle a lot
4750
// with tokens and whitespace.
4851
let lineToRemoveStart = source.getLocFromIndex(property.range[0]).line;
49-
const lineToRemoveEnd = source.getLocFromIndex(property.range[1]).line + 1;
52+
const lineToRemoveEnd =
53+
source.getLocFromIndex(property.range[1]).line + 1;
5054

5155
// Are there comments in front of the property?
5256
// Move the line we want to remove to the line of the first comment.
@@ -55,8 +59,14 @@ module.exports = {
5559
lineToRemoveStart = source.getLocFromIndex(comments[0].range[0]).line;
5660
}
5761

58-
const removeStart = source.getIndexFromLoc({line: lineToRemoveStart, column: 0});
59-
const removeEnd = source.getIndexFromLoc({line: Math.min(lineToRemoveEnd, source.lines.length), column: 0});
62+
const removeStart = source.getIndexFromLoc({
63+
line: lineToRemoveStart,
64+
column: 0,
65+
});
66+
const removeEnd = source.getIndexFromLoc({
67+
line: Math.min(lineToRemoveEnd, source.lines.length),
68+
column: 0,
69+
});
6070
return fixer.removeRange([removeStart, removeEnd]);
6171
}
6272

@@ -70,12 +80,17 @@ module.exports = {
7080
return;
7181
}
7282

73-
if (!l10nHelper.isUIStringsVariableDeclarator(context, variableDeclarator)) {
83+
if (
84+
!l10nHelper.isUIStringsVariableDeclarator(context, variableDeclarator)
85+
) {
7486
return;
7587
}
7688

7789
for (const property of variableDeclarator.init.expression.properties) {
78-
if (property.type !== 'Property' || property.key.type !== 'Identifier') {
90+
if (
91+
property.type !== 'Property' ||
92+
property.key.type !== 'Identifier'
93+
) {
7994
continue;
8095
}
8196
declaredUIStringsKeys.set(property.key.name, property);
@@ -87,7 +102,7 @@ module.exports = {
87102
}
88103
usedUIStringsKeys.add(memberExpression.property.name);
89104
},
90-
'Program:exit': function() {
105+
'Program:exit': function () {
91106
for (const usedKey of usedUIStringsKeys) {
92107
declaredUIStringsKeys.delete(usedKey);
93108
}
@@ -101,5 +116,5 @@ module.exports = {
101116
}
102117
},
103118
};
104-
}
119+
},
105120
};

0 commit comments

Comments
 (0)