Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
class Warning
Re-export
import { Warning } from "https://deno.land/x/postcss@8.4.16/lib/postcss.js";

Represents a plugin’s warning. It can be created using Node#warn.

if (decl.important) {
  decl.warn(result, 'Avoid !important', { word: '!important' })
}

Constructors

new
Warning(text: string, opts?: WarningOptions)

Properties

column: number

Column for inclusive start position in the input file with this warning’s source.

warning.column //=> 6
optional
endColumn: number

Column for exclusive end position in the input file with this warning’s source.

warning.endColumn //=> 4
optional
endLine: number

Line for exclusive end position in the input file with this warning’s source.

warning.endLine //=> 6
line: number

Line for inclusive start position in the input file with this warning’s source.

warning.line //=> 5
node: Node

Contains the CSS node that caused the warning.

warning.node.toString() //=> 'color: white !important'
plugin: string

The name of the plugin that created this warning. When you call Node#warn it will fill this property automatically.

warning.plugin //=> 'postcss-important'
text: string

The warning message.

warning.text //=> 'Try to avoid !important'
type: "warning"

Type to filter warnings from Result#messages. Always equal to "warning".

Methods

toString(): string

Returns a warning position and message.

warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important'