1 | import { ConfigurationProvider, Resolver, LoadConfigurationContext, Configuration, CacheFactory, BuiltinResolver } from '@fimbul/ymir';
|
2 | import { CachedFileSystem } from '../cached-file-system';
|
3 | export interface RawConfiguration {
|
4 | aliases?: RawConfiguration.AliasMap;
|
5 | rules?: RawConfiguration.RuleMap;
|
6 | settings?: RawConfiguration.SettingsMap;
|
7 | extends?: string | ReadonlyArray<string>;
|
8 | overrides?: ReadonlyArray<RawConfiguration.Override>;
|
9 | rulesDirectories?: RawConfiguration.RulesDirectoryMap;
|
10 | exclude?: string | ReadonlyArray<string>;
|
11 | processor?: string | null | false;
|
12 | }
|
13 | export declare namespace RawConfiguration {
|
14 | type RuleSeverity = 'off' | 'warn' | 'warning' | 'error' | 'suggestion' | 'hint';
|
15 | interface RuleConfig {
|
16 | severity?: RuleSeverity;
|
17 | options?: any;
|
18 | }
|
19 | type RuleConfigValue = RuleSeverity | RuleConfig | null;
|
20 | interface Override {
|
21 | files: string | ReadonlyArray<string>;
|
22 | rules?: RuleMap;
|
23 | settings?: SettingsMap;
|
24 | processor?: string | null | false;
|
25 | }
|
26 | interface Alias {
|
27 | rule: string;
|
28 | options?: any;
|
29 | }
|
30 | interface RuleMap {
|
31 | [key: string]: RawConfiguration.RuleConfigValue;
|
32 | }
|
33 | interface AliasMap {
|
34 | [prefix: string]: {
|
35 | [name: string]: RawConfiguration.Alias | null | false | string;
|
36 | } | null | false;
|
37 | }
|
38 | interface RulesDirectoryMap {
|
39 | [prefix: string]: string;
|
40 | }
|
41 | interface SettingsMap {
|
42 | [key: string]: any;
|
43 | }
|
44 | }
|
45 | export declare const CONFIG_EXTENSIONS: string[];
|
46 | export declare const CONFIG_FILENAMES: string[];
|
47 | export declare class DefaultConfigurationProvider implements ConfigurationProvider {
|
48 | private fs;
|
49 | private resolver;
|
50 | private builtinResolver;
|
51 | private cache;
|
52 | constructor(fs: CachedFileSystem, resolver: Resolver, builtinResolver: BuiltinResolver, cache: CacheFactory);
|
53 | find(fileToLint: string): string | undefined;
|
54 | private findConfigForDirectory;
|
55 | resolve(name: string, basedir: string): string;
|
56 | load(filename: string, context: LoadConfigurationContext): Configuration;
|
57 | parse(raw: RawConfiguration, filename: string, context: LoadConfigurationContext): Configuration;
|
58 | read(filename: string): RawConfiguration;
|
59 | private mapOverride;
|
60 | private mapProcessor;
|
61 | }
|