Check ignore next warning comments in a warn() helper
This commit is contained in:
1 parent
e47232149a
commit
dc4f2415a8
7 files changed
+121
-82
No files matched your search
+13
-9
@@ -4,6 +4,7 @@ let list = require('postcss').list
|
||||
let uniq = require('../utils').uniq
|
||||
let escapeRegexp = require('../utils').escapeRegexp
|
||||
let splitSelector = require('../utils').splitSelector
|
||||
let warn = require('../utils').warn
|
||||
|
||||
const GAP_PROPS = /^(grid-)?((row|column)-)?gap$/
|
||||
|
||||
@@ -758,7 +759,9 @@ function warnMissedAreas(areas, decl, result) {
|
||||
})
|
||||
|
||||
if (missed.length > 0) {
|
||||
decl.warn(result, 'Can not find grid areas: ' + missed.join(', '))
|
||||
warn(result, 'Can not find grid areas: ' + missed.join(', '), {
|
||||
node: decl
|
||||
})
|
||||
}
|
||||
|
||||
return undefined
|
||||
@@ -828,11 +831,12 @@ function warnTemplateSelectorNotFound(decl, result) {
|
||||
|
||||
// warn user if we didn't find template
|
||||
if (!gridTemplateFound && duplicatesFound) {
|
||||
decl.warn(
|
||||
warn(
|
||||
result,
|
||||
'Autoprefixer cannot find a grid-template ' +
|
||||
`containing the duplicate grid-area "${decl.value}" ` +
|
||||
`with full selector matching: ${slicedSelectorArr.join(' ')}`
|
||||
`with full selector matching: ${slicedSelectorArr.join(' ')}`,
|
||||
{ node: decl }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -861,10 +865,11 @@ function warnIfGridRowColumnExists(decl, result) {
|
||||
})
|
||||
if (decls.length > 0) {
|
||||
decls.forEach(d => {
|
||||
d.warn(
|
||||
warn(
|
||||
result,
|
||||
'You already have a grid-area declaration present in the rule. ' +
|
||||
`You should use either grid-area or ${d.prop}, not both`
|
||||
`You should use either grid-area or ${d.prop}, not both`,
|
||||
{ node: d }
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -1058,10 +1063,9 @@ function warnGridGap({ decl, gap, hasColumns, result }) {
|
||||
let hasBothGaps = gap.row && gap.column
|
||||
if (!hasColumns && (hasBothGaps || (gap.column && !gap.row))) {
|
||||
delete gap.column
|
||||
decl.warn(
|
||||
result,
|
||||
'Can not implement grid-gap without grid-template-columns'
|
||||
)
|
||||
warn(result, 'Can not implement grid-gap without grid-template-columns', {
|
||||
node: decl
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user