Implemented strict linting standards and prettier formatting config. (#248)

* Implemented strict linting standards and prettier formatting config.

* More linter fixes and type updates.

* More linter updates and type fixes

* Remove noisy comments

* Linter and type updates

* Linter, formatting and type updates.

* Linter updates

* Type updates

* Type updates

* fixed all linter errors

* Fixed all linting, formatting and type issues.

* Resolve merge conflicts.
This commit is contained in:
Jas Singh
2024-09-14 16:20:05 -07:00
committed by GitHub
parent ff13e3dd3c
commit 2c72cc66d8
222 changed files with 13141 additions and 8433 deletions

View File

@@ -1,42 +1,44 @@
import { PowerOptions } from "lib/types/options";
import options from "options";
import powermenu from "../power/helpers/actions";
import { PowerOptions } from 'lib/types/options';
import options from 'options';
import powermenu from '../power/helpers/actions';
import { GButton } from 'lib/types/widget';
const { confirmation, shutdown, logout, sleep, reboot, showLabel } = options.menus.power;
export const PowerButton = (action: PowerOptions) => {
const handleClick = (action: PowerOptions) => {
export const PowerButton = (action: PowerOptions): GButton => {
const handleClick = (action: PowerOptions): void => {
const actions = {
shutdown: shutdown.value,
reboot: reboot.value,
logout: logout.value,
sleep: sleep.value,
};
App.closeWindow("powerdropdownmenu");
App.closeWindow('powerdropdownmenu');
if (!confirmation.value) {
Utils.execAsync(actions[action])
.catch((err) => console.error(`Failed to execute ${action} command. Error: ${err}`));
Utils.execAsync(actions[action]).catch((err) =>
console.error(`Failed to execute ${action} command. Error: ${err}`),
);
} else {
powermenu.customAction(action, actions[action]);
}
};
const powerIconMap = {
shutdown: "󰐥",
reboot: "󰜉",
logout: "󰿅",
sleep: "󰤄",
shutdown: '󰐥',
reboot: '󰜉',
logout: '󰿅',
sleep: '󰤄',
};
return Widget.Button({
className: showLabel.bind("value").as(shwLbl => {
return `power-menu-button ${action} ${!shwLbl ? "no-label" : ""}`;
className: showLabel.bind('value').as((shwLbl) => {
return `power-menu-button ${action} ${!shwLbl ? 'no-label' : ''}`;
}),
on_clicked: () => handleClick(action),
child: Widget.Box({
vertical: false,
children: showLabel.bind("value").as(shwLbl => {
children: showLabel.bind('value').as((shwLbl) => {
if (shwLbl) {
return [
Widget.Label({
@@ -44,7 +46,7 @@ export const PowerButton = (action: PowerOptions) => {
className: `power-button-icon ${action}-icon txt-icon`,
}),
Widget.Label({
hpack: "center",
hpack: 'center',
hexpand: true,
label: action.charAt(0).toUpperCase() + action.slice(1),
className: `power-button-label ${action}-label show-label`,
@@ -58,6 +60,6 @@ export const PowerButton = (action: PowerOptions) => {
}),
];
}),
})
}),
});
};

View File

@@ -1,24 +1,20 @@
import DropdownMenu from "../DropdownMenu.js";
import { PowerButton } from "./button.js";
import Window from 'types/widgets/window.js';
import DropdownMenu from '../DropdownMenu.js';
import { PowerButton } from './button.js';
import { Attribute, Child } from 'lib/types/widget.js';
export default () => {
export default (): Window<Child, Attribute> => {
return DropdownMenu({
name: "powerdropdownmenu",
transition: "crossfade",
name: 'powerdropdownmenu',
transition: 'crossfade',
child: Widget.Box({
class_name: "menu-items power-dropdown",
class_name: 'menu-items power-dropdown',
child: Widget.Box({
vertical: true,
hexpand: true,
class_name: "menu-items-container power-dropdown",
children: [
PowerButton('shutdown'),
PowerButton('reboot'),
PowerButton('logout'),
PowerButton('sleep'),
],
class_name: 'menu-items-container power-dropdown',
children: [PowerButton('shutdown'), PowerButton('reboot'), PowerButton('logout'), PowerButton('sleep')],
}),
}),
});
};