microsoft-typescript/only-arrow-functions

This commit is contained in:
Alexander T 2019-06-20 12:46:02 +03:00
parent 67e20fc87a
commit 0e14b4e030
6 changed files with 13 additions and 10 deletions

View File

@ -53,7 +53,10 @@
"microsoft-typescript/object-literal-surrounding-space": "error",
"microsoft-typescript/no-type-assertion-whitespace": "error",
"microsoft-typescript/type-operator-spacing": "error",
"microsoft-typescript/only-arrow-functions": "off",
"microsoft-typescript/only-arrow-functions": ["error", {
"allowNamedFunctions": true ,
"allowDeclarations": true
}],
"microsoft-typescript/no-double-space": "error",
"microsoft-typescript/boolean-trivia": "error",
"microsoft-typescript/no-in-operator": "off",

View File

@ -100,18 +100,18 @@ function sortAuthors(a: string, b: string) {
}
namespace Commands {
export const writeAuthors: Command = function () {
export const writeAuthors: Command = () => {
const output = deduplicate(getKnownAuthors().map(getAuthorName).filter(a => !!a)).sort(sortAuthors).join("\r\n* ");
fs.writeFileSync(authorsPath, "TypeScript is authored by:\r\n* " + output);
};
writeAuthors.description = "Write known authors to AUTHORS.md file.";
export const listKnownAuthors: Command = function () {
export const listKnownAuthors: Command = () => {
deduplicate(getKnownAuthors().map(getAuthorName)).filter(a => !!a).sort(sortAuthors).forEach(log);
};
listKnownAuthors.description = "List known authors as listed in .mailmap file.";
export const listAuthors: Command = function (...specs: string[]) {
export const listAuthors: Command = (...specs: string[]) => {
const cmd = "git shortlog -se " + specs.join(" ");
console.log(cmd);
const outputRegExp = /\d+\s+([^<]+)<([^>]+)>/;
@ -137,7 +137,7 @@ namespace Commands {
const maps = getKnownAuthorMaps();
const lookupAuthor = function ({name, email}: { name: string, email: string }) {
const lookupAuthor = ({name, email}: { name: string, email: string }) => {
return maps.authorsByEmail[email.toLocaleLowerCase()] || maps.authorsByName[name];
};

View File

@ -116,7 +116,7 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini
.filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory())
.forEach(d => {
const directoryPath = path.join(definitelyTypedRoot, d);
fs.readdir(directoryPath, function (err, files) {
fs.readdir(directoryPath, (err, files) => {
if (err) {
throw err;
}

View File

@ -130,7 +130,7 @@ namespace Word {
}
}
const sys = (function () {
const sys = (() => {
const fileStream = new ActiveXObject("ADODB.Stream");
fileStream.Type = 2 /* text */;
const binaryStream = new ActiveXObject("ADODB.Stream");

View File

@ -5,7 +5,7 @@ namespace Harness.LanguageService {
const proxy = Object.create(/*prototype*/ null);
const langSvc: any = info.languageService;
for (const k of Object.keys(langSvc)) {
// tslint:disable-next-line only-arrow-functions
// eslint-disable-next-line microsoft-typescript/only-arrow-functions
proxy[k] = function () {
return langSvc[k].apply(langSvc, arguments);
};
@ -800,7 +800,7 @@ namespace Harness.LanguageService {
create(info: ts.server.PluginCreateInfo) {
const proxy = makeDefaultProxy(info);
const langSvc: any = info.languageService;
// tslint:disable-next-line only-arrow-functions
// eslint-disable-next-line microsoft-typescript/only-arrow-functions
proxy.getQuickInfoAtPosition = function () {
const parts = langSvc.getQuickInfoAtPosition.apply(langSvc, arguments);
if (parts.displayParts.length > 0) {

View File

@ -363,7 +363,7 @@ namespace Playback {
function recordReplay<T extends ts.AnyFunction>(original: T, underlying: any) {
function createWrapper(record: T, replay: T): T {
// tslint:disable-next-line only-arrow-functions
// eslint-disable-next-line microsoft-typescript/only-arrow-functions
return <any>(function () {
if (replayLog !== undefined) {
return replay.apply(undefined, arguments);