-
Notifications
You must be signed in to change notification settings - Fork 21
Extract isDefinition
helper
#196
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
Conversation
@@ -10,5 +10,7 @@ module.exports = { | |||
ignorePatterns: ['temp', 'scip.ts', 'snapshots'], | |||
rules: { | |||
'no-sync': 'off', | |||
'jsdoc/check-indentation': 'off', | |||
'class-methods-use-this': 'error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up on this comment by @varungandhi-src. This rule forbids class methods without instance context usage. @olafurpg, let me know what you think about that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice. Big +1 from me
@@ -707,3 +681,46 @@ function isEqualArray<T>(a: T[], b: T[]): boolean { | |||
} | |||
return true | |||
} | |||
|
|||
function declarationName(node: ts.Node): ts.Node | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted into an independent function to satisfy the class-methods-use-this
ESLint rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a big improvement in readability to have a toplevel function instead of an instance method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻 Very nice!
@@ -10,5 +10,7 @@ module.exports = { | |||
ignorePatterns: ['temp', 'scip.ts', 'snapshots'], | |||
rules: { | |||
'no-sync': 'off', | |||
'jsdoc/check-indentation': 'off', | |||
'class-methods-use-this': 'error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nice. Big +1 from me
@@ -707,3 +681,46 @@ function isEqualArray<T>(a: T[], b: T[]): boolean { | |||
} | |||
return true | |||
} | |||
|
|||
function declarationName(node: ts.Node): ts.Node | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a big improvement in readability to have a toplevel function instead of an instance method.
This PR improves the readability of the
isDefinition
logic. Follow-up on this comment.Test plan
Tests are green, and the comment on the
isDefinition
function looks ok.