Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Better error message for anonymous class declarations #509

Merged
merged 1 commit into from May 10, 2017

Conversation

rattrayalex
Copy link
Contributor

Q A
Bug fix? no
Breaking change? no
New feature? no
Deprecations? no
Spec compliancy? yes
Tests added/pass? yes
Fixed tickets --
License MIT

Given code like:

class {}

or

class extends Bar {}

Instead of Unexpected token (1:6), get Class name required (1:6)

@codecov
Copy link

codecov bot commented May 4, 2017

Codecov Report

Merging #509 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #509   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files          22       22           
  Lines        3524     3524           
  Branches      977      977           
=======================================
  Hits         3463     3463           
  Misses         22       22           
  Partials       39       39
Flag Coverage Δ
#babel 80.98% <0%> (ø) ⬆️
#babylon 97.1% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/parser/statement.js 99.08% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e12f56...e2014e2. Read the comment docs.

Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it - dono if anyone else had opinions on the message itself

other suggestions: (probably bad since maybe shorter is better in this case) - most of the time you would have the codeframe anyway with Babel.

  • a class name is required
  • class names are required if not a default export

@rattrayalex
Copy link
Contributor Author

rattrayalex commented May 4, 2017 via email

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like "A class name is required" as well

Copy link
Member

@xtuc xtuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎 Nice work

@rattrayalex
Copy link
Contributor Author

Awesome, thanks guys! Updated to A class name is required

@danez danez merged commit 4e776bf into babel:master May 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants