@fimbul/wotan
Advanced tools
Comparing version 0.6.0-dev.20180321 to 0.6.0-dev.20180322
{ | ||
"name": "@fimbul/wotan", | ||
"version": "0.6.0-dev.20180321", | ||
"version": "0.6.0-dev.20180322", | ||
"description": "Pluggable TypeScript and JavaScript linter", | ||
@@ -48,4 +48,4 @@ "bin": "bin/main.js", | ||
"dependencies": { | ||
"@fimbul/mimir": "0.6.0-dev.20180321", | ||
"@fimbul/ymir": "0.6.0-dev.20180321", | ||
"@fimbul/mimir": "0.6.0-dev.20180322", | ||
"@fimbul/ymir": "0.6.0-dev.20180322", | ||
"bind-decorator": "^1.0.11", | ||
@@ -52,0 +52,0 @@ "chalk": "^2.3.0", |
import { Linter } from './linter'; | ||
import { LintResult, DirectoryService } from '@fimbul/ymir'; | ||
import { LintResult, DirectoryService, MessageHandler } from '@fimbul/ymir'; | ||
import * as ts from 'typescript'; | ||
@@ -21,3 +21,4 @@ import { ProcessorLoader } from './services/processor-loader'; | ||
private directories; | ||
constructor(fs: CachedFileSystem, configManager: ConfigurationManager, linter: Linter, processorLoader: ProcessorLoader, directories: DirectoryService); | ||
private logger; | ||
constructor(fs: CachedFileSystem, configManager: ConfigurationManager, linter: Linter, processorLoader: ProcessorLoader, directories: DirectoryService, logger: MessageHandler); | ||
lintCollection(options: LintOptions): LintResult; | ||
@@ -28,2 +29,3 @@ private lintProject(options, config); | ||
private checkConfigDirectory(fileOrDirName); | ||
private createProgram(configFile, host); | ||
} | ||
@@ -30,0 +32,0 @@ declare module 'typescript' { |
@@ -17,3 +17,3 @@ "use strict"; | ||
let Runner = class Runner { | ||
constructor(fs, configManager, linter, processorLoader, directories) { | ||
constructor(fs, configManager, linter, processorLoader, directories, logger) { | ||
this.fs = fs; | ||
@@ -24,2 +24,3 @@ this.configManager = configManager; | ||
this.directories = directories; | ||
this.logger = logger; | ||
} | ||
@@ -133,3 +134,3 @@ lintCollection(options) { | ||
} | ||
const program = createProgram(project, host); | ||
const program = this.createProgram(project, host); | ||
const files = []; | ||
@@ -180,2 +181,13 @@ const originalNames = []; | ||
} | ||
createProgram(configFile, host) { | ||
const config = ts.readConfigFile(configFile, (file) => host.readFile(file)); | ||
if (config.error !== undefined) { | ||
this.logger.warn(ts.formatDiagnostics([config.error], host)); | ||
config.config = {}; | ||
} | ||
const parsed = ts.parseJsonConfigFileContent(config.config, createParseConfigHost(host), path.dirname(configFile), { noEmit: true }, configFile); | ||
if (parsed.errors.length !== 0) | ||
this.logger.warn(ts.formatDiagnostics(parsed.errors, host)); | ||
return ts.createProgram(parsed.fileNames, parsed.options, host); | ||
} | ||
}; | ||
@@ -188,3 +200,4 @@ Runner = tslib_1.__decorate([ | ||
processor_loader_1.ProcessorLoader, | ||
ymir_1.DirectoryService]) | ||
ymir_1.DirectoryService, | ||
ymir_1.MessageHandler]) | ||
], Runner); | ||
@@ -232,14 +245,2 @@ exports.Runner = Runner; | ||
} | ||
function createProgram(configFile, host) { | ||
const config = ts.readConfigFile(configFile, (file) => host.readFile(file)); | ||
if (config.error !== undefined) | ||
throw new ymir_1.ConfigurationError(ts.formatDiagnostics([config.error], host)); | ||
const parsed = ts.parseJsonConfigFileContent(config.config, createParseConfigHost(host), path.dirname(configFile), { noEmit: true }, configFile); | ||
if (parsed.errors.length !== 0) { | ||
const errors = parsed.errors.filter((d) => d.code !== 18003); | ||
if (errors.length !== 0) | ||
throw new ymir_1.ConfigurationError(ts.formatDiagnostics(errors, host)); | ||
} | ||
return ts.createProgram(parsed.fileNames, parsed.options, host); | ||
} | ||
function createParseConfigHost(host) { | ||
@@ -246,0 +247,0 @@ return { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
255130
3128
+ Added@fimbul/mimir@0.6.0-dev.20180322(transitive)
+ Added@fimbul/ymir@0.6.0-dev.20180322(transitive)
- Removed@fimbul/mimir@0.6.0-dev.20180321(transitive)
- Removed@fimbul/ymir@0.6.0-dev.20180321(transitive)