@fimbul/ymir
- Version 0.24.0
- Published
- 42.2 kB
- 3 dependencies
- Apache-2.0 license
Install
npm i @fimbul/ymiryarn add @fimbul/ymirpnpm add @fimbul/ymirOverview
Core library for the Fimbullinter project
Index
Variables
Functions
Classes
Interfaces
Enums
Type Aliases
Namespaces
Variables
variable Finding
const Finding: { compare(a: Finding, b: Finding): number };variable Replacement
const Replacement: { replace(start: number, end: number, text: string): Replacement; append(pos: number, text: string): Replacement; delete(start: number, end: number): Replacement;};Functions
function excludeDeclarationFiles
excludeDeclarationFiles: (target: typeof AbstractRule) => void;function predicate
predicate: (check: RulePredicate) => (target: typeof AbstractRule) => void;function requireLibraryFile
requireLibraryFile: (fileName: string) => (target: typeof TypedRule) => void;function requiresCompilerOption
requiresCompilerOption: ( option: BooleanCompilerOptions) => (target: typeof TypedRule) => void;function typescriptOnly
typescriptOnly: (target: typeof AbstractRule) => void;Classes
class AbstractFormatter
abstract class AbstractFormatter {}class AbstractProcessor
abstract class AbstractProcessor {}constructor
constructor(context: ProcessorContext);property settings
protected settings: Settings;property source
protected source: string;property sourceFileName
protected sourceFileName: string;property targetFileName
protected targetFileName: string;method getSuffixForFile
static getSuffixForFile: (_context: ProcessorSuffixContext) => string;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.
method postprocess
abstract postprocess: ( findings: ReadonlyArray<Finding>) => ReadonlyArray<Finding>;method preprocess
abstract preprocess: () => string;method updateSource
abstract updateSource: ( newSource: string, changeRange: ts.TextChangeRange) => ProcessorUpdateResult;class AbstractRule
abstract class AbstractRule {}constructor
constructor(context: RuleContext);property context
readonly context: RuleContext;property deprecated
static deprecated: string | boolean;property program
readonly program: any;property requiresTypeInformation
static readonly requiresTypeInformation: boolean;property sourceFile
readonly sourceFile: ts.SourceFile;property supports
static supports?: RulePredicate;method addFinding
addFinding: ( start: number, end: number, message: string, fix?: Replacement | ReadonlyArray<Replacement>) => void;method addFindingAtNode
addFindingAtNode: ( node: ts.Node, message: string, fix?: Replacement | ReadonlyArray<Replacement>) => void;method apply
abstract apply: () => void;method validateConfig
static validateConfig: (config: any) => string[] | string | undefined;class BuiltinResolver
abstract class BuiltinResolver {}class CacheFactory
abstract class CacheFactory {}class ConfigurableRule
abstract class ConfigurableRule<T> extends AbstractRule {}constructor
constructor(context: RuleContext);property options
options: {};method parseOptions
protected abstract parseOptions: (options: {} | null | undefined) => T;class ConfigurableTypedRule
abstract class ConfigurableTypedRule<T> extends TypedRule {}constructor
constructor(context: TypedRuleContext);property options
options: {};method parseOptions
protected abstract parseOptions: (options: {} | null | undefined) => T;class ConfigurationError
class ConfigurationError extends Error {}class ConfigurationProvider
abstract class ConfigurationProvider {}class ContentId
abstract class ContentId {}class DeprecationHandler
abstract class DeprecationHandler {}class DirectoryService
abstract class DirectoryService {}class FileFilterFactory
abstract class FileFilterFactory {}class FileSystem
abstract class FileSystem {}class FindingFilterFactory
abstract class FindingFilterFactory {}class FormatterLoaderHost
abstract class FormatterLoaderHost {}class GlobalOptions
abstract class GlobalOptions {}class LineSwitchParser
abstract class LineSwitchParser {}class MessageHandler
abstract class MessageHandler {}class Resolver
abstract class Resolver {}class RuleLoaderHost
abstract class RuleLoaderHost {}class StatePersistence
abstract class StatePersistence {}class TypedRule
abstract class TypedRule extends AbstractRule {}constructor
constructor(context: TypedRuleContext);property checker
readonly checker: ts.TypeChecker;Lazily evaluated getter for TypeChecker. Use this instead of
this.program.getTypeChecker()to avoid wasting CPU cycles.
property context
readonly context: TypedRuleContext;property program
readonly program: ts.Program;property requiresTypeInformation
static readonly requiresTypeInformation: boolean;Interfaces
interface BuiltinResolver
interface BuiltinResolver {}method resolveConfig
resolveConfig: (name: string) => string;method resolveFormatter
resolveFormatter: (name: string) => string;method resolveRule
resolveRule: (name: string) => string;interface Cache
interface Cache<K, V> {}interface CacheFactory
interface CacheFactory {}method create
create: { <K extends object, V = any>(weak: true): Cache<K, V>; <K = any, V = any>(weak?: false): Cache<K, V>;};Creates a new cache instance.
interface Configuration
interface Configuration {}property aliases
readonly aliases?: ReadonlyMap<string, Configuration.Alias>;property exclude
readonly exclude?: ReadonlyArray<string>;property extends
readonly extends: ReadonlyArray<Configuration>;property filename
readonly filename: string;property overrides
readonly overrides?: ReadonlyArray<Configuration.Override>;property processor
readonly processor?: string | null | false;property rules
readonly rules?: ReadonlyMap<string, Configuration.RuleConfig>;property rulesDirectories
readonly rulesDirectories?: Configuration.RulesDirectoryMap;property settings
readonly settings?: Settings;interface ConfigurationProvider
interface ConfigurationProvider {}interface ContentId
interface ContentId {}method forFile
forFile: (fileName: string, host: ContentIdHost) => string;interface DeprecationHandler
interface DeprecationHandler {}method handle
handle: (target: DeprecationTarget, name: string, text?: string) => void;interface DirectoryService
interface DirectoryService {}method getCurrentDirectory
getCurrentDirectory: () => string;method getHomeDirectory
getHomeDirectory: () => string;interface Dirent
interface Dirent extends Stats {}property name
name: string;method isSymbolicLink
isSymbolicLink: () => boolean;interface EffectiveConfiguration
interface EffectiveConfiguration {}interface FileFilter
interface FileFilter {}method filter
filter: (file: ts.SourceFile) => boolean;Returns
trueif the file should be linted, false if it should be filtered out. Intended for use inArray.prototype.filter.
interface FileFilterContext
interface FileFilterContext {}interface FileFilterFactory
interface FileFilterFactory {}method create
create: (context: FileFilterContext) => FileFilter;interface FileSystem
interface FileSystem {}Low level file system access. All methods are supposed to throw an error on failure.
method createDirectory
createDirectory: (dir: string) => void;Creates a single directory and fails on error. Is not supposed to create multiple directories.
method deleteFile
deleteFile: (path: string) => void;Deletes a given file. Is not supposed to delete or clear a directory.
method normalizePath
normalizePath: (path: string) => string;Normalizes the path to enable reliable caching in consuming services.
method readDirectory
readDirectory: (dir: string) => Array<string | Dirent>;Reads directory entries. Returns only the basenames optionally with file type information.
method readFile
readFile: (file: string) => string;Reads the given file. Tries to infer and convert encoding.
method realpath
realpath: (path: string) => string;Gets the realpath of a given file or directory.
method stat
stat: (path: string) => Stats;Gets the status of a file or directory.
method writeFile
writeFile: (file: string, content: string) => void;Writes content to the file, overwriting the existing content. Creates the file if necessary.
interface Finding
interface Finding {}interface FindingFilter
interface FindingFilter {}method filter
filter: (finding: Finding) => boolean;Returns
trueif the finding should be used, false if it should be filtered out. Intended for use inArray.prototype.filter.
method reportUseless
reportUseless: (severity: Severity) => ReadonlyArray<Finding>;Returns
Findings to report redundant or unused filter directives. This is called after calling
filterfor all findings in the file.
interface FindingFilterContext
interface FindingFilterContext {}property ruleNames
ruleNames: ReadonlyArray<string>;property sourceFile
sourceFile: ts.SourceFile;method getWrappedAst
getWrappedAst: () => WrappedAst;interface FindingFilterFactory
interface FindingFilterFactory {}method create
create: (context: FindingFilterContext) => FindingFilter;interface FindingPosition
interface FindingPosition {}interface Fix
interface Fix {}property replacements
readonly replacements: ReadonlyArray<Replacement>;interface FormatterConstructor
interface FormatterConstructor {}construct signature
new (): AbstractFormatter;interface FormatterLoaderHost
interface FormatterLoaderHost {}method loadCoreFormatter
loadCoreFormatter: (name: string) => FormatterConstructor | undefined;method loadCustomFormatter
loadCustomFormatter: ( name: string, basedir: string) => FormatterConstructor | undefined;interface LineSwitchParser
interface LineSwitchParser {}method parse
parse: (context: LineSwitchParserContext) => ReadonlyArray<RawLineSwitch>;interface LineSwitchParserContext
interface LineSwitchParserContext {}property sourceFile
sourceFile: ts.SourceFile;method getCommentAtPosition
getCommentAtPosition: (pos: number) => ts.CommentRange | undefined;interface LintAndFixFileResult
interface LintAndFixFileResult {}interface LoadConfigurationContext
interface LoadConfigurationContext {}interface MessageHandler
interface MessageHandler {}interface ProcessorConstructor
interface ProcessorConstructor {}method getSuffixForFile
getSuffixForFile: (context: ProcessorSuffixContext) => string;construct signature
new (context: ProcessorContext): AbstractProcessor;interface ProcessorContext
interface ProcessorContext {}property settings
settings: Settings;property source
source: string;property sourceFileName
sourceFileName: string;property targetFileName
targetFileName: string;interface ProcessorSuffixContext
interface ProcessorSuffixContext {}property fileName
fileName: string;method getSettings
getSettings: () => Settings;method readFile
readFile: () => string;interface ProcessorUpdateResult
interface ProcessorUpdateResult {}property changeRange
changeRange?: ts.TextChangeRange;property transformed
transformed: string;interface RawLineSwitch
interface RawLineSwitch {}interface RawLineSwitchRule
interface RawLineSwitchRule {}property fixLocation
readonly fixLocation?: Readonly<ts.TextRange>;property location
readonly location?: Readonly<ts.TextRange>;property predicate
readonly predicate: string | RegExp | ((ruleName: string) => boolean);interface ReducedConfiguration
interface ReducedConfiguration extends EffectiveConfiguration {}property processor
processor: string | undefined;interface Replacement
interface Replacement {}interface Resolver
interface Resolver {}method getDefaultExtensions
getDefaultExtensions: () => ReadonlyArray<string>;method require
require: (id: string, options?: { cache?: boolean }) => any;method resolve
resolve: ( id: string, basedir?: string, extensions?: ReadonlyArray<string>, paths?: ReadonlyArray<string>) => string;interface RuleConstructor
interface RuleConstructor<T extends RuleContext = RuleContext> {}property deprecated
readonly deprecated?: boolean | string;property requiresTypeInformation
readonly requiresTypeInformation: boolean;property supports
supports?: RulePredicate;construct signature
new (context: T): AbstractRule;interface RuleContext
interface RuleContext extends RulePredicateContext {}property sourceFile
readonly sourceFile: ts.SourceFile;method addFinding
addFinding: ( start: number, end: number, message: string, fix?: Replacement | ReadonlyArray<Replacement>) => void;method getFlatAst
getFlatAst: () => ReadonlyArray<ts.Node>;method getWrappedAst
getWrappedAst: () => WrappedAst;interface RuleLoaderHost
interface RuleLoaderHost {}method loadCoreRule
loadCoreRule: (name: string) => RuleConstructor | undefined;method loadCustomRule
loadCustomRule: (name: string, directory: string) => RuleConstructor | undefined;interface RulePredicateContext
interface RulePredicateContext {}property compilerOptions
readonly compilerOptions?: ts.CompilerOptions;property options
readonly options: {} | null | undefined;property program
readonly program?: ts.Program;property settings
readonly settings: Settings;interface StatePersistence
interface StatePersistence {}interface StaticProgramState
interface StaticProgramState {}property cs
readonly cs: boolean;Whether the state was created using case-sensitive file names
property files
readonly files: readonly StaticProgramState.FileState[];Information about all files in the program
property global
readonly global: readonly number[];Index of files that affect global scope
property lookup
readonly lookup: Readonly<Record<string, number>>;Maps filename to index in 'files' array
property options
readonly options: string;Hash of compilerOptions
property ts
readonly ts: string;TypeScript version
property v
readonly v: number;Version of the cache format
interface Stats
interface Stats {}method isDirectory
isDirectory: () => boolean;method isFile
isFile: () => boolean;interface TypedRuleContext
interface TypedRuleContext extends RuleContext {}property compilerOptions
readonly compilerOptions: ts.CompilerOptions;property program
readonly program: ts.Program;Enums
enum DeprecationTarget
enum DeprecationTarget { Rule = 'rule', Processor = 'processor', Formatter = 'formatter',}Type Aliases
type ContentIdHost
type ContentIdHost = Pick<ts.CompilerHost, 'readFile'>;type FileSummary
type FileSummary = LintAndFixFileResult;type LintResult
type LintResult = Iterable<[string, FileSummary]>;type RulePredicate
type RulePredicate = ( sourceFile: ts.SourceFile, context: RulePredicateContext) => boolean | string;Returns
true,falseor a reason
type Settings
type Settings = ReadonlyMap<string, {} | null | undefined>;type Severity
type Severity = 'error' | 'warning' | 'suggestion';Namespaces
namespace Configuration
namespace Configuration {}interface Alias
interface Alias {}property options
readonly options?: any;property rule
readonly rule: string;property rulesDirectories
readonly rulesDirectories: ReadonlyArray<string> | undefined;interface Override
interface Override {}interface RuleConfig
interface RuleConfig {}property options
readonly options?: any;property rule
readonly rule: string;property rulesDirectories
readonly rulesDirectories: ReadonlyArray<string> | undefined;property severity
readonly severity?: RuleSeverity;type RulesDirectoryMap
type RulesDirectoryMap = ReadonlyMap<string, ReadonlyArray<string>>;type RuleSeverity
type RuleSeverity = 'off' | 'warning' | 'error' | 'suggestion';namespace EffectiveConfiguration
namespace EffectiveConfiguration {}interface RuleConfig
interface RuleConfig {}property options
options: any;property rule
rule: string;property rulesDirectories
rulesDirectories: ReadonlyArray<string> | undefined;property severity
severity: Configuration.RuleSeverity;namespace StaticProgramState
namespace StaticProgramState {}interface FileState
interface FileState {}property config
readonly config?: string;Hash of the configuration used to produce
resultfor this file
property dependencies
readonly dependencies?: Readonly<Record<string, null | readonly number[]>>;Key: module specifier as referenced in the file, order may be random Value: -
nullif dependency could not be resolved - List of files (or rather their index) that the module specifier resolves to. That is the actual file at that path and/or files containingdeclare module "..."for that module specifier. May contain the current file. This list is ordered by the ID of the files ascending,
property id
readonly id: string;ID of file contents (typically a hash)
property result
readonly result?: readonly Finding[];The list of findings if this file has up-to-date results
Package Files (1)
Dependencies (3)
Dev Dependencies (1)
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@fimbul/ymir.
- Markdown[](https://www.jsdocs.io/package/@fimbul/ymir)
- HTML<a href="https://www.jsdocs.io/package/@fimbul/ymir"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6281 ms. - Missing or incorrect documentation? Open an issue for this package.
