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