Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit ea1ca0e

Browse files
committed
style(tslint): update @sourcegraph/tslint-config
1 parent dd0a3cc commit ea1ca0e

18 files changed

+836
-838
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
"devDependencies": {
5858
"@sourcegraph/tsconfig": "^1.0.0",
59-
"@sourcegraph/tslint-config": "^2.0.1",
59+
"@sourcegraph/tslint-config": "^6.0.0",
6060
"@types/chai": "^4.0.0",
6161
"@types/chai-as-promised": "^7.1.0",
6262
"@types/glob": "^5.0.30",

src/connection.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ export function registerLanguageHandler(
209209
id: message.params.id,
210210
error: {
211211
message: 'Request cancelled',
212-
code: ErrorCodes.RequestCancelled
213-
}
212+
code: ErrorCodes.RequestCancelled,
213+
},
214214
})
215215
return
216216
}
@@ -230,8 +230,8 @@ export function registerLanguageHandler(
230230
id: message.id,
231231
error: {
232232
code: ErrorCodes.MethodNotFound,
233-
message: `Method ${method} not implemented`
234-
}
233+
message: `Method ${method} not implemented`,
234+
},
235235
})
236236
} else {
237237
logger.warn(`Method ${method} not implemented`)
@@ -264,8 +264,8 @@ export function registerLanguageHandler(
264264
method: '$/partialResult',
265265
params: {
266266
id: message.id,
267-
patch: [patch]
268-
} as PartialResultParams
267+
patch: [patch],
268+
} as PartialResultParams,
269269
})
270270
}
271271
})
@@ -287,7 +287,7 @@ export function registerLanguageHandler(
287287
messageWriter.write({
288288
jsonrpc: '2.0',
289289
id: message.id,
290-
result
290+
result,
291291
})
292292
}, err => {
293293
// Set error on span
@@ -302,8 +302,8 @@ export function registerLanguageHandler(
302302
error: {
303303
message: err.message + '',
304304
code: typeof err.code === 'number' ? err.code : ErrorCodes.UnknownErrorCode,
305-
data: omit(err, ['message', 'code'])
306-
}
305+
data: omit(err, ['message', 'code']),
306+
},
307307
})
308308
})
309309
// Save subscription for $/cancelRequest

src/diagnostics.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ export function convertTsDiagnostic(diagnostic: ts.Diagnostic): Diagnostic {
1010
if (diagnostic.file && diagnostic.start && diagnostic.length) {
1111
range = {
1212
start: diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start),
13-
end: diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start + diagnostic.length)
13+
end: diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start + diagnostic.length),
1414
}
1515
}
1616
return {
1717
range,
1818
message: text,
1919
severity: convertDiagnosticCategory(diagnostic.category),
2020
code: diagnostic.code,
21-
source: diagnostic.source || 'ts'
21+
source: diagnostic.source || 'ts',
2222
}
2323
}
2424

src/fs.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class LocalFileSystem implements FileSystem {
7575
cwd,
7676
nodir: true,
7777
matchBase: true,
78-
follow: true
78+
follow: true,
7979
})
8080
globber.on('match', (file: string) => {
8181
subscriber.next(normalizeUri(base + file))
@@ -189,9 +189,8 @@ export class FileSystemUpdater {
189189
* @param span An OpenTracing span for tracing
190190
*/
191191
public ensureStructure(childOf = new Span()): Observable<never> {
192-
return traceObservable('Ensure structure', childOf, span => {
193-
return this.structureFetch || this.fetchStructure(span)
194-
})
192+
return traceObservable('Ensure structure', childOf, span =>
193+
this.structureFetch || this.fetchStructure(span))
195194
}
196195

197196
/**

src/lang-handler.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import {
88
LogMessageParams,
99
PublishDiagnosticsParams,
1010
TextDocumentIdentifier,
11-
TextDocumentItem
11+
TextDocumentItem,
1212
} from 'vscode-languageserver'
1313
import { HasMeta } from './connection'
1414
import { MessageEmitter, MessageWriter } from './connection'
1515
import {
1616
CacheGetParams,
1717
CacheSetParams,
1818
TextDocumentContentParams,
19-
WorkspaceFilesParams
19+
WorkspaceFilesParams,
2020
} from './request-type'
2121
import { traceObservable } from './tracing'
2222

src/language-server-stdio.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const options: TypeScriptServiceOptions & MessageLogOptions & RegisterLanguageHa
2626
strict: program.strict,
2727
logMessages: program.trace,
2828
logger,
29-
tracer
29+
tracer,
3030
}
3131

3232
const messageEmitter = new MessageEmitter(process.stdin, options)

src/language-server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const options: ServeOptions & TypeScriptServiceOptions = {
2727
strict: program.strict,
2828
logMessages: program.trace,
2929
logger: program.logfile ? new FileLogger(program.logfile) : new StdioLogger(),
30-
tracer: program.enableJaeger ? initTracer({ serviceName: 'javascript-typescript-langserver', sampler: { type: 'const', param: 1 } }) : new Tracer()
30+
tracer: program.enableJaeger ? initTracer({ serviceName: 'javascript-typescript-langserver', sampler: { type: 'const', param: 1 } }) : new Tracer(),
3131
}
3232

3333
serve(options, client => new TypeScriptService(client, options))

src/packages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const DEPENDENCY_KEYS: ReadonlyArray<
4242
'dependencies',
4343
'devDependencies',
4444
'peerDependencies',
45-
'optionalDependencies'
45+
'optionalDependencies',
4646
]
4747

4848
/**

src/project-manager.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
observableFromIterable,
2222
path2uri,
2323
toUnixPath,
24-
uri2path
24+
uri2path,
2525
} from './util'
2626

2727
const LAST_FORWARD_OR_BACKWARD_SLASH = /[\\\/][^\\\/]*$/
@@ -389,7 +389,7 @@ export class ProjectConfiguration {
389389
project: { projectService: { logger: this.logger }}, // TODO: may need more support
390390
languageService: this.getService(),
391391
languageServiceHost: this.getHost(),
392-
serverHost: {} // TODO: may need an adapter
392+
serverHost: {}, // TODO: may need an adapter
393393
}
394394

395395
const pluginModule = pluginModuleFactory({ typescript: ts })
@@ -512,7 +512,7 @@ export class ProjectManager implements Disposable {
512512
*/
513513
private configs = {
514514
js: new Map<string, ProjectConfiguration>(),
515-
ts: new Map<string, ProjectConfiguration>()
515+
ts: new Map<string, ProjectConfiguration>(),
516516
}
517517

518518
/**
@@ -606,9 +606,9 @@ export class ProjectManager implements Disposable {
606606
compilerOptions: {
607607
module: ts.ModuleKind.CommonJS,
608608
allowNonTsExtensions: false,
609-
allowJs: configType === 'js'
609+
allowJs: configType === 'js',
610610
},
611-
include: { js: ['**/*.js', '**/*.jsx'], ts: ['**/*.ts', '**/*.tsx'] }[configType]
611+
include: { js: ['**/*.js', '**/*.jsx'], ts: ['**/*.ts', '**/*.tsx'] }[configType],
612612
}
613613
const config = new ProjectConfiguration(
614614
this.inMemoryFs,

src/symbols.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function definitionInfoToSymbolDescriptor(info: ts.DefinitionInfo, rootPa
1515
name: info.name || '',
1616
containerKind: info.containerKind || '',
1717
containerName: info.containerName || '',
18-
filePath: info.fileName
18+
filePath: info.fileName,
1919
}
2020
// If the symbol is an external module representing a file, set name to the file path
2121
if (info.kind === ts.ScriptElementKind.moduleElement && info.name && /[\\\/]/.test(info.name)) {
@@ -59,9 +59,9 @@ export function navigateToItemToSymbolInformation(item: ts.NavigateToItem, progr
5959
uri: locationUri(sourceFile.fileName),
6060
range: {
6161
start: ts.getLineAndCharacterOfPosition(sourceFile, item.textSpan.start),
62-
end: ts.getLineAndCharacterOfPosition(sourceFile, item.textSpan.start + item.textSpan.length)
63-
}
64-
}
62+
end: ts.getLineAndCharacterOfPosition(sourceFile, item.textSpan.start + item.textSpan.length),
63+
},
64+
},
6565
}
6666
if (item.containerName) {
6767
symbolInformation.containerName = item.containerName.replace(rootPath, '')
@@ -125,9 +125,9 @@ export function navigationTreeToSymbolInformation(tree: ts.NavigationTree, paren
125125
uri: locationUri(sourceFile.fileName),
126126
range: {
127127
start: ts.getLineAndCharacterOfPosition(sourceFile, span.start),
128-
end: ts.getLineAndCharacterOfPosition(sourceFile, span.start + span.length)
129-
}
130-
}
128+
end: ts.getLineAndCharacterOfPosition(sourceFile, span.start + span.length),
129+
},
130+
},
131131
}
132132
if (parent && navigationTreeIsSymbol(parent) && parent.text) {
133133
symbolInformation.containerName = parent.text.replace(rootPath, '')
@@ -144,7 +144,7 @@ export function navigationTreeToSymbolDescriptor(tree: ts.NavigationTree, parent
144144
name: tree.text ? tree.text.replace(rootPath, '') : '',
145145
containerKind: '',
146146
containerName: '',
147-
filePath
147+
filePath,
148148
}
149149
if (parent && navigationTreeIsSymbol(parent)) {
150150
symbolDescriptor.containerKind = parent.kind

0 commit comments

Comments
 (0)