AK-21/Graphite-Industrial-Intelligence
0
1'use strict'2 3class Warning {4 constructor(text, opts = {}) {5 this.type = 'warning'6 this.text = text7 8 if (opts.node && opts.node.source) {9 let range = opts.node.rangeBy(opts)10 this.line = range.start.line11 this.column = range.start.column12 this.endLine = range.end.line13 this.endColumn = range.end.column14 }15 16 for (let opt in opts) this[opt] = opts[opt]17 }18 19 toString() {20 if (this.node) {21 return this.node.error(this.text, {22 index: this.index,23 plugin: this.plugin,24 word: this.word25 }).message26 }27 28 if (this.plugin) {29 return this.plugin + ': ' + this.text30 }31 32 return this.text33 }34}35 36module.exports = Warning37Warning.default = Warning38 