pkg: make JavaScript keyspacing consistent

cockpit-ostree enables this by default and we have to disable it now.
Having consistent key spacing for all our JavaScript objects seems like
something we want everywhere as eslint --fix can automatically.
This commit is contained in:
Jelle van der Waa 2022-11-04 11:30:32 +01:00 committed by Jelle van der Waa
parent 35b9360191
commit 58b95f1a8c
24 changed files with 159 additions and 160 deletions

View File

@ -41,7 +41,6 @@
"curly": "off",
"no-template-curly-in-string": "off",
"jsx-quotes": "off",
"key-spacing": "off",
"no-console": "off",
"quotes": "off",
"react/jsx-curly-spacing": "off",

View File

@ -5,7 +5,7 @@ function test_storage (assert, storage, cockpitStorage) {
assert.expect(29);
storage.clear();
window.mock = {
pathname : "/cockpit+test/test"
pathname: "/cockpit+test/test"
};
assert.equal(cockpitStorage.prefixedKey("key1"), "cockpit+test:key1", "prefixed key has application");

View File

@ -467,7 +467,7 @@ QUnit.test("close peer", function (assert) {
const cmd = {
command: "close",
channel: channel.id,
problem : "marmalade",
problem: "marmalade",
extra: 5
};
mock_peer.send("", JSON.stringify(cmd));

View File

@ -51,7 +51,7 @@ function child_frame() {
let spawn_done = false;
let binary_done = false;
const promise = cockpit.spawn(["/bin/sh", "-c", "echo hi"], { host : "localhost" })
const promise = cockpit.spawn(["/bin/sh", "-c", "echo hi"], { host: "localhost" })
.then(resp => {
assert.equal(resp, "hi\n", "framed channel got output");
})
@ -67,7 +67,7 @@ function child_frame() {
const channel = cockpit.channel({
payload: "echo",
binary: true,
host : "localhost"
host: "localhost"
});
channel.addEventListener("message", function(ev, payload) {
assert.equal(typeof payload[0], "number", "binary channel got a byte array");

View File

@ -79,7 +79,7 @@ export class ShutdownModal extends React.Component {
}
updateDate(value, dateObject) {
this.setState({ date : value, dateObject }, this.calculate);
this.setState({ date: value, dateObject }, this.calculate);
}
updateTime(value, hour, minute) {

View File

@ -948,7 +948,7 @@ function Channel(options) {
if (!options)
options = { };
else if (typeof options == "string")
options = { problem : options };
options = { problem: options };
options.command = "close";
options.channel = id;

View File

@ -698,7 +698,7 @@ class ChangeAuth extends React.Component {
return this.props.try2Connect(this.props.full_address, options)
.then(() => {
if (machine)
return this.props.machines_ins.change(machine.address, { user : user });
return this.props.machines_ins.change(machine.address, { user: user });
else
return Promise.resolve();
})

View File

@ -280,10 +280,10 @@ function MachinesIndex(index_options, machines, loader) {
}
const new_item = Object.assign({}, item);
new_item.keyword = { score:-1 };
new_item.keyword = { score: -1 };
if (!term)
return new_item;
const best_keyword = new_item.keywords.reduce(keyword_relevance, { score:-1 });
const best_keyword = new_item.keywords.reduce(keyword_relevance, { score: -1 });
if (best_keyword.score > -1) {
new_item.keyword = best_keyword;
return new_item;

View File

@ -204,7 +204,7 @@ const StratisPoolSidebar = ({ client, pool }) => {
desc = cockpit.format(_("$0 of unknown tier"),
fmt_size(Number(blockdev.TotalPhysicalSize)));
return { client, block, detail: desc, key:blockdev.path };
return { client, block, detail: desc, key: blockdev.path };
}
const actions = (

View File

@ -210,7 +210,7 @@ const PageSystemInformationChangeHostname = () => {
const [error, set_error] = useState([]);
useInit(() => {
const client = cockpit.dbus('org.freedesktop.hostname1', { superuser : "try" });
const client = cockpit.dbus('org.freedesktop.hostname1', { superuser: "try" });
const hostname_proxy = client.proxy();
hostname_proxy.wait()

View File

@ -119,22 +119,22 @@ function validate_username(username, accounts) {
function suggest_username(realname) {
function remove_diacritics(str) {
const translate_table = {
a : '[àáâãäå]',
a: '[àáâãäå]',
ae: 'æ',
c : '[čç]',
d : 'ď',
e : '[èéêë]',
i : '[íìïî]',
l : '[ĺľ]',
n : '[ňñ]',
o : '[òóôõö]',
c: '[čç]',
d: 'ď',
e: '[èéêë]',
i: '[íìïî]',
l: '[ĺľ]',
n: '[ňñ]',
o: '[òóôõö]',
oe: 'œ',
r : '[ŕř]',
s : 'š',
t : 'ť',
u : '[ùúůûűü]',
y : '[ýÿ]',
z : 'ž',
r: '[ŕř]',
s: 'š',
t: 'ť',
u: '[ùúůûűü]',
y: '[ýÿ]',
z: 'ž',
};
for (const i in translate_table)
str = str.replace(new RegExp(translate_table[i], 'g'), i);

View File

@ -119,7 +119,7 @@ export function account_expiration_dialog(account, expire_date) {
} else
prog.push("");
prog.push(account.name);
return cockpit.spawn(prog, { superuser : true, err: "message" });
return cockpit.spawn(prog, { superuser: true, err: "message" });
} else {
update();
return Promise.reject();

View File

@ -278,7 +278,7 @@ export function reset_password_dialog(account) {
style: "primary",
clicked: () => {
return cockpit.spawn(["/usr/bin/passwd", "-e", account.name],
{ superuser : true, err: "message" });
{ superuser: true, err: "message" });
}
}
]