@fimbul/ymir
Advanced tools
Comparing version 0.21.0-dev.20190322 to 0.21.0-dev.20190329
{ | ||
"name": "@fimbul/ymir", | ||
"version": "0.21.0-dev.20190322", | ||
"version": "0.21.0-dev.20190329", | ||
"description": "Core library for the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -38,2 +38,3 @@ import 'reflect-metadata'; | ||
export declare const Finding: { | ||
/** Compare two Findings. Intended to be used in `Array.prototype.sort`. */ | ||
compare(a: Finding, b: Finding): number; | ||
@@ -75,2 +76,3 @@ }; | ||
export declare function requiresCompilerOption(option: BooleanCompilerOptions): (target: typeof TypedRule) => void; | ||
/** @returns `true`, `false` or a reason */ | ||
export declare type RulePredicate = (sourceFile: ts.SourceFile, context: RulePredicateContext) => boolean | string; | ||
@@ -99,2 +101,3 @@ export declare abstract class AbstractRule { | ||
readonly program: ts.Program; | ||
/** Lazily evaluated getter for TypeChecker. Use this instead of `this.program.getTypeChecker()` to avoid wasting CPU cycles. */ | ||
readonly checker: ts.TypeChecker; | ||
@@ -172,2 +175,6 @@ constructor(context: TypedRuleContext); | ||
readonly stack: ReadonlyArray<string>; | ||
/** | ||
* Resolves the given name relative to the current configuration file and returns the parsed Configuration. | ||
* This function detects cycles and caches already loaded configurations. | ||
*/ | ||
load(name: string): Configuration; | ||
@@ -200,2 +207,6 @@ } | ||
export declare abstract class AbstractProcessor { | ||
/** | ||
* Returns a new primary extension that is appended to the file name, e.g. '.ts'. | ||
* If the file should not get a new extension, just return an empty string. | ||
*/ | ||
static getSuffixForFile(_context: ProcessorSuffixContext): string; | ||
@@ -228,10 +239,21 @@ protected source: string; | ||
} | ||
/** | ||
* Low level file system access. All methods are supposed to throw an error on failure. | ||
*/ | ||
export interface FileSystem { | ||
/** Normalizes the path to enable reliable caching in consuming services. */ | ||
normalizePath(path: string): string; | ||
/** Reads the given file. Tries to infer and convert encoding. */ | ||
readFile(file: string): string; | ||
/** Reads directory entries. Returns only the basenames optionally with file type information. */ | ||
readDirectory(dir: string): Array<string | Dirent>; | ||
/** Gets the status of a file or directory. */ | ||
stat(path: string): Stats; | ||
/** Gets the realpath of a given file or directory. */ | ||
realpath?(path: string): string; | ||
/** Writes content to the file, overwriting the existing content. Creates the file if necessary. */ | ||
writeFile(file: string, content: string): void; | ||
/** Deletes a given file. Is not supposed to delete or clear a directory. */ | ||
deleteFile(path: string): void; | ||
/** Creates a single directory and fails on error. Is not supposed to create multiple directories. */ | ||
createDirectory(dir: string): void; | ||
@@ -262,2 +284,3 @@ } | ||
export interface CacheFactory { | ||
/** Creates a new cache instance. */ | ||
create<K extends object, V = any>(weak: true): Cache<K, V>; | ||
@@ -308,3 +331,8 @@ create<K = any, V = any>(weak?: false): Cache<K, V>; | ||
export interface FindingFilter { | ||
/** @returns `true` if the finding should be used, false if it should be filtered out. Intended for use in `Array.prototype.filter`. */ | ||
filter(finding: Finding): boolean; | ||
/** | ||
* @returns Findings to report redundant or unused filter directives. | ||
* This is called after calling `filter` for all findings in the file. | ||
*/ | ||
reportUseless(severity: Severity): ReadonlyArray<Finding>; | ||
@@ -335,3 +363,3 @@ } | ||
program: ts.Program; | ||
host: Required<Pick<ts.CompilerHost, 'readDirectory' | 'readFile' | 'useCaseSensitiveFileNames' | 'fileExists' | 'directoryExists'>>; | ||
host: Required<Pick<ts.CompilerHost, 'directoryExists'>>; | ||
} | ||
@@ -344,3 +372,4 @@ export interface FileFilterFactory { | ||
export interface FileFilter { | ||
/** @returns `true` if the file should be linted, false if it should be filtered out. Intended for use in `Array.prototype.filter`. */ | ||
filter(file: ts.SourceFile): boolean; | ||
} |
@@ -18,3 +18,3 @@ "use strict"; | ||
append(pos, text) { | ||
return { start: pos, end: pos, text }; | ||
return { start: pos, end: pos, text }; // tslint:disable-line:object-shorthand-properties-first | ||
}, | ||
@@ -26,2 +26,3 @@ delete(start, end) { | ||
exports.Finding = { | ||
/** Compare two Findings. Intended to be used in `Array.prototype.sort`. */ | ||
compare(a, b) { | ||
@@ -109,2 +110,3 @@ return a.start.position - b.start.position | ||
} | ||
/** Lazily evaluated getter for TypeChecker. Use this instead of `this.program.getTypeChecker()` to avoid wasting CPU cycles. */ | ||
get checker() { | ||
@@ -138,2 +140,6 @@ const checker = this.program.getTypeChecker(); | ||
class AbstractProcessor { | ||
/** | ||
* Returns a new primary extension that is appended to the file name, e.g. '.ts'. | ||
* If the file should not get a new extension, just return an empty string. | ||
*/ | ||
static getSuffixForFile(_context) { | ||
@@ -171,2 +177,3 @@ return ''; | ||
exports.FormatterLoaderHost = FormatterLoaderHost; | ||
// wotan-enable no-misused-generics | ||
class CacheFactory { | ||
@@ -173,0 +180,0 @@ } |
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
39042
559