From e8475ad59fc7b9a669c30453be56b222725d9981 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 3 Oct 2018 15:52:36 -0700 Subject: [PATCH] Enable noUnusedParameters in build scripts --- build/lib/bundle.js | 6 +++--- build/lib/bundle.ts | 6 +++--- build/lib/i18n.js | 8 ++++---- build/lib/i18n.ts | 8 ++++---- build/lib/treeshaking.js | 6 +++--- build/lib/treeshaking.ts | 6 +++--- build/monaco/api.js | 6 +++--- build/monaco/api.ts | 6 +++--- build/tfs/common/symbols.ts | 2 +- build/tsconfig.json | 3 ++- 10 files changed, 29 insertions(+), 28 deletions(-) diff --git a/build/lib/bundle.js b/build/lib/bundle.js index 16139b310b6..d479d0b8c47 100644 --- a/build/lib/bundle.js +++ b/build/lib/bundle.js @@ -153,7 +153,7 @@ function extractStrings(destFiles) { deps: deps }; }; - destFiles.forEach(function (destFile, index) { + destFiles.forEach(function (destFile) { if (!/\.js$/.test(destFile.dest)) { return; } @@ -291,7 +291,7 @@ function emitEntryPoint(modulesMap, deps, entryPoint, includedModules, prepend, mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents)); } else { - mainResult.sources.push(emitNamedModule(c, deps[c], module.defineLocation, module.path, contents)); + mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents)); } }); Object.keys(usedPlugins).forEach(function (pluginName) { @@ -357,7 +357,7 @@ function emitPlugin(entryPoint, plugin, pluginName, moduleName) { contents: result }; } -function emitNamedModule(moduleId, myDeps, defineCallPosition, path, contents) { +function emitNamedModule(moduleId, defineCallPosition, path, contents) { // `defineCallPosition` is the position in code: |define() var defineCallOffset = positionToOffset(contents, defineCallPosition.line, defineCallPosition.col); // `parensOffset` is the position in code: define|() diff --git a/build/lib/bundle.ts b/build/lib/bundle.ts index 3b899ae8656..bef7f9f9ce1 100644 --- a/build/lib/bundle.ts +++ b/build/lib/bundle.ts @@ -267,7 +267,7 @@ function extractStrings(destFiles: IConcatFile[]): IConcatFile[] { }; }; - destFiles.forEach((destFile, index) => { + destFiles.forEach((destFile) => { if (!/\.js$/.test(destFile.dest)) { return; } @@ -438,7 +438,7 @@ function emitEntryPoint( if (module.shim) { mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents)); } else { - mainResult.sources.push(emitNamedModule(c, deps[c], module.defineLocation, module.path, contents)); + mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents)); } }); @@ -513,7 +513,7 @@ function emitPlugin(entryPoint: string, plugin: ILoaderPlugin, pluginName: strin }; } -function emitNamedModule(moduleId: string, myDeps: string[], defineCallPosition: IPosition, path: string, contents: string): IFile { +function emitNamedModule(moduleId: string, defineCallPosition: IPosition, path: string, contents: string): IFile { // `defineCallPosition` is the position in code: |define() let defineCallOffset = positionToOffset(contents, defineCallPosition.line, defineCallPosition.col); diff --git a/build/lib/i18n.js b/build/lib/i18n.js index 1f1859590ea..976e9998e24 100644 --- a/build/lib/i18n.js +++ b/build/lib/i18n.js @@ -187,10 +187,10 @@ var XLF = /** @class */ (function () { this.buffer.push(line.toString()); }; XLF.parsePseudo = function (xlfString) { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve) { var parser = new xml2js.Parser(); var files = []; - parser.parseString(xlfString, function (err, result) { + parser.parseString(xlfString, function (_err, result) { var fileNodes = result['xliff']['file']; fileNodes.forEach(function (file) { var originalFilePath = file.$.original; @@ -301,7 +301,7 @@ function stripComments(content) { * Fourth matches line comments */ var regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; - var result = content.replace(regexp, function (match, m1, m2, m3, m4) { + var result = content.replace(regexp, function (match, _m1, _m2, m3, m4) { // Only one of m1, m2, m3, m4 matches if (m3) { // A block comment. Replace with nothing @@ -834,7 +834,7 @@ function tryGetResource(project, slug, apiHostname, credentials) { }); } function createResource(project, slug, xlfFile, apiHostname, credentials) { - return new Promise(function (resolve, reject) { + return new Promise(function (_resolve, reject) { var data = JSON.stringify({ 'content': xlfFile.contents.toString(), 'name': slug, diff --git a/build/lib/i18n.ts b/build/lib/i18n.ts index b70fd7cd9dc..f0cf65d11c5 100644 --- a/build/lib/i18n.ts +++ b/build/lib/i18n.ts @@ -265,10 +265,10 @@ export class XLF { } static parsePseudo = function (xlfString: string): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { let parser = new xml2js.Parser(); let files: { messages: Map, originalFilePath: string, language: string }[] = []; - parser.parseString(xlfString, function (err: any, result: any) { + parser.parseString(xlfString, function (_err: any, result: any) { const fileNodes: any[] = result['xliff']['file']; fileNodes.forEach(file => { const originalFilePath = file.$.original; @@ -399,7 +399,7 @@ function stripComments(content: string): string { * Fourth matches line comments */ var regexp: RegExp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g; - let result = content.replace(regexp, (match, m1, m2, m3, m4) => { + let result = content.replace(regexp, (match, _m1, _m2, m3, m4) => { // Only one of m1, m2, m3, m4 matches if (m3) { // A block comment. Replace with nothing @@ -934,7 +934,7 @@ function tryGetResource(project: string, slug: string, apiHostname: string, cred } function createResource(project: string, slug: string, xlfFile: File, apiHostname: string, credentials: any): Promise { - return new Promise((resolve, reject) => { + return new Promise((_resolve, reject) => { const data = JSON.stringify({ 'content': xlfFile.contents.toString(), 'name': slug, diff --git a/build/lib/treeshaking.js b/build/lib/treeshaking.js index bafe28df511..ca1f2156047 100644 --- a/build/lib/treeshaking.js +++ b/build/lib/treeshaking.js @@ -103,7 +103,7 @@ var TypeScriptLanguageServiceHost = /** @class */ (function () { .concat(Object.keys(this._libs)) .concat(Object.keys(this._files))); }; - TypeScriptLanguageServiceHost.prototype.getScriptVersion = function (fileName) { + TypeScriptLanguageServiceHost.prototype.getScriptVersion = function (_fileName) { return '1'; }; TypeScriptLanguageServiceHost.prototype.getProjectVersion = function () { @@ -120,13 +120,13 @@ var TypeScriptLanguageServiceHost = /** @class */ (function () { return ts.ScriptSnapshot.fromString(''); } }; - TypeScriptLanguageServiceHost.prototype.getScriptKind = function (fileName) { + TypeScriptLanguageServiceHost.prototype.getScriptKind = function (_fileName) { return ts.ScriptKind.TS; }; TypeScriptLanguageServiceHost.prototype.getCurrentDirectory = function () { return ''; }; - TypeScriptLanguageServiceHost.prototype.getDefaultLibFileName = function (options) { + TypeScriptLanguageServiceHost.prototype.getDefaultLibFileName = function (_options) { return 'defaultLib:lib.d.ts'; }; TypeScriptLanguageServiceHost.prototype.isDefaultLibFileName = function (fileName) { diff --git a/build/lib/treeshaking.ts b/build/lib/treeshaking.ts index 395699e328e..13c74c086f0 100644 --- a/build/lib/treeshaking.ts +++ b/build/lib/treeshaking.ts @@ -172,7 +172,7 @@ class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost { .concat(Object.keys(this._files)) ); } - getScriptVersion(fileName: string): string { + getScriptVersion(_fileName: string): string { return '1'; } getProjectVersion(): string { @@ -187,13 +187,13 @@ class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost { return ts.ScriptSnapshot.fromString(''); } } - getScriptKind(fileName: string): ts.ScriptKind { + getScriptKind(_fileName: string): ts.ScriptKind { return ts.ScriptKind.TS; } getCurrentDirectory(): string { return ''; } - getDefaultLibFileName(options: ts.CompilerOptions): string { + getDefaultLibFileName(_options: ts.CompilerOptions): string { return 'defaultLib:lib.d.ts'; } isDefaultLibFileName(fileName: string): boolean { diff --git a/build/monaco/api.js b/build/monaco/api.js index 984fcbc19b6..1cdac079ea5 100644 --- a/build/monaco/api.js +++ b/build/monaco/api.js @@ -399,7 +399,7 @@ var TypeScriptLanguageServiceHost = /** @class */ (function () { .concat(Object.keys(this._libs)) .concat(Object.keys(this._files))); }; - TypeScriptLanguageServiceHost.prototype.getScriptVersion = function (fileName) { + TypeScriptLanguageServiceHost.prototype.getScriptVersion = function (_fileName) { return '1'; }; TypeScriptLanguageServiceHost.prototype.getProjectVersion = function () { @@ -416,13 +416,13 @@ var TypeScriptLanguageServiceHost = /** @class */ (function () { return ts.ScriptSnapshot.fromString(''); } }; - TypeScriptLanguageServiceHost.prototype.getScriptKind = function (fileName) { + TypeScriptLanguageServiceHost.prototype.getScriptKind = function (_fileName) { return ts.ScriptKind.TS; }; TypeScriptLanguageServiceHost.prototype.getCurrentDirectory = function () { return ''; }; - TypeScriptLanguageServiceHost.prototype.getDefaultLibFileName = function (options) { + TypeScriptLanguageServiceHost.prototype.getDefaultLibFileName = function (_options) { return 'defaultLib:es5'; }; TypeScriptLanguageServiceHost.prototype.isDefaultLibFileName = function (fileName) { diff --git a/build/monaco/api.ts b/build/monaco/api.ts index dd88207a0d6..d1ec16dadb0 100644 --- a/build/monaco/api.ts +++ b/build/monaco/api.ts @@ -484,7 +484,7 @@ class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost { .concat(Object.keys(this._files)) ); } - getScriptVersion(fileName: string): string { + getScriptVersion(_fileName: string): string { return '1'; } getProjectVersion(): string { @@ -499,13 +499,13 @@ class TypeScriptLanguageServiceHost implements ts.LanguageServiceHost { return ts.ScriptSnapshot.fromString(''); } } - getScriptKind(fileName: string): ts.ScriptKind { + getScriptKind(_fileName: string): ts.ScriptKind { return ts.ScriptKind.TS; } getCurrentDirectory(): string { return ''; } - getDefaultLibFileName(options: ts.CompilerOptions): string { + getDefaultLibFileName(_options: ts.CompilerOptions): string { return 'defaultLib:es5'; } isDefaultLibFileName(fileName: string): boolean { diff --git a/build/tfs/common/symbols.ts b/build/tfs/common/symbols.ts index 385ab6fdb59..1a5125295f3 100644 --- a/build/tfs/common/symbols.ts +++ b/build/tfs/common/symbols.ts @@ -97,7 +97,7 @@ function updateVersion(accessor: IVersionAccessor, symbolsPath: string) { function asyncRequest(options: request.UrlOptions & request.CoreOptions): Promise { return new Promise((resolve, reject) => { - request(options, (error, response, body) => { + request(options, (error, _response, body) => { if (error) { reject(error); } else { diff --git a/build/tsconfig.json b/build/tsconfig.json index 8d0b6feaa78..96cba77c0b0 100644 --- a/build/tsconfig.json +++ b/build/tsconfig.json @@ -13,7 +13,8 @@ "allowJs": true, "checkJs": true, "strict": true, - "noUnusedLocals": true + "noUnusedLocals": true, + "noUnusedParameters": true }, "exclude": [ "node_modules/**" -- GitLab