Skip to content

Commit

Permalink
Apply ESLint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
PKief committed Feb 13, 2020
1 parent cd9930f commit 970544c
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/commands/explorerArrows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export const toggleExplorerArrows = async () => {
const showQuickPickItems = (status: boolean) => {
const on: vscode.QuickPickItem = {
description: i18n.translate('toggleSwitch.on'),
detail: i18n.translate(`explorerArrows.enable`),
detail: i18n.translate('explorerArrows.enable'),
label: !status ? '\u2714' : '\u25FB'
};
const off: vscode.QuickPickItem = {
description: i18n.translate('toggleSwitch.off'),
detail: i18n.translate(`explorerArrows.disable`),
detail: i18n.translate('explorerArrows.disable'),
label: status ? '\u2714' : '\u25FB'
};
return vscode.window.showQuickPick(
Expand Down
4 changes: 2 additions & 2 deletions src/commands/grayscale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export const toggleGrayscale = async () => {
const showQuickPickItems = (status: boolean) => {
const on: vscode.QuickPickItem = {
description: i18n.translate('toggleSwitch.on'),
detail: i18n.translate(`grayscale.enable`),
detail: i18n.translate('grayscale.enable'),
label: status ? '\u2714' : '\u25FB'
};
const off: vscode.QuickPickItem = {
description: i18n.translate('toggleSwitch.off'),
detail: i18n.translate(`grayscale.disable`),
detail: i18n.translate('grayscale.disable'),
label: !status ? '\u2714' : '\u25FB'
};
return vscode.window.showQuickPick(
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/changeDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const detectConfigChanges = () => {
* @param configs List of configuration names
* @returns List of configurations that needs to be updated.
*/
const compareConfigs = (configs: string[]): { updatedConfigs: IconJsonOptions, updatedJSONConfig: IconJsonOptions } => {
const compareConfigs = (configs: string[]): { updatedConfigs: IconJsonOptions; updatedJSONConfig: IconJsonOptions } => {
const json = getMaterialIconsJSON();
return configs.reduce((result, configName) => {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const setObjectPropertyValue = (obj: Object, path, value) => {
Object.prototype.toString.call(obj[e]) === '[object Object]'
? obj[e]
: {},
path,
value);
path,
value);
} else {
obj[path[0]] = value;
}
Expand Down
8 changes: 4 additions & 4 deletions src/icons/generator/folderGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ export const generateFolderIcons = (color: string) => {
return console.error('Invalid color code for folder icons');
}

const folderIcon = `M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8c0-1.11-.9-2-2-2h-8l-2-2z`;
const folderIconOpen = `M19 20H4c-1.11 0-2-.9-2-2V6c0-1.11.89-2 2-2h6l2 2h7a2 2 0 0 1 2 2H4v10l2.14-8h17.07l-2.28 8.5c-.23.87-1.01 1.5-1.93 1.5z`;
const rootFolderIcon = `M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 5a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5z`;
const rootFolderIconOpen = `M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2z`;
const folderIcon = 'M10 4H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8c0-1.11-.9-2-2-2h-8l-2-2z';
const folderIconOpen = 'M19 20H4c-1.11 0-2-.9-2-2V6c0-1.11.89-2 2-2h6l2 2h7a2 2 0 0 1 2 2H4v10l2.14-8h17.07l-2.28 8.5c-.23.87-1.01 1.5-1.93 1.5z';
const rootFolderIcon = 'M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 5a5 5 0 0 0-5 5 5 5 0 0 0 5 5 5 5 0 0 0 5-5 5 5 0 0 0-5-5z';
const rootFolderIconOpen = 'M12 20a8 8 0 0 1-8-8 8 8 0 0 1 8-8 8 8 0 0 1 8 8 8 8 0 0 1-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2z';

writeSVGFiles('folder', getSVG(getPath(folderIcon, color)));
writeSVGFiles('folder-open', getSVG(getPath(folderIconOpen, color)));
Expand Down
6 changes: 3 additions & 3 deletions src/icons/generator/iconSaturation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ const addFilterAttribute = (svgRoot: string) => {
const pattern = new RegExp(/\sfilter="[^"]+?"/);
// if the filter attribute already exists
if (pattern.test(svgRoot)) {
return svgRoot.replace(pattern, ` filter="url(#saturation)"`);
return svgRoot.replace(pattern, ' filter="url(#saturation)"');
} else {
return svgRoot.replace(/^<svg/, `<svg filter="url(#saturation)"`);
return svgRoot.replace(/^<svg/, '<svg filter="url(#saturation)"');
}
};

Expand Down Expand Up @@ -106,7 +106,7 @@ const addFilterElement = (svg: string, value: number) => {
*/
const removeFilterElement = (svg: string) => {
const pattern = new RegExp(/<filter id="saturation".+<\/filter>(.*<\/svg>)/);
return svg.replace(pattern, `$1`);
return svg.replace(pattern, '$1');
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/models/advancedWorkspaceConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export interface AdvancedWorkspaceConfiguration {
get<T>(section: string, defaultValue?: T): T;
has(section: string): boolean;
[key: string]: any;
inspect<T>(section: string): { defaultValue: T, globalValue: T, key: string, workspaceValue: T } | undefined;
inspect<T>(section: string): { defaultValue: T; globalValue: T; key: string; workspaceValue: T } | undefined;
update(section: string, value: any, global?: boolean): Thenable<void>;
}
12 changes: 6 additions & 6 deletions src/models/iconConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ export class IconConfiguration {
file?: string;
folder?: string;
folderExpanded?: string;
folderNames?: { [s: string]: string; };
folderNamesExpanded?: { [s: string]: string; };
folderNames?: { [s: string]: string };
folderNamesExpanded?: { [s: string]: string };
rootFolder?: string;
rootFolderExpanded?: string;
fileExtensions?: { [s: string]: string; };
fileNames?: { [s: string]: string; };
languageIds?: { [s: string]: string; };
iconDefinitions?: { [s: string]: any; };
fileExtensions?: { [s: string]: string };
fileNames?: { [s: string]: string };
languageIds?: { [s: string]: string };
iconDefinitions?: { [s: string]: any };
light?: IconConfiguration;
highContrast?: IconConfiguration;
options?: IconJsonOptions;
Expand Down
1 change: 1 addition & 0 deletions src/models/scripts/contributors/contributor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
export interface Contributor {
login: string;
id: number;
Expand Down
12 changes: 6 additions & 6 deletions src/scripts/contributors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const parseLinkHeader = (linkHeader: string) => {
/**
* Get all contributors from GitHub API.
*/
const fetchContributors = (page: string): Promise<{ contributorsOfPage: Contributor[], nextPage: string }> => {
const fetchContributors = (page: string): Promise<{ contributorsOfPage: Contributor[]; nextPage: string }> => {
return new Promise((resolve, reject) => {
const requestOptions: https.RequestOptions = {
method: 'GET',
Expand Down Expand Up @@ -73,8 +73,8 @@ const createContributorsList = (contributors: Contributor[]) => {
return `<li title="${c.login}"><img src="${c.avatar_url}" alt="${c.login}"/></li>`;
}).join('\n');

const htmlDoctype = `<!DOCTYPE html>`;
const styling = `<link rel="stylesheet" href="contributors.css">`;
const htmlDoctype = '<!DOCTYPE html>';
const styling = '<link rel="stylesheet" href="contributors.css">';
const generatedHtml = `${htmlDoctype}${styling}<ul>${list}</ul>`;

const outputPath = path.join(__dirname, 'contributors.html');
Expand All @@ -94,15 +94,15 @@ const init = async () => {
}

if (contributorsList.length > 0) {
console.log('> Material Icon Theme:', painter.green(`Successfully fetched all contributors from GitHub!`));
console.log('> Material Icon Theme:', painter.green('Successfully fetched all contributors from GitHub!'));
} else {
console.log('> Material Icon Theme:', painter.red(`Error: Could not fetch contributors from GitHub!`));
console.log('> Material Icon Theme:', painter.red('Error: Could not fetch contributors from GitHub!'));
throw Error();
}
const outputPath = createContributorsList(contributorsList);

// create the image
console.log('> Material Icon Theme:', painter.yellow(`Creating image...`));
console.log('> Material Icon Theme:', painter.yellow('Creating image...'));
const fileName = 'contributors';
createScreenshot(outputPath, fileName).then(() => {
console.log('> Material Icon Theme:', painter.green(`Successfully created ${fileName} image!`));
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/icons/checks/checkIconAvailability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const handleErrors = () => {
if (amountOfErrors > 0) {
console.log('> Material Icon Theme:', painter.red(`Found ${amountOfErrors} error(s) in the icon configuration!`));
} else {
console.log('> Material Icon Theme:', painter.green(`Passed icon availability checks!`));
console.log('> Material Icon Theme:', painter.green('Passed icon availability checks!'));
}
logIconInformation(wrongIconNames.fileIcons, 'File icons');
logIconInformation(wrongIconNames.folderIcons, 'Folder icons');
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/icons/checks/checkIconConflicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const handleErrors = () => {
console.log('\n' + painter.red('Please check the wrong icon configurations!\n'));
process.exit(1);
} else {
console.log('> Material Icon Theme:', painter.green(`Passed icon conflict checks!`));
console.log('> Material Icon Theme:', painter.green('Passed icon conflict checks!'));
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/scripts/icons/checks/checkIconUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ const checkUsageOfAllIcons = () => {
const handleErrors = () => {
const amountOfUnusedIcons = Object.keys(availableIcons).length;
if (amountOfUnusedIcons === 0) {
console.log('> Material Icon Theme:', painter.green(`Passed icon usage checks!`));
console.log('> Material Icon Theme:', painter.green('Passed icon usage checks!'));
} else {
console.log(`> Material Icon Theme: ` + painter.red(`${amountOfUnusedIcons} unused icon(s):`));
console.log('> Material Icon Theme: ' + painter.red(`${amountOfUnusedIcons} unused icon(s):`));
Object.keys(availableIcons).forEach(icon => {
console.log(painter.red(`- ${availableIcons[icon]}`));
});
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as painter from './../helpers/painter';
import { toTitleCase } from './../helpers/titleCase';
import { createScreenshot } from '../helpers/screenshots';

const htmlDoctype = `<!DOCTYPE html>`;
const htmlDoctype = '<!DOCTYPE html>';
const cssFilePath = path.join('style.css');
const styling = `<link rel="stylesheet" href="${cssFilePath}">`;

Expand Down

0 comments on commit 970544c

Please sign in to comment.