@fimbul/ymir
Advanced tools
Comparing version 0.6.0 to 0.8.0-dev.20180411
{ | ||
"name": "@fimbul/ymir", | ||
"version": "0.6.0", | ||
"version": "0.8.0-dev.20180411", | ||
"description": "Core library for the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -77,2 +77,3 @@ import 'reflect-metadata'; | ||
export declare function excludeDeclarationFiles<T extends typeof AbstractRule>(target: T): void; | ||
export declare function requireLibraryFile(fileName: string): <T extends typeof TypedRule>(target: T) => void; | ||
export declare type RuleSupportsPredicate = (sourceFile: ts.SourceFile, context: RuleSupportsContext) => boolean; | ||
@@ -79,0 +80,0 @@ export declare abstract class AbstractRule { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
require("reflect-metadata"); | ||
const ts = require("typescript"); | ||
const path = require("path"); | ||
class ConfigurationError extends Error { | ||
@@ -59,2 +61,12 @@ } | ||
exports.excludeDeclarationFiles = excludeDeclarationFiles; | ||
function requireLibraryFile(fileName) { | ||
return (target) => { | ||
target.supports = combinePredicates(target.supports, (_, context) => programContainsLibraryFile(context.program, fileName)); | ||
}; | ||
} | ||
exports.requireLibraryFile = requireLibraryFile; | ||
function programContainsLibraryFile(program, fileName) { | ||
const libFileDir = path.dirname(ts.getDefaultLibFilePath(program.getCompilerOptions())); | ||
return program.getSourceFile(path.join(libFileDir, fileName)) !== undefined; | ||
} | ||
class AbstractRule { | ||
@@ -61,0 +73,0 @@ constructor(context) { |
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
33376
479