1 |
|
2 | import * as stream from 'stream';
|
3 | import * as File from 'vinyl';
|
4 | import * as doc from './doc';
|
5 | import EditorConfigError = require('./editor-config-error');
|
6 | export declare let charsets: {
|
7 | '\u0000\u0000\u00FE\u00FF': string;
|
8 | '\u00EF\u00BB\u00BF': string;
|
9 | '\u00FE\u00FF': string;
|
10 | '\u00FF\u00FE': string;
|
11 | '\u00FF\u00FE\u0000\u0000': string;
|
12 | };
|
13 | export declare function configure(options: IConfigurationOptions): void;
|
14 | export interface IConfigurationOptions {
|
15 | newlines?: string[];
|
16 | }
|
17 | export interface ISettings {
|
18 | |
19 |
|
20 |
|
21 |
|
22 | charset?: string;
|
23 | |
24 |
|
25 |
|
26 | indent_style?: string;
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 | indent_size?: number | string;
|
33 | |
34 |
|
35 |
|
36 |
|
37 | tab_width?: number;
|
38 | |
39 |
|
40 |
|
41 | trim_trailing_whitespace?: boolean;
|
42 | |
43 |
|
44 |
|
45 | end_of_line?: string;
|
46 | |
47 |
|
48 |
|
49 | insert_final_newline?: boolean;
|
50 | |
51 |
|
52 |
|
53 | max_line_length?: number;
|
54 | block_comment?: string;
|
55 | block_comment_start?: string;
|
56 | block_comment_end?: string;
|
57 | }
|
58 | export interface IEditorConfigLintFile extends File {
|
59 | editorconfig?: IEditorConfigLintResult;
|
60 | contents: Buffer;
|
61 | }
|
62 | export interface IEditorConfigLintResult {
|
63 | config: ISettings;
|
64 | errors: EditorConfigError[];
|
65 | fixed: boolean;
|
66 | }
|
67 | export interface IRule {
|
68 | type: string;
|
69 | resolve(settings: ISettings): string | number | boolean;
|
70 | }
|
71 | export interface ILineRule extends IRule {
|
72 | check(settings: ISettings, line: doc.Line): EditorConfigError;
|
73 | fix(settings: ISettings, line: doc.Line): doc.Line;
|
74 | infer(line: doc.Line): string | number | boolean;
|
75 | }
|
76 | export interface IDocumentRule extends IRule {
|
77 | check(settings: ISettings, doc: doc.IDocument): EditorConfigError[];
|
78 | fix(settings: ISettings, doc: doc.IDocument): doc.IDocument;
|
79 | infer(doc: doc.IDocument): string | number | boolean;
|
80 | }
|
81 | export interface ICommandOptions {
|
82 | settings?: ISettings;
|
83 | }
|
84 | export declare type Command = (options?: ICommandOptions) => NodeJS.ReadWriteStream;
|
85 | export declare let ruleNames: string[];
|
86 | export interface ICheckCommandOptions extends ICommandOptions {
|
87 | reporter?: (file: IEditorConfigLintFile, error: EditorConfigError) => void;
|
88 | }
|
89 | export declare function check(options?: ICheckCommandOptions): stream.Transform;
|
90 | export declare function fix(options?: ICommandOptions): stream.Transform;
|
91 | export interface InferOptions {
|
92 | |
93 |
|
94 |
|
95 | score?: boolean;
|
96 | |
97 |
|
98 |
|
99 | ini?: boolean;
|
100 | |
101 |
|
102 |
|
103 | root?: boolean;
|
104 | }
|
105 | export interface IScoredSetting {
|
106 | [key: string]: {
|
107 | [key: string]: number;
|
108 | };
|
109 | }
|
110 | export interface IScoredSettings {
|
111 | charset?: IScoredSetting;
|
112 | indent_style?: IScoredSetting;
|
113 | indent_size?: IScoredSetting;
|
114 | trim_trailing_whitespace?: IScoredSetting;
|
115 | end_of_line?: IScoredSetting;
|
116 | insert_final_newline?: IScoredSetting;
|
117 | max_line_length?: number;
|
118 | }
|
119 | export declare function infer(options?: InferOptions): stream.Transform;
|
120 | export interface IOptions extends ICheckCommandOptions {
|
121 | fix?: boolean;
|
122 | }
|
123 | export default function eclint(options?: IOptions): stream.Transform;
|