New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fimbul/wotan

Package Overview
Dependencies
Maintainers
2
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/wotan - npm Package Compare versions

Comparing version

to
0.4.0-dev.20180306

src/services/default/builtin-resolver.d.ts

4

index.d.ts

@@ -1,4 +0,2 @@

import 'reflect-metadata';
export * from './src/types';
export * from './src/error';
export * from '@fimbul/ymir';
export * from './src/di/core.module';

@@ -5,0 +3,0 @@ export * from './src/di/default.module';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
require("reflect-metadata");
tslib_1.__exportStar(require("./src/types"), exports);
tslib_1.__exportStar(require("./src/error"), exports);
tslib_1.__exportStar(require("@fimbul/ymir"), exports);
tslib_1.__exportStar(require("./src/di/core.module"), exports);

@@ -8,0 +6,0 @@ tslib_1.__exportStar(require("./src/di/default.module"), exports);

{
"name": "@fimbul/wotan",
"version": "0.4.0-dev.20180305",
"version": "0.4.0-dev.20180306",
"description": "Pluggable TypeScript and JavaScript linter",

@@ -48,2 +48,4 @@ "bin": "bin/main.js",

"dependencies": {
"@fimbul/mimir": "0.4.0-dev.20180306",
"@fimbul/ymir": "0.4.0-dev.20180306",
"bind-decorator": "^1.0.11",

@@ -50,0 +52,0 @@ "chalk": "^2.3.0",

@@ -1,2 +0,2 @@

# wotan
# Wotan

@@ -43,26 +43,3 @@ Pluggable TypeScript and JavaScript linter

Rule | Description | Difference to TSLint rule / Why you should use it
---- | ---- | ----
`await-async-result` | Warns about not using the result of a call to an async function inside async functions. *requires type information* | TSLint's `no-floating-promises` requires you to specify a list of Promise names, it checks outside of async functions and only requires you to register the `onrejected` callback.
`await-only-promise` | Finds uses of `await` on non-Promise values. Also checks `for await` loops. *requires type information* | Works for all `PromiseLike` and `Thenable` types out of the box without any configuration.
`generator-require-yield` | Require at least one `yield` inside generator functions. | There's no similar TSLint rule.
`no-debugger` | Ban `debugger;` statements from your production code. | Performance!
`no-fallthrough` | Prevents unintentional fallthough in `switch` statements from one case to another. If the fallthrough is intended, add a comment that matches `/^\s*falls? ?through\b/i`. | Allows more comment variants such as `fallthrough` or `fall through`.
`no-inferred-empty-object` | Warns if a type parameter is inferred as `{}` because the compiler cannot find any inference site. | Really checks every type parameter of function, method and constructor calls. Correctly handles type parameters from JSDoc comments. Recognises type parameter defaults on all merged declarations.
`no-return-await` | Warns for unnecesary `return await foo;` when you can simply `return foo;` | The same as TSLint's rule. I wrote both, but this one is faster.
`no-unreachable-code` | Warns about statements that will never be executed. Works like TypeScript's dead code detection but doesn't fail compilation because it's a lint error. | TSLint removed their `no-unreachable` rule in v4.0.0.
`no-unsafe-finally` | Forbids control flow statements `return`, `throw`, `break` and `continue` inside the `finally` block of a try statement. | Performance!
`no-unstable-api-use` | Finds uses of deprecated and experimental variables, classes, properties, functions, signatures, ... *requires type information* | This rule checks element accesses (`foo[bar]`), JSX elements, chained function calls (`getFn()()`) in addition to what TSLint's `deprecation` rule does and has more useful error reporting.
`no-unused-expression` | Warns about side-effect free expressions whose value is not used | This one is a bit stricter than TSLint's `no-unused-expression` and checks `for` loops in addition.
`no-unused-label` | Warns about labels that are never used or at the wrong position. | TSLint only has `label-position` which doesn't check for unused labels.
`no-nan-compare` | Don't compare with `NaN`, use `isNaN(number)` or `Number.isNaN(number)` instead. | Performance!
`no-useless-assertion` | Detects type assertions that don't change the type or are not necessary in the first place. *requires type information* | TSLint's `no-unnecessary-type-assertion` does not detect assertions needed to silence the compiler warning `Variable ... is used before being assigned.` The Wotan builtin rule also checks whether the assertion is necessary at all or the receiver accepts the original type.
`no-useless-initializer` | Detects unnecessary initialization with `undefined`. | TSLint's rule `no-unnecessary-initializer` doesn't fix all parameter initializers and gives false positives for destructuring.
`prefer-dot-notation` | Prefer `obj.foo` over `obj['foo']` where possible. | Same as TSLint's `no-string-literal` rule, but more performant.
`prefer-number-isnan` | Prefer ES2015's `Number.isNaN` over the global `isNaN` mainly for performance. *requires type information* | No similar rule in TSLint.
`prefer-object-spread` | Prefer object spread over `Object.assign` for copying properties to a new object. *requires type information* | Performance, and better handling of parens in fixer and avoids false positives that would cause a compile error when fixed.
`syntaxcheck` | Reports syntax errors as lint errors. This rule is **not** enabled in `wotan:recommended`. *requires type information* | Used to be part of the deprecated `tslint --type-check`
`trailing-newline` | Requires a line break at the end of each file. | Nothing fancy here :(
`try-catch-return-await` | Companion of `no-return-await` because inside a try-catch block you should await returned promises to correctly enter the catch on rejection and/or the finally block after completion. | TSLint has no similar rule.
`typecheck` | TypeScript's compiler errors as lint errors. This rule is **not** enabled in `wotan:recommended`. *requires type information* | Like the deprecated `tslint --type-check` but formatted and can be disabled like any other rule.
For a list of available rules, see the [documentation of the `@fimbul/mimir` package](https://github.com/fimbullinter/wotan/blob/master/packages/mimir/README.md#rules).

@@ -69,0 +46,0 @@ ## Configuration

import { Command } from './commands';
import { GlobalOptions } from './types';
import { GlobalOptions } from '@fimbul/ymir';
import { LintOptions } from './runner';

@@ -4,0 +4,0 @@ export declare function parseArguments(args: string[], globalOptions?: GlobalOptions): Command;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const error_1 = require("./error");
const ymir_1 = require("@fimbul/ymir");
const debug = require("debug");

@@ -133,3 +133,3 @@ const log = debug('wotan:argparse');

if (arg.startsWith('-'))
throw new error_1.ConfigurationError(`Unknown option '${arg}'.`);
throw new ymir_1.ConfigurationError(`Unknown option '${arg}'.`);
result.files = files;

@@ -145,3 +145,3 @@ if (arg !== '')

else if (result.project !== undefined || result.files.length === 0) {
throw new error_1.ConfigurationError("Options '--ext' and '--project' cannot be used together.");
throw new ymir_1.ConfigurationError("Options '--ext' and '--project' cannot be used together.");
}

@@ -189,3 +189,3 @@ }

if (arg.startsWith('-'))
throw new error_1.ConfigurationError(`Unknown option '${arg}'.`);
throw new ymir_1.ConfigurationError(`Unknown option '${arg}'.`);
if (arg !== '')

@@ -196,3 +196,3 @@ result.files.push(arg);

if (result.files.length === 0)
throw new error_1.ConfigurationError('filename expected.');
throw new ymir_1.ConfigurationError('filename expected.');
return result;

@@ -227,3 +227,3 @@ }

if (arg.startsWith('-'))
throw new error_1.ConfigurationError(`Unknown option '${arg}'.`);
throw new ymir_1.ConfigurationError(`Unknown option '${arg}'.`);
if (arg !== '')

@@ -235,3 +235,3 @@ files.push(arg);

case 0:
throw new error_1.ConfigurationError('filename expected');
throw new ymir_1.ConfigurationError('filename expected');
case 1:

@@ -246,7 +246,7 @@ return {

default:
throw new error_1.ConfigurationError('more than one filename provided');
throw new ymir_1.ConfigurationError('more than one filename provided');
}
}
function parseValidateCommand(_args) {
throw new error_1.ConfigurationError("'validate' is not implemented yet.");
throw new ymir_1.ConfigurationError("'validate' is not implemented yet.");
}

@@ -293,3 +293,3 @@ function parseOptionalBooleanOrNumber(args, index) {

if (index === args.length)
throw new error_1.ConfigurationError(`Option '${opt}' expects an argument.`);
throw new ymir_1.ConfigurationError(`Option '${opt}' expects an argument.`);
return args[index];

@@ -301,4 +301,4 @@ }

function assertNever(_, message) {
throw new error_1.ConfigurationError(message);
throw new ymir_1.ConfigurationError(message);
}
//# sourceMappingURL=argparse.js.map

@@ -1,3 +0,3 @@

import { GlobalOptions } from './types';
import { GlobalOptions } from '@fimbul/ymir';
export declare function run(argv: string[]): Promise<void>;
export declare function loadConfig(dir: string): Promise<GlobalOptions>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const error_1 = require("./error");
const ymir_1 = require("@fimbul/ymir");
const fs = require("fs");

@@ -20,3 +20,3 @@ const path = require("path");

catch (e) {
console.error(e instanceof error_1.ConfigurationError ? e.message : e);
console.error(e instanceof ymir_1.ConfigurationError ? e.message : e);
process.exitCode = 1;

@@ -23,0 +23,0 @@ }

import 'reflect-metadata';
import { LintOptions } from './runner';
import { Format, GlobalOptions } from './types';
import { Format, GlobalOptions } from '@fimbul/ymir';
import { Container } from 'inversify';

@@ -5,0 +5,0 @@ export declare const enum CommandName {

@@ -7,4 +7,3 @@ "use strict";

const runner_1 = require("./runner");
const error_1 = require("./error");
const types_1 = require("./types");
const ymir_1 = require("@fimbul/ymir");
const utils_1 = require("./utils");

@@ -48,3 +47,3 @@ const chalk_1 = require("chalk");

container.bind(FakeDirectoryService).to(FakeDirectoryService);
container.bind(types_1.DirectoryService).toService(FakeDirectoryService);
container.bind(ymir_1.DirectoryService).toService(FakeDirectoryService);
break;

@@ -70,3 +69,3 @@ default:

catch (e) {
throw new error_1.ConfigurationError(e.message);
throw new ymir_1.ConfigurationError(e.message);
}

@@ -76,3 +75,3 @@ log("Found module at '%s'.", moduleName);

if (!m || typeof m.createModule !== 'function')
throw new error_1.ConfigurationError(`Module '${moduleName}' does not export a function 'createModule'.`);
throw new ymir_1.ConfigurationError(`Module '${moduleName}' does not export a function 'createModule'.`);
return m.createModule(options);

@@ -120,3 +119,3 @@ }

formatter_loader_1.FormatterLoader,
types_1.MessageHandler,
ymir_1.MessageHandler,
cached_file_system_1.CachedFileSystem])

@@ -156,5 +155,5 @@ ], LintCommandRunner);

tslib_1.__metadata("design:paramtypes", [cached_file_system_1.CachedFileSystem,
types_1.MessageHandler,
types_1.DirectoryService,
types_1.GlobalOptions])
ymir_1.MessageHandler,
ymir_1.DirectoryService,
ymir_1.GlobalOptions])
], SaveCommandRunner);

@@ -184,3 +183,3 @@ let ValidateCommandRunner = class ValidateCommandRunner extends AbstractCommandRunner {

if (config === undefined)
throw new error_1.ConfigurationError(`Could not find configuration for '${options.file}'.`);
throw new ymir_1.ConfigurationError(`Could not find configuration for '${options.file}'.`);
const reduced = this.configManager.reduce(config, options.file);

@@ -193,3 +192,3 @@ this.logger.log(`${config.filename}\n${reduced === undefined ? 'File is excluded.' : utils_1.format(reduced, options.format)}`);

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [configuration_manager_1.ConfigurationManager, types_1.MessageHandler])
tslib_1.__metadata("design:paramtypes", [configuration_manager_1.ConfigurationManager, ymir_1.MessageHandler])
], ShowCommandRunner);

@@ -223,3 +222,3 @@ let FakeDirectoryService = class FakeDirectoryService {

if (relative.startsWith('..' + path.sep))
throw new error_1.ConfigurationError(`Testing file '${file}' outside of '${root}'.`);
throw new ymir_1.ConfigurationError(`Testing file '${file}' outside of '${root}'.`);
const actual = test_1.createBaseline(summary);

@@ -314,3 +313,3 @@ const baselineFile = `${path.resolve(baselineDir, relative)}${kind === "lint" ? '.lint' : ''}`;

inversify_1.Container,
types_1.MessageHandler,
ymir_1.MessageHandler,
FakeDirectoryService])

@@ -317,0 +316,0 @@ ], TestCommandRunner);

import { ContainerModule } from 'inversify';
import { GlobalOptions } from '../types';
import { GlobalOptions } from '@fimbul/ymir';
export declare function createCoreModule(globalOptions: GlobalOptions): ContainerModule;

@@ -12,3 +12,3 @@ "use strict";

const test_1 = require("../test");
const types_1 = require("../types");
const ymir_1 = require("@fimbul/ymir");
function createCoreModule(globalOptions) {

@@ -25,3 +25,3 @@ return new inversify_1.ContainerModule((bind) => {

bind(inversify_1.Container).toDynamicValue((context) => context.container);
bind(types_1.GlobalOptions).toConstantValue(globalOptions);
bind(ymir_1.GlobalOptions).toConstantValue(globalOptions);
});

@@ -28,0 +28,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const inversify_1 = require("inversify");
const types_1 = require("../types");
const ymir_1 = require("@fimbul/ymir");
const formatter_loader_host_1 = require("../services/default/formatter-loader-host");

@@ -15,26 +15,29 @@ const rule_loader_host_1 = require("../services/default/rule-loader-host");

const line_switches_1 = require("../services/default/line-switches");
const builtin_resolver_1 = require("../services/default/builtin-resolver");
function createDefaultModule() {
return new inversify_1.ContainerModule((bind, _unbind, isBound) => {
if (!isBound(types_1.FormatterLoaderHost))
bind(types_1.FormatterLoaderHost).to(formatter_loader_host_1.NodeFormatterLoader);
if (!isBound(types_1.RuleLoaderHost))
bind(types_1.RuleLoaderHost).to(rule_loader_host_1.NodeRuleLoader);
if (!isBound(types_1.Resolver))
bind(types_1.Resolver).to(resolver_1.NodeResolver);
if (!isBound(types_1.CacheFactory))
bind(types_1.CacheFactory).to(cache_factory_1.DefaultCacheFactory);
if (!isBound(types_1.FileSystem))
bind(types_1.FileSystem).to(file_system_1.NodeFileSystem);
if (!isBound(types_1.MessageHandler))
bind(types_1.MessageHandler).to(message_handler_1.ConsoleMessageHandler);
if (!isBound(types_1.DeprecationHandler))
bind(types_1.DeprecationHandler).to(deprecation_handler_1.DefaultDeprecationHandler);
if (!isBound(types_1.DirectoryService))
bind(types_1.DirectoryService).to(directory_service_1.NodeDirectoryService);
if (!isBound(types_1.ConfigurationProvider))
bind(types_1.ConfigurationProvider).to(configuration_provider_1.DefaultConfigurationProvider);
if (!isBound(types_1.FailureFilterFactory))
bind(types_1.FailureFilterFactory).to(line_switches_1.LineSwitchFilterFactory);
if (!isBound(line_switches_1.LineSwitchParser))
bind(line_switches_1.LineSwitchParser).to(line_switches_1.DefaultLineSwitchParser);
if (!isBound(ymir_1.FormatterLoaderHost))
bind(ymir_1.FormatterLoaderHost).to(formatter_loader_host_1.NodeFormatterLoader);
if (!isBound(ymir_1.RuleLoaderHost))
bind(ymir_1.RuleLoaderHost).to(rule_loader_host_1.NodeRuleLoader);
if (!isBound(ymir_1.Resolver))
bind(ymir_1.Resolver).to(resolver_1.NodeResolver);
if (!isBound(ymir_1.CacheFactory))
bind(ymir_1.CacheFactory).to(cache_factory_1.DefaultCacheFactory);
if (!isBound(ymir_1.FileSystem))
bind(ymir_1.FileSystem).to(file_system_1.NodeFileSystem);
if (!isBound(ymir_1.MessageHandler))
bind(ymir_1.MessageHandler).to(message_handler_1.ConsoleMessageHandler);
if (!isBound(ymir_1.DeprecationHandler))
bind(ymir_1.DeprecationHandler).to(deprecation_handler_1.DefaultDeprecationHandler);
if (!isBound(ymir_1.DirectoryService))
bind(ymir_1.DirectoryService).to(directory_service_1.NodeDirectoryService);
if (!isBound(ymir_1.ConfigurationProvider))
bind(ymir_1.ConfigurationProvider).to(configuration_provider_1.DefaultConfigurationProvider);
if (!isBound(ymir_1.FailureFilterFactory))
bind(ymir_1.FailureFilterFactory).to(line_switches_1.LineSwitchFilterFactory);
if (!isBound(ymir_1.LineSwitchParser))
bind(ymir_1.LineSwitchParser).to(line_switches_1.DefaultLineSwitchParser);
if (!isBound(ymir_1.BuiltinResolver))
bind(ymir_1.BuiltinResolver).to(builtin_resolver_1.DefaultBuiltinResolver);
});

@@ -41,0 +44,0 @@ }

import * as ts from 'typescript';
import { Fix } from './types';
import { Fix } from '@fimbul/ymir';
export interface FixResult {

@@ -4,0 +4,0 @@ result: string;

import * as ts from 'typescript';
import { Failure, EffectiveConfiguration, LintAndFixFileResult, MessageHandler, AbstractProcessor, DeprecationHandler, FailureFilterFactory } from './types';
import { Failure, EffectiveConfiguration, LintAndFixFileResult, MessageHandler, AbstractProcessor, DeprecationHandler, FailureFilterFactory } from '@fimbul/ymir';
import { RuleLoader } from './services/rule-loader';

@@ -4,0 +4,0 @@ export interface UpdateFileResult {

@@ -5,3 +5,3 @@ "use strict";

const ts = require("typescript");
const types_1 = require("./types");
const ymir_1 = require("@fimbul/ymir");
const fix_1 = require("./fix");

@@ -145,7 +145,7 @@ const debug = require("debug");

tslib_1.__metadata("design:paramtypes", [rule_loader_1.RuleLoader,
types_1.MessageHandler,
types_1.DeprecationHandler,
types_1.FailureFilterFactory])
ymir_1.MessageHandler,
ymir_1.DeprecationHandler,
ymir_1.FailureFilterFactory])
], Linter);
exports.Linter = Linter;
//# sourceMappingURL=linter.js.map
import * as ts from 'typescript';
import { ProcessorLoader } from './services/processor-loader';
import { CachedFileSystem } from './services/cached-file-system';
import { Configuration, AbstractProcessor } from './types';
import { Configuration, AbstractProcessor } from '@fimbul/ymir';
import { ConfigurationManager } from './services/configuration-manager';

@@ -6,0 +6,0 @@ export interface ProcessedFileInfo {

import { Linter } from './linter';
import { LintResult, DirectoryService } from './types';
import { LintResult, DirectoryService } from '@fimbul/ymir';
import * as ts from 'typescript';

@@ -4,0 +4,0 @@ import { ProcessorLoader } from './services/processor-loader';

@@ -5,3 +5,3 @@ "use strict";

const linter_1 = require("./linter");
const types_1 = require("./types");
const ymir_1 = require("@fimbul/ymir");
const path = require("path");

@@ -12,3 +12,2 @@ const ts = require("typescript");

const minimatch_1 = require("minimatch");
const error_1 = require("./error");
const processor_loader_1 = require("./services/processor-loader");

@@ -132,3 +131,3 @@ const inversify_1 = require("inversify");

if (project === undefined)
throw new error_1.ConfigurationError(`Cannot find tsconfig.json for directory '${cwd}'.`);
throw new ymir_1.ConfigurationError(`Cannot find tsconfig.json for directory '${cwd}'.`);
}

@@ -170,7 +169,7 @@ const program = createProgram(project, host);

case 0:
throw new error_1.ConfigurationError(`The specified path does not exist: '${fileOrDirName}'`);
throw new ymir_1.ConfigurationError(`The specified path does not exist: '${fileOrDirName}'`);
case 2: {
const file = path.join(fileOrDirName, 'tsconfig.json');
if (!this.fs.isFile(file))
throw new error_1.ConfigurationError(`Cannot find a tsconfig.json file at the specified directory: '${fileOrDirName}'`);
throw new ymir_1.ConfigurationError(`Cannot find a tsconfig.json file at the specified directory: '${fileOrDirName}'`);
return file;

@@ -189,3 +188,3 @@ }

processor_loader_1.ProcessorLoader,
types_1.DirectoryService])
ymir_1.DirectoryService])
], Runner);

@@ -213,3 +212,3 @@ exports.Runner = Runner;

if (!isExcluded(normalized, exclude.map((p) => new minimatch_1.Minimatch(p, { dot: true }))))
throw new error_1.ConfigurationError(`'${normalized}' does not exist.`);
throw new ymir_1.ConfigurationError(`'${normalized}' does not exist.`);
}

@@ -224,3 +223,3 @@ }

if (!files.includes(normalized) && !isExcluded(normalized, exclude))
throw new error_1.ConfigurationError(`'${normalized}' is not included in the project.`);
throw new ymir_1.ConfigurationError(`'${normalized}' is not included in the project.`);
}

@@ -238,3 +237,3 @@ }

if (config.error !== undefined)
throw new error_1.ConfigurationError(ts.formatDiagnostics([config.error], host));
throw new ymir_1.ConfigurationError(ts.formatDiagnostics([config.error], host));
const parsed = ts.parseJsonConfigFileContent(config.config, createParseConfigHost(host), path.dirname(configFile), { noEmit: true }, configFile);

@@ -244,3 +243,3 @@ if (parsed.errors.length !== 0) {

if (errors.length !== 0)
throw new error_1.ConfigurationError(ts.formatDiagnostics(errors, host));
throw new ymir_1.ConfigurationError(ts.formatDiagnostics(errors, host));
}

@@ -247,0 +246,0 @@ return ts.createProgram(parsed.fileNames, parsed.options, host);

@@ -1,2 +0,2 @@

import { FileSystem, CacheFactory } from '../types';
import { FileSystem, CacheFactory } from '@fimbul/ymir';
export declare const enum FileKind {

@@ -3,0 +3,0 @@ NonExistent = 0,

@@ -5,3 +5,3 @@ "use strict";

const inversify_1 = require("inversify");
const types_1 = require("../types");
const ymir_1 = require("@fimbul/ymir");
const bind_decorator_1 = require("bind-decorator");

@@ -88,5 +88,5 @@ const utils_1 = require("../utils");

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.FileSystem, types_1.CacheFactory])
tslib_1.__metadata("design:paramtypes", [ymir_1.FileSystem, ymir_1.CacheFactory])
], CachedFileSystem);
exports.CachedFileSystem = CachedFileSystem;
//# sourceMappingURL=cached-file-system.js.map

@@ -1,2 +0,2 @@

import { Configuration, CacheFactory, ReducedConfiguration, Settings, DirectoryService, ConfigurationProvider } from '../types';
import { Configuration, CacheFactory, ReducedConfiguration, Settings, DirectoryService, ConfigurationProvider } from '@fimbul/ymir';
import { CachedFileSystem } from './cached-file-system';

@@ -3,0 +3,0 @@ export declare class ConfigurationManager {

@@ -5,5 +5,4 @@ "use strict";

const inversify_1 = require("inversify");
const types_1 = require("../types");
const ymir_1 = require("@fimbul/ymir");
const path = require("path");
const error_1 = require("../error");
const utils_1 = require("../utils");

@@ -26,3 +25,3 @@ const minimatch_1 = require("minimatch");

catch (e) {
throw new error_1.ConfigurationError(`Error finding configuration for '${file}': ${e && e.message}`);
throw new ymir_1.ConfigurationError(`Error finding configuration for '${file}': ${e && e.message}`);
}

@@ -43,3 +42,3 @@ }

catch (e) {
throw new error_1.ConfigurationError(`${e && e.message}`);
throw new ymir_1.ConfigurationError(`${e && e.message}`);
}

@@ -74,3 +73,3 @@ }

catch (e) {
throw new error_1.ConfigurationError(`Error loading ${stack.join(' => ')}: ${e && e.message}`);
throw new ymir_1.ConfigurationError(`Error loading ${stack.join(' => ')}: ${e && e.message}`);
}

@@ -81,6 +80,6 @@ }

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.DirectoryService,
types_1.ConfigurationProvider,
tslib_1.__metadata("design:paramtypes", [ymir_1.DirectoryService,
ymir_1.ConfigurationProvider,
cached_file_system_1.CachedFileSystem,
types_1.CacheFactory])
ymir_1.CacheFactory])
], ConfigurationManager);

@@ -87,0 +86,0 @@ exports.ConfigurationManager = ConfigurationManager;

@@ -1,2 +0,2 @@

import { CacheFactory, Cache } from '../../types';
import { CacheFactory, Cache } from '@fimbul/ymir';
export declare class DefaultCacheFactory implements CacheFactory {

@@ -3,0 +3,0 @@ create<K extends object, V = any>(weak: true): Cache<K, V>;

@@ -1,2 +0,2 @@

import { ConfigurationProvider, Resolver, LoadConfigurationContext, Configuration, CacheFactory } from '../../types';
import { ConfigurationProvider, Resolver, LoadConfigurationContext, Configuration, CacheFactory, BuiltinResolver } from '@fimbul/ymir';
import { CachedFileSystem } from '../cached-file-system';

@@ -50,4 +50,5 @@ export interface RawConfiguration {

private resolver;
private builtinResolver;
private cache;
constructor(fs: CachedFileSystem, resolver: Resolver, cache: CacheFactory);
constructor(fs: CachedFileSystem, resolver: Resolver, builtinResolver: BuiltinResolver, cache: CacheFactory);
find(fileToLint: string): string | undefined;

@@ -54,0 +55,0 @@ private findConfigForDirectory(dir);

@@ -5,3 +5,3 @@ "use strict";

const inversify_1 = require("inversify");
const types_1 = require("../../types");
const ymir_1 = require("@fimbul/ymir");
const cached_file_system_1 = require("../cached-file-system");

@@ -16,5 +16,6 @@ const path = require("path");

let DefaultConfigurationProvider = class DefaultConfigurationProvider {
constructor(fs, resolver, cache) {
constructor(fs, resolver, builtinResolver, cache) {
this.fs = fs;
this.resolver = resolver;
this.builtinResolver = builtinResolver;
this.cache = cache.create();

@@ -36,3 +37,3 @@ }

if (name.startsWith('wotan:')) {
const fileName = path.join(__dirname, `../../../configs/${name.substr('wotan:'.length)}.yaml`);
const fileName = this.builtinResolver.resolveConfig(name.substr('wotan:'.length));
if (!this.fs.isFile(fileName))

@@ -125,3 +126,3 @@ throw new Error(`'${name}' is not a valid builtin configuration, try 'wotan:recommended'.`);

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [cached_file_system_1.CachedFileSystem, types_1.Resolver, types_1.CacheFactory])
tslib_1.__metadata("design:paramtypes", [cached_file_system_1.CachedFileSystem, ymir_1.Resolver, ymir_1.BuiltinResolver, ymir_1.CacheFactory])
], DefaultConfigurationProvider);

@@ -128,0 +129,0 @@ exports.DefaultConfigurationProvider = DefaultConfigurationProvider;

@@ -1,2 +0,2 @@

import { DeprecationHandler, DeprecationTarget, MessageHandler } from '../../types';
import { DeprecationHandler, DeprecationTarget, MessageHandler } from '@fimbul/ymir';
export declare class DefaultDeprecationHandler implements DeprecationHandler {

@@ -3,0 +3,0 @@ private logger;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const types_1 = require("../../types");
const ymir_1 = require("@fimbul/ymir");
const inversify_1 = require("inversify");

@@ -16,3 +16,3 @@ let DefaultDeprecationHandler = class DefaultDeprecationHandler {

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.MessageHandler])
tslib_1.__metadata("design:paramtypes", [ymir_1.MessageHandler])
], DefaultDeprecationHandler);

@@ -19,0 +19,0 @@ exports.DefaultDeprecationHandler = DefaultDeprecationHandler;

@@ -1,2 +0,2 @@

import { DirectoryService } from '../../types';
import { DirectoryService } from '@fimbul/ymir';
export declare class NodeDirectoryService implements DirectoryService {

@@ -3,0 +3,0 @@ getCurrentDirectory(): string;

@@ -1,2 +0,2 @@

import { FileSystem, Stats, MessageHandler } from '../../types';
import { FileSystem, Stats, MessageHandler } from '@fimbul/ymir';
export declare class NodeFileSystem implements FileSystem {

@@ -3,0 +3,0 @@ private logger;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const types_1 = require("../../types");
const ymir_1 = require("@fimbul/ymir");
const fs = require("fs");

@@ -57,5 +57,5 @@ const inversify_1 = require("inversify");

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.MessageHandler])
tslib_1.__metadata("design:paramtypes", [ymir_1.MessageHandler])
], NodeFileSystem);
exports.NodeFileSystem = NodeFileSystem;
//# sourceMappingURL=file-system.js.map

@@ -1,7 +0,8 @@

import { FormatterLoaderHost, FormatterConstructor, Resolver } from '../../types';
import { FormatterLoaderHost, FormatterConstructor, Resolver, BuiltinResolver } from '@fimbul/ymir';
export declare class NodeFormatterLoader implements FormatterLoaderHost {
private resolver;
constructor(resolver: Resolver);
private builtinResolver;
constructor(resolver: Resolver, builtinResolver: BuiltinResolver);
loadCoreFormatter(name: string): FormatterConstructor | undefined;
loadCustomFormatter(name: string, basedir: string): FormatterConstructor | undefined;
}

@@ -5,10 +5,11 @@ "use strict";

const inversify_1 = require("inversify");
const types_1 = require("../../types");
const ymir_1 = require("@fimbul/ymir");
const utils_1 = require("../../utils");
let NodeFormatterLoader = class NodeFormatterLoader {
constructor(resolver) {
constructor(resolver, builtinResolver) {
this.resolver = resolver;
this.builtinResolver = builtinResolver;
}
loadCoreFormatter(name) {
name = `../../formatters/${name}.js`;
name = this.builtinResolver.resolveFormatter(name);
try {

@@ -18,3 +19,3 @@ return require(name).Formatter;

catch (e) {
if (e != undefined && e.code === 'MODULE_NOT_FOUND' && `Cannot find module '${name}'`)
if (e != undefined && e.code === 'MODULE_NOT_FOUND' && e.message === `Cannot find module '${name}'`)
return;

@@ -37,5 +38,5 @@ throw e;

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.Resolver])
tslib_1.__metadata("design:paramtypes", [ymir_1.Resolver, ymir_1.BuiltinResolver])
], NodeFormatterLoader);
exports.NodeFormatterLoader = NodeFormatterLoader;
//# sourceMappingURL=formatter-loader-host.js.map
import * as ts from 'typescript';
import { FailureFilterFactory, FailureFilter, FailureFilterContext } from '../../types';
import { FailureFilterFactory, FailureFilter, FailureFilterContext, LineSwitchParser, LineSwitchParserContext, RawLineSwitch } from '@fimbul/ymir';
export declare const LINE_SWITCH_REGEX: RegExp;
export interface LineSwitchParser {
parse(context: LineSwitchParserContext): ReadonlyMap<string, ReadonlyArray<RawLineSwitch>>;
}
export declare abstract class LineSwitchParser {
}
export interface LineSwitchParserContext {
sourceFile: ts.SourceFile;
ruleNames: ReadonlyArray<string>;
getCommentAtPosition(pos: number): ts.CommentRange | undefined;
}
export interface RawLineSwitch {
readonly enable: boolean;
readonly position: number;
}
export declare class LineSwitchFilterFactory implements FailureFilterFactory {

@@ -19,0 +5,0 @@ private parser;

@@ -7,6 +7,4 @@ "use strict";

const tsutils_1 = require("tsutils");
const ymir_1 = require("@fimbul/ymir");
exports.LINE_SWITCH_REGEX = /^\s*wotan-(enable|disable)((?:-next)?-line)?(\s+(?:(?:[\w-]+\/)*[\w-]+\s*,\s*)*(?:[\w-]+\/)*[\w-]+)?\s*$/;
class LineSwitchParser {
}
exports.LineSwitchParser = LineSwitchParser;
let LineSwitchFilterFactory = class LineSwitchFilterFactory {

@@ -61,3 +59,3 @@ constructor(parser) {

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [LineSwitchParser])
tslib_1.__metadata("design:paramtypes", [ymir_1.LineSwitchParser])
], LineSwitchFilterFactory);

@@ -64,0 +62,0 @@ exports.LineSwitchFilterFactory = LineSwitchFilterFactory;

@@ -1,2 +0,2 @@

import { MessageHandler } from '../../types';
import { MessageHandler } from '@fimbul/ymir';
export declare class ConsoleMessageHandler implements MessageHandler {

@@ -3,0 +3,0 @@ private warned;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const error_1 = require("../../error");
const ymir_1 = require("@fimbul/ymir");
const inversify_1 = require("inversify");

@@ -20,3 +20,3 @@ let ConsoleMessageHandler = class ConsoleMessageHandler {

error(e) {
console.error(e instanceof error_1.ConfigurationError ? e.message : e);
console.error(e instanceof ymir_1.ConfigurationError ? e.message : e);
}

@@ -23,0 +23,0 @@ };

@@ -1,2 +0,2 @@

import { Resolver } from '../../types';
import { Resolver } from '@fimbul/ymir';
import { CachedFileSystem } from '../cached-file-system';

@@ -3,0 +3,0 @@ export declare class NodeResolver implements Resolver {

@@ -1,5 +0,7 @@

import { RuleLoaderHost, RuleConstructor } from '../../types';
import { RuleLoaderHost, RuleConstructor, BuiltinResolver } from '@fimbul/ymir';
export declare class NodeRuleLoader implements RuleLoaderHost {
private resolver;
constructor(resolver: BuiltinResolver);
loadCoreRule(name: string): RuleConstructor | undefined;
loadCustomRule(name: string, directory: string): RuleConstructor | undefined;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const ymir_1 = require("@fimbul/ymir");
const debug = require("debug");

@@ -8,7 +9,9 @@ const path = require("path");

const log = debug('wotan:ruleLoaderHost');
const CORE_RULES_DIRECTORY = path.join(__dirname, '../../rules');
let NodeRuleLoader = class NodeRuleLoader {
constructor(resolver) {
this.resolver = resolver;
}
loadCoreRule(name) {
try {
name = path.join(CORE_RULES_DIRECTORY, name + '.js');
name = this.resolver.resolveRule(name);
const rule = require(name).Rule;

@@ -39,5 +42,6 @@ log('Found %s', name);

NodeRuleLoader = tslib_1.__decorate([
inversify_1.injectable()
inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [ymir_1.BuiltinResolver])
], NodeRuleLoader);
exports.NodeRuleLoader = NodeRuleLoader;
//# sourceMappingURL=rule-loader-host.js.map

@@ -1,2 +0,2 @@

import { FormatterLoaderHost, FormatterConstructor, DirectoryService } from '../types';
import { FormatterLoaderHost, FormatterConstructor, DirectoryService } from '@fimbul/ymir';
export declare class FormatterLoader {

@@ -3,0 +3,0 @@ private host;

@@ -5,4 +5,3 @@ "use strict";

const inversify_1 = require("inversify");
const types_1 = require("../types");
const error_1 = require("../error");
const ymir_1 = require("@fimbul/ymir");
let FormatterLoader = class FormatterLoader {

@@ -20,3 +19,3 @@ constructor(host, directories) {

if (formatter === undefined)
throw new error_1.ConfigurationError(`Could not find formatter '${name}' relative to '${this.directories.getCurrentDirectory()}'.`);
throw new ymir_1.ConfigurationError(`Cannot find formatter '${name}' relative to '${this.directories.getCurrentDirectory()}'.`);
return formatter;

@@ -27,5 +26,5 @@ }

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.FormatterLoaderHost, types_1.DirectoryService])
tslib_1.__metadata("design:paramtypes", [ymir_1.FormatterLoaderHost, ymir_1.DirectoryService])
], FormatterLoader);
exports.FormatterLoader = FormatterLoader;
//# sourceMappingURL=formatter-loader.js.map

@@ -1,2 +0,2 @@

import { ProcessorConstructor, Resolver, CacheFactory } from '../types';
import { ProcessorConstructor, Resolver, CacheFactory } from '@fimbul/ymir';
export declare class ProcessorLoader {

@@ -3,0 +3,0 @@ private resolver;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const types_1 = require("../types");
const ymir_1 = require("@fimbul/ymir");
const inversify_1 = require("inversify");
const utils_1 = require("../utils");
const bind_decorator_1 = require("bind-decorator");
const error_1 = require("../error");
let ProcessorLoader = class ProcessorLoader {

@@ -21,3 +20,3 @@ constructor(resolver, cache) {

if (result === undefined)
throw new error_1.ConfigurationError(`'${path}' has no export named 'Processor'.`);
throw new ymir_1.ConfigurationError(`'${path}' has no export named 'Processor'.`);
return result;

@@ -27,3 +26,3 @@ }

if (e != undefined && e.code === 'MODULE_NOT_FOUND' && e.message === `Cannot find module '${path}'`)
throw new error_1.ConfigurationError(e.message);
throw new ymir_1.ConfigurationError(e.message);
throw e;

@@ -41,5 +40,5 @@ }

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.Resolver, types_1.CacheFactory])
tslib_1.__metadata("design:paramtypes", [ymir_1.Resolver, ymir_1.CacheFactory])
], ProcessorLoader);
exports.ProcessorLoader = ProcessorLoader;
//# sourceMappingURL=processor-loader.js.map

@@ -1,2 +0,2 @@

import { RuleLoaderHost, RuleConstructor, MessageHandler, CacheFactory } from '../types';
import { RuleLoaderHost, RuleConstructor, MessageHandler, CacheFactory } from '@fimbul/ymir';
export declare class RuleLoader {

@@ -3,0 +3,0 @@ private host;

@@ -5,3 +5,3 @@ "use strict";

const inversify_1 = require("inversify");
const types_1 = require("../types");
const ymir_1 = require("@fimbul/ymir");
const debug = require("debug");

@@ -56,5 +56,5 @@ const bind_decorator_1 = require("bind-decorator");

inversify_1.injectable(),
tslib_1.__metadata("design:paramtypes", [types_1.RuleLoaderHost, types_1.MessageHandler, types_1.CacheFactory])
tslib_1.__metadata("design:paramtypes", [ymir_1.RuleLoaderHost, ymir_1.MessageHandler, ymir_1.CacheFactory])
], RuleLoader);
exports.RuleLoader = RuleLoader;
//# sourceMappingURL=rule-loader.js.map

@@ -1,2 +0,2 @@

import { FileSummary } from './types';
import { FileSummary } from '@fimbul/ymir';
import { Runner, LintOptions } from './runner';

@@ -3,0 +3,0 @@ export declare const enum BaselineKind {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const types_1 = require("./types");
const ymir_1 = require("@fimbul/ymir");
const chalk_1 = require("chalk");

@@ -80,3 +80,3 @@ const diff = require("diff");

return summary.content;
const failures = summary.failures.slice().sort(types_1.Failure.compare);
const failures = summary.failures.slice().sort(ymir_1.Failure.compare);
const lines = [];

@@ -83,0 +83,0 @@ let lineStart = 0;

@@ -1,7 +0,4 @@

import { Format, Cache } from './types';
import { Format, Cache } from '@fimbul/ymir';
import * as ts from 'typescript';
export declare const OFFSET_TO_NODE_MODULES = 3;
export declare function isStrictNullChecksEnabled(options: ts.CompilerOptions): boolean;
export declare function isStrictPropertyInitializationEnabled(options: ts.CompilerOptions): boolean;
export declare const memoizeGetter: MethodDecorator;
export declare function arrayify<T>(maybeArr: T | T[] | undefined): T[];

@@ -8,0 +5,0 @@ export declare function resolveCachedResult<K, V>(cache: Cache<K, V>, key: K, cb: (key: K) => V): V;

@@ -7,22 +7,2 @@ "use strict";

exports.OFFSET_TO_NODE_MODULES = 3;
function isStrictNullChecksEnabled(options) {
return options.strict ? options.strictNullChecks !== false : options.strictNullChecks === true;
}
exports.isStrictNullChecksEnabled = isStrictNullChecksEnabled;
function isStrictPropertyInitializationEnabled(options) {
return options.strict
? options.strictPropertyInitialization !== false && options.strictNullChecks !== false
: options.strictPropertyInitialization === true && options.strictNullChecks === true;
}
exports.isStrictPropertyInitializationEnabled = isStrictPropertyInitializationEnabled;
exports.memoizeGetter = (_target, property, descriptor) => {
if (descriptor.get === undefined)
throw new Error('@memoizeGetter can only be used with get accessors.');
const originalGetter = descriptor.get;
descriptor.get = function () {
const value = originalGetter.call(this);
Object.defineProperty(this, property, { value, writable: false });
return value;
};
};
function arrayify(maybeArr) {

@@ -29,0 +9,0 @@ return Array.isArray(maybeArr)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet