{"record":{"id":"071ed8388823e4e1","repo":"swc-project/swc","slug":"unexpected-in-declaration-value","errorCode":null,"errorMessage":"Unexpected '!' in declaration value","messagePattern":"Unexpected '!' in declaration value","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/syntax/mod.rs","lineNumber":672,"sourceCode":"        let mut important_ident = None;\n\n        loop {\n            if is!(self, EOF) {\n                break;\n            }\n\n            let component_value = self.parse_as::<ComponentValue>()?;\n\n            match &component_value {\n                // Optimization for step 6\n                ComponentValue::PreservedToken(token_and_span)\n                    if matches!(token_and_span.token, Token::Delim { value: '!', .. })\n                        && (is!(self, \" \") || is_case_insensitive_ident!(self, \"important\")) =>\n                {\n                    if let Some(span) = &exclamation_point_span {\n                        is_valid_to_canonicalize = false;\n\n                        self.errors.push(Error::new(\n                            *span,\n                            ErrorKind::Unexpected(\"'!' in declaration value\"),\n                        ));\n\n                        important_ident = None;\n                        last_whitespaces = (last_whitespaces.2, 0, 0);\n                    }\n\n                    exclamation_point_span = Some(token_and_span.span);\n                }\n                ComponentValue::PreservedToken(token_and_span)\n                    if matches!(token_and_span.token, Token::WhiteSpace { .. }) =>\n                {\n                    match (&exclamation_point_span, &important_ident) {\n                        (Some(_), Some(_)) => {\n                            last_whitespaces.2 += 1;\n                        }\n                        (Some(_), None) => {","sourceCodeStart":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/syntax/mod.rs#L654-L690","documentation":"Fired while consuming a declaration value: a '!' delimiter was found where it cannot form a valid '!important' flag (not followed by whitespace plus the 'important' ident). Per the CSS grammar the '!' is a preserved token that makes the declaration value invalid, so the parser reports it instead of silently accepting the declaration.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/syntax/mod.rs:672 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Write the flag as '! important' or '!important' followed by the ident 'important'","Remove the stray '!' if importance was not intended"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}