Skip to content

Commit 191dc45

Browse files
authored
1.4.0 lint (#81)
* Run lint * PascalCase CommandInfo
1 parent 46a8ec3 commit 191dc45

1 file changed

Lines changed: 94 additions & 94 deletions

File tree

src/buildozer/wizard.ts

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { InputStep, MultiStepInput } from '../multiStepInput';
22

3-
interface commandInfo {
3+
interface CommandInfo {
44
perRule: boolean;
55
minArg: number;
66
maxArg: number;
@@ -9,126 +9,126 @@ interface commandInfo {
99
example: string;
1010
}
1111

12-
const allCommands: { [key: string]: commandInfo } = {
13-
"add": {
14-
perRule: true, minArg: 2, maxArg: -1, template: "<attr> <value(s)>",
15-
description: "Adds value(s) to a list attribute of a rule. If a value is already present in the list, it is not added.",
12+
const allCommands: { [key: string]: CommandInfo } = {
13+
'add': {
14+
perRule: true, minArg: 2, maxArg: -1, template: '<attr> <value(s)>',
15+
description: 'Adds value(s) to a list attribute of a rule. If a value is already present in the list, it is not added.',
1616
example: "buildozer 'add deps //base' //pkg:rule //pkg:rule2",
1717
},
18-
"new_load": {
19-
perRule: false, minArg: 1, maxArg: -1, template: "<path> <[to=]from(s)>",
18+
'new_load': {
19+
perRule: false, minArg: 1, maxArg: -1, template: '<path> <[to=]from(s)>',
2020
description: "Add a load statement for the given path, importing the symbols. Before using this, make sure to run buildozer 'fix movePackageToTop'. Afterwards, consider running buildozer 'fix unusedLoads'.",
2121
example: "buildozer 'new_load //tools/build_rules:build_test.bzl build_test' //pkg:__pkg__",
2222
},
23-
"replace_load": {
24-
perRule: false, minArg: 1, maxArg: -1, template: "<path> <[to=]symbol(s)>",
25-
description: "Similar to new_load, but removes existing load statements for the requested symbols before adding new loads.",
23+
'replace_load': {
24+
perRule: false, minArg: 1, maxArg: -1, template: '<path> <[to=]symbol(s)>',
25+
description: 'Similar to new_load, but removes existing load statements for the requested symbols before adding new loads.',
2626
example: "buildozer 'replace_load @rules_build//build:defs.bzl build_test' //pkg:__pkg__",
2727
},
28-
"substitute_load": {
29-
perRule: false, minArg: 2, maxArg: 2, template: "<old_regexp> <new_template>",
30-
description: "Replaces modules of loads which match old_regexp according to new_template. The regular expression must follow RE2 syntax. new_template may be a simple replacement string, but it may also expand numbered or named groups using $0 or $x.",
28+
'substitute_load': {
29+
perRule: false, minArg: 2, maxArg: 2, template: '<old_regexp> <new_template>',
30+
description: 'Replaces modules of loads which match old_regexp according to new_template. The regular expression must follow RE2 syntax. new_template may be a simple replacement string, but it may also expand numbered or named groups using $0 or $x.',
3131
example: "buildozer 'substitute_load ^@([^/]*)//([^:].*)$ //third_party/build_defs/${1}/${2}' //pkg:__pkg__",
3232
},
33-
"comment": {
34-
perRule: true, minArg: 1, maxArg: 3, template: "<attr>? <value>? <comment>",
35-
description: "Add a comment to a rule, an attribute, or a specific value in a list. Spaces in the comment should be escaped with backslashes.",
36-
example: "",
33+
'comment': {
34+
perRule: true, minArg: 1, maxArg: 3, template: '<attr>? <value>? <comment>',
35+
description: 'Add a comment to a rule, an attribute, or a specific value in a list. Spaces in the comment should be escaped with backslashes.',
36+
example: '',
3737
},
38-
"print_comment": {
39-
perRule: true, minArg: 0, maxArg: 2, template: "<attr>? <value>?",
40-
description: "",
41-
example: "",
38+
'print_comment': {
39+
perRule: true, minArg: 0, maxArg: 2, template: '<attr>? <value>?',
40+
description: '',
41+
example: '',
4242
},
43-
"delete": {
44-
perRule: true, minArg: 0, maxArg: 0, template: "",
45-
description: "Delete a rule.",
46-
example: "",
43+
'delete': {
44+
perRule: true, minArg: 0, maxArg: 0, template: '',
45+
description: 'Delete a rule.',
46+
example: '',
4747
},
48-
"fix": {
49-
perRule: true, minArg: 0, maxArg: -1, template: "<fix(es)>?",
50-
description: "Apply a fix.",
51-
example: "",
48+
'fix': {
49+
perRule: true, minArg: 0, maxArg: -1, template: '<fix(es)>?',
50+
description: 'Apply a fix.',
51+
example: '',
5252
},
53-
"move": {
54-
perRule: true, minArg: 3, maxArg: -1, template: "<old_attr> <new_attr> <value(s)>",
55-
description: "Moves value(s) from the list old_attr to the list new_attr. The wildcard * matches all values.",
56-
example: "",
53+
'move': {
54+
perRule: true, minArg: 3, maxArg: -1, template: '<old_attr> <new_attr> <value(s)>',
55+
description: 'Moves value(s) from the list old_attr to the list new_attr. The wildcard * matches all values.',
56+
example: '',
5757
},
58-
"new": {
59-
perRule: false, minArg: 2, maxArg: 4, template: "<rule_kind> <rule_name> [(before|after) <relative_rule_name>]",
60-
description: "Add a new rule at the end of the BUILD file (before/after <relative_rule>). The identifier __pkg__ can be used to position rules relative to package().",
58+
'new': {
59+
perRule: false, minArg: 2, maxArg: 4, template: '<rule_kind> <rule_name> [(before|after) <relative_rule_name>]',
60+
description: 'Add a new rule at the end of the BUILD file (before/after <relative_rule>). The identifier __pkg__ can be used to position rules relative to package().',
6161
example: "buildozer 'new java_library foo' //pkg:__pkg__",
6262
},
63-
"print": {
64-
perRule: true, minArg: 0, maxArg: -1, template: "<attribute(s)>",
65-
description: "",
63+
'print': {
64+
perRule: true, minArg: 0, maxArg: -1, template: '<attribute(s)>',
65+
description: '',
6666
example: "buildozer -types go_library,go_binary 'print rule' '//buildtools/buildozer:*'",
6767
},
68-
"remove": {
69-
perRule: true, minArg: 1, maxArg: -1, template: "<attr> <value(s)>",
70-
description: "Without arguments, removes attribute attr. Removes value(s) from the list attr. The wildcard * matches all attributes. Lists containing none of the value(s) are not modified",
68+
'remove': {
69+
perRule: true, minArg: 1, maxArg: -1, template: '<attr> <value(s)>',
70+
description: 'Without arguments, removes attribute attr. Removes value(s) from the list attr. The wildcard * matches all attributes. Lists containing none of the value(s) are not modified',
7171
example: "buildozer 'remove deps foo' //pkg:%cc_library",
7272
},
73-
"remove_comment": {
74-
perRule: true, minArg: 0, maxArg: 2, template: "<attr>? <value>?",
75-
description: "remove_comment <attr>? <value>?: Removes the comment attached to the rule, an attribute, or a specific value in a list.",
76-
example: "",
73+
'remove_comment': {
74+
perRule: true, minArg: 0, maxArg: 2, template: '<attr>? <value>?',
75+
description: 'remove_comment <attr>? <value>?: Removes the comment attached to the rule, an attribute, or a specific value in a list.',
76+
example: '',
7777
},
78-
"rename": {
79-
perRule: true, minArg: 2, maxArg: 2, template: "<old_attr> <new_attr>",
80-
description: "Rename the old_attr to new_attr which must not yet exist.",
81-
example: "",
78+
'rename': {
79+
perRule: true, minArg: 2, maxArg: 2, template: '<old_attr> <new_attr>',
80+
description: 'Rename the old_attr to new_attr which must not yet exist.',
81+
example: '',
8282
},
83-
"replace": {
84-
perRule: true, minArg: 3, maxArg: 3, template: "<attr> <old_value> <new_value>",
85-
description: "Replaces old_value with new_value in the list attr. Wildcard * matches all attributes. Lists not containing old_value are not modified.",
86-
example: "",
83+
'replace': {
84+
perRule: true, minArg: 3, maxArg: 3, template: '<attr> <old_value> <new_value>',
85+
description: 'Replaces old_value with new_value in the list attr. Wildcard * matches all attributes. Lists not containing old_value are not modified.',
86+
example: '',
8787
},
88-
"substitute": {
89-
perRule: true, minArg: 3, maxArg: 3, template: "<attr> <old_regexp> <new_template>",
90-
description: "Replaces strings which match old_regexp in the list attr according to new_template. Wildcard * matches all attributes. The regular expression must follow RE2 syntax. new_template may be a simple replacement string, but it may also expand numbered or named groups using $0 or $x. Lists without strings that match old_regexp are not modified.",
91-
example: "",
88+
'substitute': {
89+
perRule: true, minArg: 3, maxArg: 3, template: '<attr> <old_regexp> <new_template>',
90+
description: 'Replaces strings which match old_regexp in the list attr according to new_template. Wildcard * matches all attributes. The regular expression must follow RE2 syntax. new_template may be a simple replacement string, but it may also expand numbered or named groups using $0 or $x. Lists without strings that match old_regexp are not modified.',
91+
example: '',
9292
},
93-
"set": {
94-
perRule: true, minArg: 1, maxArg: -1, template: "<attr> <value(s)>",
95-
description: "Sets the value of an attribute. If the attribute was already present, its old value is replaced.",
93+
'set': {
94+
perRule: true, minArg: 1, maxArg: -1, template: '<attr> <value(s)>',
95+
description: 'Sets the value of an attribute. If the attribute was already present, its old value is replaced.',
9696
example: "buildozer 'set kind java_library' //pkg:%gwt_module",
9797
},
98-
"set_if_absent": {
99-
perRule: true, minArg: 1, maxArg: -1, template: "<attr> <value(s)>",
100-
description: "Sets the value of an attribute. If the attribute was already present, no action is taken.",
98+
'set_if_absent': {
99+
perRule: true, minArg: 1, maxArg: -1, template: '<attr> <value(s)>',
100+
description: 'Sets the value of an attribute. If the attribute was already present, no action is taken.',
101101
example: "buildozer 'set_if_absent allowv1syntax 1' //pkg:%soy_js",
102102
},
103-
"copy": {
104-
perRule: true, minArg: 2, maxArg: 2, template: "<attr> <from_rule>",
105-
description: "Copies the value of attr between rules. If it exists in the to_rule, it will be overwritten.",
103+
'copy': {
104+
perRule: true, minArg: 2, maxArg: 2, template: '<attr> <from_rule>',
105+
description: 'Copies the value of attr between rules. If it exists in the to_rule, it will be overwritten.',
106106
example: "buildozer 'copy testonly protolib' //pkg:py_protolib",
107107
},
108-
"copy_no_overwrite": {
109-
perRule: true, minArg: 2, maxArg: 2, template: "<attr> <from_rule>",
110-
description: "Copies the value of attr between rules. If it exists in the to_rule, no action is taken.",
111-
example: "",
108+
'copy_no_overwrite': {
109+
perRule: true, minArg: 2, maxArg: 2, template: '<attr> <from_rule>',
110+
description: 'Copies the value of attr between rules. If it exists in the to_rule, no action is taken.',
111+
example: '',
112112
},
113-
"dict_add": {
114-
perRule: true, minArg: 2, maxArg: -1, template: "<attr> <(key:value)(s)>",
115-
description: "Sets the value of a key for the dict attribute attr. If the key was already present, it will not be overwritten.",
116-
example: "",
113+
'dict_add': {
114+
perRule: true, minArg: 2, maxArg: -1, template: '<attr> <(key:value)(s)>',
115+
description: 'Sets the value of a key for the dict attribute attr. If the key was already present, it will not be overwritten.',
116+
example: '',
117117
},
118-
"dict_set": {
119-
perRule: true, minArg: 2, maxArg: -1, template: "<attr> <(key:value)(s)>",
120-
description: "Sets the value of a key for the dict attribute attr. If the key was already present, its old value is replaced.",
121-
example: "",
118+
'dict_set': {
119+
perRule: true, minArg: 2, maxArg: -1, template: '<attr> <(key:value)(s)>',
120+
description: 'Sets the value of a key for the dict attribute attr. If the key was already present, its old value is replaced.',
121+
example: '',
122122
},
123-
"dict_remove": {
124-
perRule: true, minArg: 2, maxArg: -1, template: "<attr> <key(s)>",
125-
description: "Deletes the key for the dict attribute attr.",
126-
example: "",
123+
'dict_remove': {
124+
perRule: true, minArg: 2, maxArg: -1, template: '<attr> <key(s)>',
125+
description: 'Deletes the key for the dict attribute attr.',
126+
example: '',
127127
},
128-
"dict_list_add": {
129-
perRule: true, minArg: 3, maxArg: -1, template: "<attr> <key> <value(s)>",
130-
description: "Adds value(s) to the list in the dict attribute attr.",
131-
example: "",
128+
'dict_list_add': {
129+
perRule: true, minArg: 3, maxArg: -1, template: '<attr> <key> <value(s)>',
130+
description: 'Adds value(s) to the list in the dict attribute attr.',
131+
example: '',
132132
},
133133
};
134134

@@ -154,7 +154,7 @@ export class BuildozerWizard {
154154
}
155155

156156
getCommand(): string {
157-
return [this.command, ...this.commandArgs].join(" ");
157+
return [this.command, ...this.commandArgs].join(' ');
158158
}
159159

160160
async run(): Promise<void> {
@@ -212,7 +212,7 @@ export class BuildozerWizard {
212212
}
213213
}
214214

215-
type InputWork<T> = (input: MultiStepInput) => Promise<T>
215+
type InputWork<T> = (input: MultiStepInput) => Promise<T>;
216216

217217
/**
218218
* Return a new function that closes over the given inputBox argument and
@@ -237,15 +237,15 @@ function fromInputBox(title: string, prompt: string, totalSteps: number, step: n
237237
});
238238
resolve(result);
239239
});
240-
}
240+
};
241241
}
242242

243-
function pickCommandDescriptionSequence(command: string, info: commandInfo, results: string[]): InputStep {
243+
function pickCommandDescriptionSequence(command: string, info: CommandInfo, results: string[]): InputStep {
244244
const parts = info.template.split(/\s+/);
245245
const work: InputWork<string>[] = parts.map((part, index) => {
246-
let help = part + ": " + info.description;
246+
let help = part + ': ' + info.description;
247247
if (info.example) {
248-
help += ". Example: " + info.example;
248+
help += '. Example: ' + info.example;
249249
}
250250
return fromInputBox('Buildozer: ' + command, help, parts.length, index, '');
251251
});
@@ -258,6 +258,6 @@ function pickCommandDescriptionSequence(command: string, info: commandInfo, resu
258258
const result = await workItem(input);
259259
results.push(result);
260260
return fn;
261-
}
261+
};
262262
return fn;
263263
}

0 commit comments

Comments
 (0)