Check ignore next warning comments in a warn() helper

This commit is contained in:
dualfroz committed 2026-10-05 23:11:46 +02:00
1 parent e47232149a
commit dc4f2415a8
7 files changed
+121 -82

No files matched your search

+3 -2
View File
@@ -370,9 +370,10 @@ class Gradient extends Value {
/^(calc|min|max|clamp)$/i.test(tokens[0].value)))
) {
if (decl && result) {
decl.warn(
utils.warn(
result,
'Gradient color hints are not supported by old WebKit'
'Gradient color hints are not supported by old WebKit',
{ node: decl }
)
}
return false
+4 -3
View File
@@ -1,5 +1,5 @@
let Declaration = require('../declaration')
let { isPureNumber } = require('../utils')
let { isPureNumber, warn } = require('../utils')
class GridEnd extends Declaration {
/**
@@ -34,9 +34,10 @@ class GridEnd extends Declaration {
return undefined
}
} else {
decl.warn(
warn(
result,
`Can not prefix ${decl.prop} (${startProp} is not found)`
`Can not prefix ${decl.prop} (${startProp} is not found)`,
{ node: decl }
)
}
}
+7 -4
View File
@@ -1,5 +1,6 @@
let Declaration = require('../declaration')
let Processor = require('../processor')
let { warn } = require('../utils')
let {
autoplaceGridItems,
getGridGap,
@@ -66,9 +67,10 @@ class GridRowsColumns extends Declaration {
if (!rowDecl && hasGridTemplate) {
return undefined
} else if (!rowDecl && !hasGridTemplate) {
decl.warn(
warn(
result,
'Autoplacement does not work without grid-template-rows property'
'Autoplacement does not work without grid-template-rows property',
{ node: decl }
)
return undefined
}
@@ -80,9 +82,10 @@ class GridRowsColumns extends Declaration {
return i.prop === 'grid-template-columns'
})
if (!columnDecl && !hasGridTemplate) {
decl.warn(
warn(
result,
'Autoplacement does not work without grid-template-columns property'
'Autoplacement does not work without grid-template-columns property',
{ node: decl }
)
}
+13 -9
View File
@@ -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
})
}
}