Skip to content

Commit

Permalink
Improve warning messages (#9608)
Browse files Browse the repository at this point in the history
* drop experimental log

* reword some warning messages
  • Loading branch information
RobinMalfait committed Oct 19, 2022
1 parent ea5b11c commit 7f73608
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
13 changes: 3 additions & 10 deletions src/corePlugins.js
Expand Up @@ -159,13 +159,6 @@ export let variantPlugins = {
matchVariant(
name,
(value = '', extra) => {
if (extra.modifier) {
log.warn(`modifier-${name}-experimental`, [
`The ${name} variant modifier feature in Tailwind CSS is currently in preview.`,
'Preview features are not covered by semver, and may be improved in breaking ways at any time.',
])
}

let result = normalize(typeof value === 'function' ? value(extra) : value)
if (!result.includes('&')) result = '&' + result

Expand Down Expand Up @@ -309,19 +302,19 @@ export let variantPlugins = {
return (value) => {
if (!areSimpleScreens) {
log.warn('complex-screen-config', [
'The min and max variants are not supported with a screen configuration containing objects.',
'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects.',
])

return []
} else if (!screensUseConsistentUnits) {
log.warn('mixed-screen-units', [
'The min and max variants are not supported with a screen configuration containing mixed units.',
'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
])

return []
} else if (typeof value === 'string' && !canUseUnits(value)) {
log.warn('minmax-have-mixed-units', [
'The min and max variants are not supported with a screen configuration containing mixed units.',
'The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units.',
])

return []
Expand Down
10 changes: 4 additions & 6 deletions src/lib/findAtConfigPath.js
Expand Up @@ -16,24 +16,22 @@ export function findAtConfigPath(root, result) {

if (relativeTo === null) {
throw rule.error(
'The `@config` at-rule cannot be used without a `from` option being set on the PostCSS config.'
'The `@config` directive cannot be used without setting `from` in your PostCSS config.'
)
}

if (configPath) {
throw rule.error('Only `@config` at-rule is allowed per file.')
throw rule.error('Only one `@config` directive is allowed per file.')
}

let matches = rule.params.match(/(['"])(.*?)\1/)
if (!matches) {
throw rule.error(
'The `@config` at-rule must be followed by a string containing the path to the config file.'
)
throw rule.error('A path is required when using the `@config` directive.')
}

let inputPath = matches[2]
if (path.isAbsolute(inputPath)) {
throw rule.error('The `@config` at-rule cannot be used with an absolute path.')
throw rule.error('The `@config` directive cannot be used with an absolute path.')
}

configPath = path.resolve(path.dirname(relativeTo), inputPath)
Expand Down

0 comments on commit 7f73608

Please sign in to comment.