source: frontend/node_modules/postcss/lib/warning.d.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[9af201e]1import { RangePosition } from './css-syntax-error.js'
2import Node from './node.js'
3
4declare namespace Warning {
5 export interface WarningOptions {
6 /**
7 * End position, exclusive, in CSS node string that caused the warning.
8 */
9 end?: RangePosition
10
11 /**
12 * End index, exclusive, in CSS node string that caused the warning.
13 */
14 endIndex?: number
15
16 /**
17 * Start index, inclusive, in CSS node string that caused the warning.
18 */
19 index?: number
20
21 /**
22 * CSS node that caused the warning.
23 */
24 node?: Node
25
26 /**
27 * Name of the plugin that created this warning. `Result#warn` fills
28 * this property automatically.
29 */
30 plugin?: string
31
32 /**
33 * Start position, inclusive, in CSS node string that caused the warning.
34 */
35 start?: RangePosition
36
37 /**
38 * Word in CSS source that caused the warning.
39 */
40 word?: string
41 }
42
43 export { Warning_ as default }
44}
45
46/**
47 * Represents a plugin’s warning. It can be created using `Node#warn`.
48 *
49 * ```js
50 * if (decl.important) {
51 * decl.warn(result, 'Avoid !important', { word: '!important' })
52 * }
53 * ```
54 */
55declare class Warning_ {
56 /**
57 * Column for inclusive start position in the input file with this warning’s source.
58 *
59 * ```js
60 * warning.column //=> 6
61 * ```
62 */
63 column: number
64
65 /**
66 * Column for exclusive end position in the input file with this warning’s source.
67 *
68 * ```js
69 * warning.endColumn //=> 4
70 * ```
71 */
72 endColumn?: number
73
74 /**
75 * Line for exclusive end position in the input file with this warning’s source.
76 *
77 * ```js
78 * warning.endLine //=> 6
79 * ```
80 */
81 endLine?: number
82
83 /**
84 * Line for inclusive start position in the input file with this warning’s source.
85 *
86 * ```js
87 * warning.line //=> 5
88 * ```
89 */
90 line: number
91
92 /**
93 * Contains the CSS node that caused the warning.
94 *
95 * ```js
96 * warning.node.toString() //=> 'color: white !important'
97 * ```
98 */
99 node: Node
100
101 /**
102 * The name of the plugin that created this warning.
103 * When you call `Node#warn` it will fill this property automatically.
104 *
105 * ```js
106 * warning.plugin //=> 'postcss-important'
107 * ```
108 */
109 plugin: string
110
111 /**
112 * The warning message.
113 *
114 * ```js
115 * warning.text //=> 'Try to avoid !important'
116 * ```
117 */
118 text: string
119
120 /**
121 * Type to filter warnings from `Result#messages`.
122 * Always equal to `"warning"`.
123 */
124 type: 'warning'
125
126 /**
127 * @param text Warning message.
128 * @param opts Warning options.
129 */
130 constructor(text: string, opts?: Warning.WarningOptions)
131
132 /**
133 * Returns a warning position and message.
134 *
135 * ```js
136 * warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important'
137 * ```
138 *
139 * @return Warning position and message.
140 */
141 toString(): string
142}
143
144declare class Warning extends Warning_ {}
145
146export = Warning
Note: See TracBrowser for help on using the repository browser.