-
Notifications
You must be signed in to change notification settings - Fork 0
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
AA-13801 Create no-declare
rule to prevent using declare
keyword
#1
Conversation
5edd0ed
to
e9bb868
Compare
package.json
Outdated
@@ -0,0 +1,40 @@ | |||
{ | |||
"name": "@livechat/eslint-plugin", | |||
"version": "0.1.7", |
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.
Why such a strange version? Shouldn't we start with 1.0.0?
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 my working version, I will replace it with 1.0.0 when task is ready to merge
src/rules/no-declare.ts
Outdated
create(context, [options]) { | ||
const { onlyIdentifiers, excludeIdentifiers } = options; | ||
const onlyIdentifiersEnabled = | ||
onlyIdentifiers && onlyIdentifiers?.length > 0; |
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.
onlyIdentifiers && onlyIdentifiers?.length > 0; | |
!!onlyIdentifiers?.length; |
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.
done 😆
src/rules/no-declare.ts
Outdated
const onlyIdentifiersEnabled = | ||
onlyIdentifiers && onlyIdentifiers?.length > 0; | ||
const excludeIdentifiersEnabled = | ||
excludeIdentifiers && excludeIdentifiers.length > 0; |
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.
!!excludeIdentifiers.length
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.
done 😛
src/rules/no-declare.ts
Outdated
|
||
return { | ||
VariableDeclaration(node) { | ||
if (node.declare) { |
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.
if (node.declare) { | |
if (!node.declare) { | |
return | |
} |
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.
ok
…> CR > return early
…> CR > More readable checks
Jira: https://livechatinc.atlassian.net/browse/AA-13801