How to use the tslint.Linter.findConfigurationPath function in tslint

To help you get started, we’ve selected a few tslint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neoclide / coc.nvim / src / extensions / tslint / server / tslintServer.ts View on Github external
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,
github neoclide / coc-tslint / server / index.ts View on Github external
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,
github neoclide / coc-tslint / src / index.ts View on Github external
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)
}