@fimbul/ymir
Advanced tools
Comparing version 0.21.0-dev.20190318 to 0.21.0-dev.20190322
{ | ||
"name": "@fimbul/ymir", | ||
"version": "0.21.0-dev.20190318", | ||
"version": "0.21.0-dev.20190322", | ||
"description": "Core library for the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -49,15 +49,13 @@ import 'reflect-metadata'; | ||
readonly deprecated?: boolean | string; | ||
supports?: RuleSupportsPredicate; | ||
supports?: RulePredicate; | ||
new (context: T): AbstractRule; | ||
} | ||
export interface RuleSupportsContext { | ||
export interface RulePredicateContext { | ||
readonly program?: ts.Program; | ||
readonly compilerOptions?: ts.CompilerOptions; | ||
readonly settings: Settings; | ||
readonly options: {} | null | undefined; | ||
} | ||
export interface RuleContext { | ||
readonly program?: ts.Program; | ||
export interface RuleContext extends RulePredicateContext { | ||
readonly sourceFile: ts.SourceFile; | ||
readonly settings: Settings; | ||
readonly options: {} | null | undefined; | ||
addFinding(start: number, end: number, message: string, fix?: Replacement | ReadonlyArray<Replacement>): void; | ||
@@ -69,5 +67,6 @@ getFlatAst(): ReadonlyArray<ts.Node>; | ||
readonly program: ts.Program; | ||
readonly compilerOptions: ts.CompilerOptions; | ||
} | ||
export declare type Settings = ReadonlyMap<string, {} | null | undefined>; | ||
export declare function predicate(check: RuleSupportsPredicate): (target: typeof AbstractRule) => void; | ||
export declare function predicate(check: RulePredicate): (target: typeof AbstractRule) => void; | ||
export declare function typescriptOnly(target: typeof AbstractRule): void; | ||
@@ -77,3 +76,3 @@ export declare function excludeDeclarationFiles(target: typeof AbstractRule): void; | ||
export declare function requiresCompilerOption(option: BooleanCompilerOptions): (target: typeof TypedRule) => void; | ||
export declare type RuleSupportsPredicate = (sourceFile: ts.SourceFile, context: RuleSupportsContext) => boolean | string; | ||
export declare type RulePredicate = (sourceFile: ts.SourceFile, context: RulePredicateContext) => boolean | string; | ||
export declare abstract class AbstractRule { | ||
@@ -83,3 +82,3 @@ readonly context: RuleContext; | ||
static deprecated: boolean | string; | ||
static supports?: RuleSupportsPredicate; | ||
static supports?: RulePredicate; | ||
static validateConfig?(config: any): string[] | string | undefined; | ||
@@ -86,0 +85,0 @@ readonly sourceFile: ts.SourceFile; |
@@ -73,3 +73,3 @@ "use strict"; | ||
return (target) => { | ||
target.supports = combinePredicates(target.supports, (_, context) => tsutils_1.isCompilerOptionEnabled(context.program.getCompilerOptions(), option) || `requires compilerOption '${option}'`); | ||
target.supports = combinePredicates(target.supports, (_, context) => tsutils_1.isCompilerOptionEnabled(context.compilerOptions, option) || `requires compilerOption '${option}'`); | ||
}; | ||
@@ -82,4 +82,6 @@ } | ||
this.sourceFile = context.sourceFile; | ||
this.program = context.program; | ||
} | ||
get program() { | ||
return this.context.program; | ||
} | ||
addFinding(start, end, message, fix) { | ||
@@ -86,0 +88,0 @@ return this.context.addFinding(start, end, message, fix); |
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
36687
523