Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve warning messages #9608

Merged
merged 2 commits into from Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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