Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Fix formatting of 2 files for commit 770e218 #71

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions scripts/update-languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function convertGitHubLanguageToUnibeautify(
group: language.group,
liguistLanguageId: language.language_id,
name: languageName,
textMateScope: language.tm_scope
textMateScope: language.tm_scope,
};
})
.value();
Expand Down Expand Up @@ -104,8 +104,10 @@ function mergeLanguage(
aceMode: getString("aceMode", baseLanguage, newLanguage),
aliases: getArray("aliases", baseLanguage, newLanguage),
atomGrammars: getArray("atomGrammars", baseLanguage, newLanguage),
codeMirrorMimeType: getString("codeMirrorMimeType", baseLanguage, newLanguage) || undefined,
codeMirrorMode: getString("codeMirrorMode", baseLanguage, newLanguage) || undefined,
codeMirrorMimeType:
getString("codeMirrorMimeType", baseLanguage, newLanguage) || undefined,
codeMirrorMode:
getString("codeMirrorMode", baseLanguage, newLanguage) || undefined,
extensions: getArray("extensions", baseLanguage, newLanguage),
fileNames: getArray("fileNames", baseLanguage, newLanguage),
group: getString("group", baseLanguage, newLanguage) || undefined,
Expand All @@ -118,7 +120,8 @@ function mergeLanguage(
namespace: getString("namespace", baseLanguage, newLanguage),
since: getString("since", baseLanguage, newLanguage) || nextMinorVersion,
sublimeSyntaxes: getArray("sublimeSyntaxes", baseLanguage, newLanguage),
textMateScope: getString("textMateScope", baseLanguage, newLanguage) || undefined,
textMateScope:
getString("textMateScope", baseLanguage, newLanguage) || undefined,
vscodeLanguages: getArray("vscodeLanguages", baseLanguage, newLanguage),
};
}
Expand Down
46 changes: 22 additions & 24 deletions src/beautifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import * as _ from "lodash";
import { Language } from "./language";
import { OptionsRegistry } from "./options";
import { InlineFlagManager } from "./InlineFlagManager";
import {
DependencyOptions,
DependencyManager
} from "./DependencyManager";
import { DependencyOptions, DependencyManager } from "./DependencyManager";

/**
New name to rename the option (key) to.
Expand Down Expand Up @@ -205,7 +202,7 @@ export class Unibeautify {
this.doesBeautifierSupportOptionForLanguage({
beautifier,
language,
optionName
optionName,
})
) !== -1
);
Expand All @@ -220,8 +217,8 @@ export class Unibeautify {
...options,
...this.getOptionsSupportedByBeautifierForLanguage({
beautifier,
language
})
language,
}),
}),
{}
);
Expand All @@ -232,7 +229,7 @@ export class Unibeautify {
*/
public getOptionsSupportedByBeautifierForLanguage({
beautifier,
language
language,
}: {
beautifier: Beautifier;
language: Language;
Expand All @@ -246,7 +243,7 @@ export class Unibeautify {
}
return {
...options,
[key]: option
[key]: option,
};
}, {});
}
Expand Down Expand Up @@ -275,7 +272,7 @@ export class Unibeautify {

const {
selectedBeautifiers,
missingBeautifierName
missingBeautifierName,
} = this.beautifiersForLanguageAndOptions(lang, langOptions);
if (selectedBeautifiers.length === 0) {
return Promise.reject(
Expand All @@ -294,7 +291,7 @@ export class Unibeautify {
langOptions,
language: lang,
projectPath: data.projectPath,
text: data.text
text: data.text,
});
}

Expand All @@ -308,7 +305,7 @@ export class Unibeautify {
atomGrammar: data.atomGrammar,
extension: data.fileExtension,
name: data.languageName,
sublimeSyntax: data.sublimeSyntax
sublimeSyntax: data.sublimeSyntax,
});
return langs.length > 0 ? langs[0] : null;
}
Expand All @@ -334,7 +331,7 @@ export class Unibeautify {
.find(curr => !!curr);
return {
missingBeautifierName,
selectedBeautifiers
selectedBeautifiers,
};
}

Expand All @@ -358,7 +355,7 @@ export class Unibeautify {
langOptions,
fileExtension,
projectPath,
text
text,
}: {
beautifiers: BeautifierInternal[];
language: Language;
Expand All @@ -368,10 +365,7 @@ export class Unibeautify {
projectPath: BeautifyData["projectPath"];
}): Promise<string> {
return beautifiers.reduce(
(
promise: Promise<string>,
beautifier: BeautifierInternal,
) => {
(promise: Promise<string>, beautifier: BeautifierInternal) => {
const options: OptionValues = Unibeautify.getOptionsForBeautifier(
beautifier,
language,
Expand All @@ -388,7 +382,7 @@ export class Unibeautify {
options,
projectPath: projectPath,
Promise,
text: currentText
text: currentText,
})
.then(newText => {
const manager = new InlineFlagManager(currentText, newText);
Expand Down Expand Up @@ -526,7 +520,7 @@ export class Unibeautify {
this.doesBeautifierSupportOptionForLanguage({
beautifier,
language,
optionName
optionName,
})
) !== -1
);
Expand All @@ -538,7 +532,7 @@ export class Unibeautify {
public doesBeautifierSupportOptionForLanguage({
beautifier,
language,
optionName
optionName,
}: {
beautifier: Beautifier;
language: Language;
Expand Down Expand Up @@ -618,7 +612,9 @@ export class Unibeautify {
const obj = _.zipObject(fields, vals);
transformedOptions[fieldKey] = fn(obj);
} else {
return new Error(`Invalid option "${fieldKey}" with value ${JSON.stringify(op)}.`);
return new Error(
`Invalid option "${fieldKey}" with value ${JSON.stringify(op)}.`
);
}
});
return transformedOptions;
Expand Down Expand Up @@ -646,7 +642,7 @@ export class Unibeautify {
private internalBeautifier(beautifier: Beautifier): BeautifierInternal {
return {
...beautifier,
dependencyManager: new DependencyManager(beautifier.dependencies || [])
dependencyManager: new DependencyManager(beautifier.dependencies || []),
};
}

Expand Down Expand Up @@ -698,7 +694,9 @@ export function optionKeys(
} else if (isOptionTransform(op)) {
options.push(...op[0]);
} else {
return new Error(`Invalid option "${fieldKey}" with value ${JSON.stringify(op)}.`);
return new Error(
`Invalid option "${fieldKey}" with value ${JSON.stringify(op)}.`
);
}
});
return options;
Expand Down