Options
All
  • Public
  • Public/Protected
  • All
Menu

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

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

Hierarchy

  • Warning_

Index

Constructors

  • Parameters

    • text: string

      Warning message.

    • Optional opts: WarningOptions

      Warning options.

    Returns Warning_

Properties

column: number

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

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

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

warning.endColumn //=> 4
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'
    

    Returns string

    Warning position and message.