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

Fix css EOF duplicate errors #4816

Merged
merged 3 commits into from
Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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