Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(eslint-plugin): [no-unused-vars] SelfReferenced should see varsIgnorePattern#2679

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

aggmoulik
Copy link
Contributor

@aggmoulikaggmoulik commentedOct 16, 2020
edited
Loading

Fix:#2648
Signed-off-by: Moulik Aggarwalqwertymoulik@gmail.com

HolgerJeromin reacted with heart emoji
…norePatternSigned-off-by: Moulik Aggarwal <qwertymoulik@gmail.com>
@typescript-eslint
Copy link
Contributor

Thanks for the PR,@aggmoulik!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitorsper day.

@codecov
Copy link

codecovbot commentedOct 16, 2020
edited
Loading

Codecov Report

Merging#2679 intomaster willdecrease coverage by0.02%.
The diff coverage is25.00%.

@@            Coverage Diff             @@##           master    #2679      +/-   ##==========================================- Coverage   92.82%   92.79%   -0.03%==========================================  Files         294      294                Lines        9670     9674       +4       Branches     2712     2715       +3     ==========================================+ Hits         8976     8977       +1- Misses        328      329       +1- Partials      366      368       +2
FlagCoverage Δ
#unittest92.79% <25.00%> (-0.03%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

Impacted FilesCoverage Δ
packages/eslint-plugin/src/rules/no-unused-vars.ts90.56% <25.00%> (-2.58%)⬇️

});
if (
varsIgnorePattern &&
varsIgnorePattern.toString() !== variable.name

Choose a reason for hiding this comment

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

varsIgnorePattern is a regexp (or perhaps still a regexp string).

See usage in eslint:
if (config.varsIgnorePattern && config.varsIgnorePattern.test(def.name.name)) {

https://github.com/eslint/eslint/blob/551b1e9fbc463db4869e738a8228868f7323788c/lib/rules/no-unused-vars.js#L590

Choose a reason for hiding this comment

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

And this error should be reported also when novarsIgnorePattern is given.

Choose a reason for hiding this comment

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

Do we need a similar change in line 148?

Copy link
ContributorAuthor

@aggmoulikaggmoulikOct 16, 2020
edited
Loading

Choose a reason for hiding this comment

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

Initially, I was confused on the same thing.
But, I found this as my reference to go for this method:

varvarIgnorePattern:"all"|"local"|{vars?:"all"|"local"|undefined;varIgnorePattern:?:string|undefined;args:"all"|"after-used"|"none"|undefined;  .........caughtErrorsIgnorePattern?:string|undefined;

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Doing the regex, I am having an error

varIgnorePattern.test(variable.name)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Hy@HolgerJeromin, Can you guide me ?

Copy link

@HolgerJerominHolgerJerominOct 17, 2020
edited
Loading

Choose a reason for hiding this comment

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

No, sorry. I never hacked around around eslint.
I can try to help after my vacation in one week

Copy link
Member

Choose a reason for hiding this comment

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

So here you'll need to convert the string to a regexp:

const varIgnorePattern =  typeof options === 'object' && options.varIgnorePattern != null    ? new RegExp(options.varsIgnorePattern, "u")    : null;

HolgerJeromin and aggmoulik reacted with heart emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I have worked with the regex but how can I improve codecov ?@bradzacher

Copy link
Member

Choose a reason for hiding this comment

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

you'll need some tests! right now you have none at all.

@bradzacherbradzacher added bugSomething isn't working awaiting responseIssues waiting for a reply from the OP or another party labelsOct 16, 2020
Signed-off-by: Moulik Aggarwal <qwertymoulik@gmail.com>
Signed-off-by: Moulik Aggarwal <qwertymoulik@gmail.com>
bradzacher added a commit that referenced this pull requestNov 16, 2020
I wanted to avoid doing this, but not doing this restricts our logic too much - it causes problems when we want to consider reporting on things that the base rule wouldn't report on.Fixes#2714Fixes#2648Closes#2679
@bradzacher
Copy link
Member

Closing in favour of#2768

bradzacher added a commit that referenced this pull requestNov 22, 2020
I wanted to avoid doing this, but not doing this restricts our logic too much - it causes problems when we want to consider reporting on things that the base rule wouldn't report on.Fixes#2714Fixes#2648Closes#2679
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsDec 19, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@HolgerJerominHolgerJerominHolgerJeromin left review comments

@bradzacherbradzacherbradzacher left review comments

Assignees
No one assigned
Labels
awaiting responseIssues waiting for a reply from the OP or another partybugSomething isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[no-unused-var] varsIgnorePattern not working for this module definition
3 participants
@aggmoulik@bradzacher@HolgerJeromin

[8]ページ先頭

©2009-2025 Movatter.jp