Skip to content

Commit

Permalink
Improved code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Sep 9, 2018
1 parent 622d1a5 commit 6c1ddf4
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 20 deletions.
1 change: 0 additions & 1 deletion scripts/icons/checks/checkIconConflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const check = () => {
};

const checkFileIcons = () => {
const icons = {};
checkForConflictsInFileIcons('fileExtensions');
checkForConflictsInFileIcons('fileNames');
};
Expand Down
2 changes: 0 additions & 2 deletions scripts/icons/checks/checkIconUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ const folderPath = path.join('icons');
*/
const availableIcons: { [s: string]: string } = {};

const unusedIcons = [];

/**
* Get all icon file names from the file system.
*/
Expand Down
4 changes: 2 additions & 2 deletions scripts/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const createHTMLTableHeadRow = (amount: number) => {

const createHTMLTableBodyRows = (items: IconDefinition[][]) => {
let rows = '';
items.forEach((row, i) => {
items.forEach(row => {
const columns = row.map(icon => `
<td class="icon">
<img src="./../../icons/${icon.iconName}.svg" alt="${icon.label}">
Expand Down Expand Up @@ -68,7 +68,7 @@ const savePreview = (fileName: string, size: number, icons: IconDefinition[][])
// create the images
createScreenshots(filePath, fileName).then(() => {
console.log(painter.green(`Successfully created ${fileName} preview images!`));
}).catch(e => {
}).catch(() => {
throw Error(painter.red(`Error while creating ${fileName} preview images`));
});
};
Expand Down
8 changes: 4 additions & 4 deletions src/commands/iconPacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as i18n from './../i18n';
export const toggleIconPacks = () => {
return getActiveIconPack()
.then((pack) => showQuickPickItems(pack)
.then((value) => handleQuickPickActions(value, pack)));
.then((value) => handleQuickPickActions(value)));
};

/** Get all packs that can be used in this icon theme. */
Expand All @@ -21,7 +21,7 @@ export const getAllIconPacks = () => {
return packs;
};

/** Show QuickPick items to select prefered configuration for the icon packs. */
/** Show QuickPick items to select preferred configuration for the icon packs. */
const showQuickPickItems = (activePack: string) => {
const packs = [...getAllIconPacks().sort(), 'none'];
const options = packs.map((pack): vscode.QuickPickItem => {
Expand All @@ -32,7 +32,7 @@ const showQuickPickItems = (activePack: string) => {
return {
description: packLabel,
detail: i18n.translate(`iconPacks.${pack === 'none' ? 'disabled' : 'description'}`, packLabel),
label: iconPacksDeactivated ? '\u2714' : isPackActive(activePack, pack) ? '\u2714' : '\u25FB'
label: iconPacksDeactivated ? '\u2714' : active ? '\u2714' : '\u25FB'
};
});

Expand All @@ -45,7 +45,7 @@ const showQuickPickItems = (activePack: string) => {
};

/** Handle the actions from the QuickPick. */
const handleQuickPickActions = (value: vscode.QuickPickItem, activePack: string) => {
const handleQuickPickActions = (value: vscode.QuickPickItem) => {
if (!value || !value.description) return;
const decision = value.description.replace(' + ', '_').toLowerCase();

Expand Down
1 change: 1 addition & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const commands = [
activateThemeCommand,
toggleIconPacksCommand,
changeFolderThemeCommand,
toggleFolderColorCommand,
restoreDefaultConfigCommand,
hidesExplorerArrowsCommand,
changeOpacityCommand
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/changeDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const detectConfigChanges = () => {
*/
const compareConfigs = (configs: string[]): Promise<{ updatedConfigs: IconJsonOptions, updatedJSONConfig: IconJsonOptions }> => {
return getMaterialIconsJSON().then(json => {
return configs.reduce((result, configName, i) => {
return configs.reduce((result, configName) => {
// no further actions (e.g. reload) required
if (/show(Welcome|Update|Reload)Message/g.test(configName)) return result;

Expand Down
2 changes: 1 addition & 1 deletion src/messages/reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as i18n from './../i18n';

/** User has to confirm if he wants to reload the editor */
export const showConfirmToReloadMessage = (): Promise<boolean> => {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
// if the user does not want to see the reload message
if (helpers.getThemeConfig('showReloadMessage').globalValue === false) return;

Expand Down
2 changes: 0 additions & 2 deletions src/messages/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export const showUpdateMessage = () => {
// if the user does not want to see the update message
if (helpers.getThemeConfig('showUpdateMessage').globalValue !== true) return;

const config = helpers.getConfig().inspect('workbench.iconTheme');

vscode.window.showInformationMessage(
i18n.translate('themeUpdated'),

Expand Down
6 changes: 0 additions & 6 deletions src/models/iconConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,3 @@ export class IconConfiguration {
this.options = {};
}
}

interface IconDefinition {
[definition: string]: {
iconPath: string;
};
}
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"dom"
],
"sourceMap": true,
"rootDir": "."
"rootDir": ".",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"exclude": [
"node_modules",
Expand Down

0 comments on commit 6c1ddf4

Please sign in to comment.