mirror of
https://github.com/hanzoai/postcss.git
synced 2026-09-24 17:01:56 +00:00
Throw an error if a declaration being added lacks a .prop or .value
This commit is contained in:
@@ -411,6 +411,9 @@ export default class Container extends Node {
|
||||
} else if ( nodes.type ) {
|
||||
nodes = [nodes];
|
||||
} else if ( nodes.prop ) {
|
||||
if (nodes.value === undefined) {
|
||||
throw this.error("Could not construct declaration; 'value' field unspecified.");
|
||||
}
|
||||
nodes = [new Declaration(nodes)];
|
||||
} else if ( nodes.selector ) {
|
||||
import Rule from './rule';
|
||||
@@ -420,6 +423,8 @@ export default class Container extends Node {
|
||||
nodes = [new AtRule(nodes)];
|
||||
} else if ( nodes.text ) {
|
||||
nodes = [new Comment(nodes)];
|
||||
} else {
|
||||
throw this.error("Could not infer node type. Try checking your field names?");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user