Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
configFileName: string | null
): Promise {
trace('getConfiguration for' + uri)
let config = configCache.get(filePath)
if (config) {
return config
}
let isDefaultConfig = false
let linterConfiguration: tslint.Configuration.IConfigurationFile | undefined
let linter = getLinterFromLibrary(library)
if (isTsLintVersion4(library)) {
if (linter.findConfigurationPath) {
isDefaultConfig = Linter.findConfigurationPath(configFileName, filePath) === undefined
}
let configurationResult = Linter.findConfiguration(configFileName, filePath)
// between tslint 4.0.1 and tslint 4.0.2 the attribute 'error' has been removed from IConfigurationLoadResult
// in 4.0.2 findConfiguration throws an exception as in version ^3.0.0
if ((configurationResult as any).error) {
throw (configurationResult as any).error
}
linterConfiguration = configurationResult.results
} else {
// prior to tslint 4.0 the findconfiguration functions where attached to the linter function
if (linter.findConfigurationPath) {
isDefaultConfig =
linter.findConfigurationPath(configFileName, filePath) === undefined
}
linterConfiguration = linter.findConfiguration(
configFileName,
tsconfig: string
): Promise {
trace('getConfiguration for' + uri)
let config = configCache.get(filePath)
if (config) {
return config
}
let isDefaultConfig = false
let linterConfiguration: tslint.Configuration.IConfigurationFile | undefined
let linter = getLinterFromLibrary(library)
if (isTsLintVersion4(library)) {
if (linter.findConfigurationPath) {
isDefaultConfig = Linter.findConfigurationPath(configFileName, filePath) === undefined
}
let configurationResult = Linter.findConfiguration(configFileName, filePath)
// between tslint 4.0.1 and tslint 4.0.2 the attribute 'error' has been removed from IConfigurationLoadResult
// in 4.0.2 findConfiguration throws an exception as in version ^3.0.0
if ((configurationResult as any).error) {
throw (configurationResult as any).error
}
linterConfiguration = configurationResult.results
} else {
// prior to tslint 4.0 the findconfiguration functions where attached to the linter function
if (linter.findConfigurationPath) {
isDefaultConfig =
linter.findConfigurationPath(configFileName, filePath) === undefined
}
linterConfiguration = linter.findConfiguration(
configFileName,
async function getConfigFile(uri?: string): Promise {
let dir: string
if (uri) {
let file = Uri.parse(uri).fsPath
if (file) dir = path.dirname(file)
}
dir = dir || await baseDir()
return Linter.findConfigurationPath(null, dir)
}