Skip to content

Commit

Permalink
eslint: enable sort-keys rule
Browse files Browse the repository at this point in the history
This rule unfortunately does not autofix, I temporarily installed
https://www.npmjs.com/package/eslint-plugin-sort-keys-fix to run the
eslint:fix command, and then removed to avoid bringing in the extra
dependency.
  • Loading branch information
KKoukiou committed Mar 7, 2024
1 parent 3f3bd20 commit c1ee7c5
Show file tree
Hide file tree
Showing 32 changed files with 190 additions and 189 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"sort-imports": ["error", { "ignoreDeclarationSort": true }],
"import/order": [ 1, { "groups": ["external", "builtin", ["internal", "sibling", "parent", "index"]], "newlines-between": "always" } ],
"quotes": ["error", "double" ],
"react/hook-use-state": ["error", { "allowDestructuredState": false }]
"react/hook-use-state": ["error", { "allowDestructuredState": false }],
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": true, "minKeys": 2}]
},
"globals": {
"require": false,
Expand Down
6 changes: 3 additions & 3 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function watchDirs (dir, onChange) {
}

const context = await esbuild.context({
sourcemap: "linked",
bundle: true,
entryPoints: ["./src/index.js"],
external: [
Expand All @@ -66,7 +65,6 @@ const context = await esbuild.context({
minify: production,
nodePaths,
outdir,
target: ["es2020"],
plugins: [
cleanPlugin(),
// Esbuild will only copy assets that are explicitly imported and used
Expand Down Expand Up @@ -100,7 +98,9 @@ const context = await esbuild.context({
build.onEnd(() => console.log(`${getTime()}: Build finished`));
}
},
]
],
sourcemap: "linked",
target: ["es2020"],
});

try {
Expand Down
12 changes: 6 additions & 6 deletions src/actions/localization-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export const getLanguageDataAction = ({ language }) => {
const locales = await Promise.all(localeIds.map(async locale => await getLocaleData({ locale })));

return dispatch({
type: "GET_LANGUAGE_DATA",
payload: { languageData: { [language]: { languageData, locales } } }
payload: { languageData: { [language]: { languageData, locales } } },
type: "GET_LANGUAGE_DATA"
});
} catch (error) {
dispatch(setCriticalErrorAction(error));
Expand All @@ -63,8 +63,8 @@ export const getLanguageAction = () => {
const language = await getLanguage();

return dispatch({
type: "GET_LANGUAGE",
payload: { language }
payload: { language },
type: "GET_LANGUAGE"
});
} catch (error) {
dispatch(setCriticalErrorAction(error));
Expand All @@ -78,8 +78,8 @@ export const getCommonLocalesAction = () => {
const commonLocales = await getCommonLocales();

return dispatch({
type: "GET_COMMON_LOCALES",
payload: { commonLocales }
payload: { commonLocales },
type: "GET_COMMON_LOCALES"
});
} catch (error) {
dispatch(setCriticalErrorAction(error));
Expand Down
8 changes: 4 additions & 4 deletions src/actions/miscellaneous-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/

export const setCriticalErrorAction = (criticalError) => ({
type: "SET_CRITICAL_ERROR",
payload: { criticalError }
payload: { criticalError },
type: "SET_CRITICAL_ERROR"
});

export const setCriticalErrorFrontendAction = (criticalErrorFrontend) => ({
type: "SET_CRITICAL_ERROR_FRONTEND",
payload: { criticalErrorFrontend }
payload: { criticalErrorFrontend },
type: "SET_CRITICAL_ERROR_FRONTEND"
});
4 changes: 2 additions & 2 deletions src/actions/network-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const getConnectedAction = () => {
const connected = await getConnected();

return dispatch({
type: "GET_NETWORK_CONNECTED",
payload: { connected }
payload: { connected },
type: "GET_NETWORK_CONNECTED"
});
} catch (error) {
setCriticalErrorAction(error);
Expand Down
4 changes: 2 additions & 2 deletions src/actions/runtime-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const getPasswordPoliciesAction = () => {
const passwordPolicies = await getPasswordPolicies();

return dispatch({
type: "GET_RUNTIME_PASSWORD_POLICIES",
payload: { passwordPolicies }
payload: { passwordPolicies },
type: "GET_RUNTIME_PASSWORD_POLICIES"
});
} catch (error) {
setCriticalErrorAction(error);
Expand Down
10 changes: 5 additions & 5 deletions src/actions/storage-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export const getDevicesAction = () => {
}));

return dispatch({
type: "GET_DEVICES_DATA",
payload: {
deviceNames: devices,
devices: devicesData.reduce((acc, curr) => ({ ...acc, ...curr }), {}),
}
},
type: "GET_DEVICES_DATA"
});
} catch (error) {
return dispatch(setCriticalErrorAction(error));
Expand All @@ -78,14 +78,14 @@ export const getDiskSelectionAction = () => {
const diskSelection = await getAllDiskSelection();

return dispatch({
type: "GET_DISK_SELECTION",
payload: {
diskSelection: {
ignoredDisks: diskSelection[0].IgnoredDisks.v,
selectedDisks: diskSelection[0].SelectedDisks.v,
usableDisks,
}
},
type: "GET_DISK_SELECTION",
});
} catch (error) {
return dispatch(setCriticalErrorAction(error));
Expand All @@ -111,8 +111,8 @@ export const getPartitioningDataAction = ({ requests, partitioning }) => {
}

return dispatch({
type: "GET_PARTITIONING_DATA",
payload: { path: partitioning, partitioningData: props }
payload: { partitioningData: props, path: partitioning },
type: "GET_PARTITIONING_DATA"
});
} catch (error) {
return dispatch(setCriticalErrorAction(error));
Expand Down
2 changes: 1 addition & 1 deletion src/apis/boss.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class BossClient {

this.client = cockpit.dbus(
INTERFACE_NAME,
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down
2 changes: 1 addition & 1 deletion src/apis/localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class LocalizationClient {

this.client = cockpit.dbus(
INTERFACE_NAME,
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down
2 changes: 1 addition & 1 deletion src/apis/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class NetworkClient {

this.client = cockpit.dbus(
INTERFACE_NAME,
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down
2 changes: 1 addition & 1 deletion src/apis/payloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class PayloadsClient {

this.client = cockpit.dbus(
INTERFACE_NAME,
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down
2 changes: 1 addition & 1 deletion src/apis/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class RuntimeClient {

this.client = cockpit.dbus(
"org.fedoraproject.Anaconda.Modules.Runtime",
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down
4 changes: 2 additions & 2 deletions src/apis/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class StorageClient {

this.client = cockpit.dbus(
INTERFACE_NAME,
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down Expand Up @@ -102,7 +102,7 @@ export const startEventMonitorStorage = ({ dispatch }) => {
if (args[0] === "org.fedoraproject.Anaconda.Modules.Storage.DiskSelection") {
dispatch(getDiskSelectionAction());
} else if (args[0] === "org.fedoraproject.Anaconda.Modules.Storage.Partitioning.Manual" && Object.hasOwn(args[1], "Requests")) {
dispatch(getPartitioningDataAction({ requests: args[1].Requests.v, partitioning: path }));
dispatch(getPartitioningDataAction({ partitioning: path, requests: args[1].Requests.v }));
} else if (args[0] === INTERFACE_NAME && Object.hasOwn(args[1], "CreatedPartitioning")) {
const last = args[1].CreatedPartitioning.v.length - 1;
dispatch(getPartitioningDataAction({ partitioning: args[1].CreatedPartitioning.v[last] }));
Expand Down
6 changes: 3 additions & 3 deletions src/apis/storage_partitioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const applyStorage = async ({ partitioning, encrypt, encryptPassword, onF
const part = partitioning || await createPartitioning({ method: "AUTOMATIC" });

if (encrypt) {
await partitioningSetEncrypt({ partitioning: part, encrypt });
await partitioningSetEncrypt({ encrypt, partitioning: part });
}
if (encryptPassword) {
await partitioningSetPassphrase({ partitioning: part, passphrase: encryptPassword });
Expand All @@ -209,10 +209,10 @@ export const applyStorage = async ({ partitioning, encrypt, encryptPassword, onF
const tasks = await partitioningConfigureWithTask({ partitioning: part });

runStorageTask({
task: tasks[0],
onFail,
onSuccess: () => applyPartitioning({ partitioning: part })
.then(onSuccess)
.catch(onFail)
.catch(onFail),
task: tasks[0]
});
};
2 changes: 1 addition & 1 deletion src/apis/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class UsersClient {

this.client = cockpit.dbus(
INTERFACE_NAME,
{ superuser: "try", bus: "none", address }
{ address, bus: "none", superuser: "try" }
);
this.address = address;
}
Expand Down
24 changes: 12 additions & 12 deletions src/components/AnacondaWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const AnacondaWizard = ({ dispatch, storageData, localizationData, runtim
const stepsOrder = [
{
component: InstallationLanguage,
data: { dispatch, languages: localizationData.languages, language: localizationData.language, commonLocales: localizationData.commonLocales },
data: { commonLocales: localizationData.commonLocales, dispatch, language: localizationData.language, languages: localizationData.languages },
...getInstallationLanguageProps({ isBootIso, osRelease })
},
{
Expand All @@ -120,14 +120,14 @@ export const AnacondaWizard = ({ dispatch, storageData, localizationData, runtim
partitioning: storageData.partitioning.path,
requests: storageData.partitioning.requests,
scenarioPartitioningMapping,
storageScenarioId,
setShowStorage,
setStorageScenarioId: (scenarioId) => {
window.sessionStorage.setItem("storage-scenario-id", scenarioId);
setStorageScenarioId(scenarioId);
},
setShowStorage,
storageScenarioId,
},
...getInstallationMethodProps({ isBootIso, osRelease, isFormValid })
...getInstallationMethodProps({ isBootIso, isFormValid, osRelease })
},
{
id: "disk-configuration",
Expand All @@ -145,9 +145,9 @@ export const AnacondaWizard = ({ dispatch, storageData, localizationData, runtim
}, {
component: DiskEncryption,
data: {
storageEncryption,
setStorageEncryption,
passwordPolicies: runtimeData.passwordPolicies,
setStorageEncryption,
storageEncryption,
},
...getDiskEncryptionProps({ storageScenarioId })
}]
Expand All @@ -156,21 +156,21 @@ export const AnacondaWizard = ({ dispatch, storageData, localizationData, runtim
component: Accounts,
data: {
accounts,
setAccounts,
passwordPolicies: runtimeData.passwordPolicies,
setAccounts,
},
...getAccountsProps({ isBootIso })
},
{
component: ReviewConfiguration,
data: {
accounts,
deviceData: storageData.devices,
diskSelection: storageData.diskSelection,
requests: storageData.partitioning ? storageData.partitioning.requests : null,
language,
localizationData,
requests: storageData.partitioning ? storageData.partitioning.requests : null,
storageScenarioId,
accounts,
},
...getReviewConfigurationProps({ storageScenarioId })
},
Expand Down Expand Up @@ -351,6 +351,8 @@ const Footer = ({
setIsFormDisabled(true);

applyStorage({
encrypt: storageEncryption.encrypt,
encryptPassword: storageEncryption.password,
onFail: ex => {
console.error(ex);
setIsFormDisabled(false);
Expand All @@ -364,16 +366,13 @@ const Footer = ({
setIsFormDisabled(false);
setStepNotification();
},
encrypt: storageEncryption.encrypt,
encryptPassword: storageEncryption.password,
});
} else if (activeStep.id === "installation-review") {
setNextWaitsConfirmation(true);
} else if (activeStep.id === "mount-point-mapping") {
setIsFormDisabled(true);

applyStorage({
partitioning,
onFail: ex => {
console.error(ex);
setIsFormDisabled(false);
Expand All @@ -387,6 +386,7 @@ const Footer = ({
setIsFormDisabled(false);
setStepNotification();
},
partitioning,
});
} else if (activeStep.id === "accounts") {
applyAccounts(accounts)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Error.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ const ensureMaximumReportURLLength = (reportURL) => {
// The current limit on URL length is 8KiB server limit.
const searchParamsLimits = [
// Summary should be short
{ param: "short_desc", length: 256 },
{ length: 256, param: "short_desc" },
// We reserve some space in Details text for attachment message which
// will be always appended to the end.
{ param: "comment", length: 8192 - 256 - 100 },
{ length: 8192 - 256 - 100, param: "comment" },
];
const sp = newUrl.searchParams;
searchParamsLimits.forEach((limit) => {
Expand Down
Loading

0 comments on commit c1ee7c5

Please sign in to comment.