Skip to content

Commit

Permalink
fix: Fix css EOF duplicate errors #4816
Browse files Browse the repository at this point in the history
Fix css EOF duplicate errors
  • Loading branch information
andrewnester authored Jun 8, 2022
2 parents 3f93451 + 1e4f9a2 commit 48176f6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/ace/mode/css/csslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -1877,10 +1877,12 @@ Parser.prototype = function() {

value = new PropertyName(propertyName, hack, line || token.startLine, col || token.startCol);
this._readWhitespace();
} else if (tokenStream.peek() === Tokens.RBRACE) {
// Encountered when there are no more properties.
} else {
this._unexpectedToken(tokenStream.LT(1));
var tt = tokenStream.peek();
// If this isn't an right brace or the end of the file throw an SyntaxError.
if (tt !== Tokens.EOF && tt !== Tokens.RBRACE) {
this._unexpectedToken(tokenStream.LT(1));
}
}

return value;
Expand Down Expand Up @@ -3129,7 +3131,7 @@ Parser.prototype = function() {
if (tt === Tokens.SEMICOLON) {
// if there's a semicolon, then there might be another declaration
this._readDeclarations(false, readMargins);
} else if (tt !== Tokens.RBRACE) {
} else if (tt !== Tokens.EOF && tt !== Tokens.RBRACE) {
// if there's a right brace, the rule is finished so don't do anything
// otherwise, rethrow the error because it wasn't handled properly
throw ex;
Expand Down

0 comments on commit 48176f6

Please sign in to comment.