Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Fix: Calculate range correctly when class is exported (fixes #152) #153

Merged
merged 1 commit into from
Feb 5, 2017

Conversation

soda0289
Copy link
Member

@soda0289 soda0289 commented Feb 1, 2017

The range of a class body should be from the opening brace to the
closing brace. To find the opening brace the ast converter parses over
modifiers of the class declaration and assumes it is the last token
after the last node modifier. This assumption is not always true when the
class is exported. This commit ensures we only skip over modifiers
which are after the class name or heritage clause.

The range of a class body should be from the opening brace to the
closing brace. To find the opening brace the ast converter parses over
modifiers of the class declaration and assumes it is the last token
after the last node modifier. This assumption is not always true when the
class is exported. This commit ensures we only skip over modifiers
which are after the class name or heritage clause.
@eslintbot
Copy link

LGTM

Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@nzakas nzakas merged commit e5f378f into eslint:master Feb 5, 2017
soda0289 added a commit to soda0289/typescript-eslint-parser that referenced this pull request Feb 7, 2017
…) (eslint#153)

The range of a class body should be from the opening brace to the
closing brace. To find the opening brace the ast converter parses over
modifiers of the class declaration and assumes it is the last token
after the last node modifier. This assumption is not always true when the
class is exported. This commit ensures we only skip over modifiers
which are after the class name or heritage clause.
soda0289 added a commit to soda0289/typescript-eslint-parser that referenced this pull request Feb 7, 2017
…slint#152)

When a class with a generic definition is exported we must take the
type parameters into account when finding the opening brace. This
continues the fix of pull request eslint#153 and handles the case of exporting
a class with generics. We now find the last type parameter and use the
succeeding token as the opening brace.
soda0289 added a commit to soda0289/typescript-eslint-parser that referenced this pull request Feb 7, 2017
…slint#152)

When a class with a generic definition is exported we must take the
type parameters into account when finding the opening brace. This
continues the fix of pull request eslint#153 and handles the case of exporting
a class with generics. We now find the last type parameter and use the
succeeding token as the opening brace.
soda0289 added a commit to soda0289/typescript-eslint-parser that referenced this pull request Feb 7, 2017
…nt#152)

When a class with a generic definition is exported we must take the
type parameters into account when finding the opening brace. This
continues the fix of pull request eslint#153 and handles the case of exporting
a class with generics. We now find the last type parameter and use the
succeeding token as the opening brace.
soda0289 added a commit to soda0289/typescript-eslint-parser that referenced this pull request Feb 7, 2017
…nt#152)

When a class with a generic definition is exported we must take the
type parameters into account when finding the opening brace. This
continues the fix of pull request eslint#153 and handles the case of exporting
a class with generics. We now find the last type parameter and use the
succeeding token as the opening brace.
@soda0289 soda0289 deleted the fix-class-body-range branch May 23, 2017 13:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants