question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Locate missing/extra braces for parsing error

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.9.1
  • Node Version: 7.0.0
  • npm Version: 3.10.8

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

{
    "rules": {
        "curly": "error"
    }
}

What did you do? Please include the actual source code causing the issue.

function test(a) {
    if (a) 
        doSomething();
    }
    
    doSomethingElse();
}

test(a);

What did you expect to happen?

  2:5  error  Expected { after 'if' condition  curly
  7:1  error  Parsing error: Unexpected token }

✖ 2 problem (2 error, 0 warnings)

What actually happened? Please include the actual, raw output from ESLint.

  7:1  error  Parsing error: Unexpected token }

✖ 1 problem (1 error, 0 warnings)

Actually, I think it works as intended since ESLint have to build the AST first. But it would be nice if we can get the line number of missing braces. The advantage becomes bigger while working on large files.

Perhaps to make the parser generate a “partial AST” for specific parsing error, or let the rule be able to do some additional check that doesn’t depend on the AST.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
platinumazurecommented, Dec 6, 2016

Again, looking at this from a cost-benefit analysis, I don’t think the benefits are anywhere near the massive costs (rewriting the parser and ESLint architecture plus the maintenance headache from maintaining two kinds of rules).

I’m happy to step back and let the TSC weigh in, but I can virtually guarantee this is a non-starter. ESLint depends on a full AST, period, there is no such thing as linting half a file.

0reactions
vitorbalcommented, Dec 7, 2016

Thanks for the suggestion, we really appreciate the interest in helping us improve ESLint. However, it seems like the team has a pretty clear position against this suggestion. I’m going to go ahead and close the issue, but feel free to discuss anything you feel is not clear yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Find missing braces in large PHP file? - Stack Overflow
In most IDEs, you can find the missing braces by looking for the place where every single line becomes an error. – kitti....
Read more >
Reached end of file while parsing - Net-Informations.Com
Java compile error: reached end of file while parsing It is a compiler error and almost ... The only purpose of the extra...
Read more >
SyntaxError: missing } after function body - JavaScript | MDN
The JavaScript exception "missing } after function body" occurs when there is a syntax mistake when creating a function somewhere. Check if any...
Read more >
Unparsable structured data report - Search Console Help
Error types ; Parsing error: Missing ':', Missing a ':' mark between a field and value. ; Parsing error: Missing ',' or '}',...
Read more >
Commented closing braces are not taking into account in iRules
... brace, the F5 does not throw any error about a missing brace. ... for this odd feature was to keep the original...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found