Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Implement 4201: add option to ignore shadowed underscore #4546

Merged
merged 2 commits into from
Mar 7, 2019
Merged

Implement 4201: add option to ignore shadowed underscore #4546

merged 2 commits into from
Mar 7, 2019

Conversation

rrogowski
Copy link
Contributor

@rrogowski rrogowski commented Feb 26, 2019

PR checklist

Overview of change:

Add option to ignore shadowed underscore.

Usage

{
  "rules": {
    "no-shadowed-variable": [true, {"underscore": false}]
  }
}

Before

import _ = require('lodash');
function foo(_) {
             ~ [Shadowed name: '_']
    console.log(_);
}

After

import _ = require('lodash');
function foo(_) {
    // No lint error
    console.log(_);
}

Is there anything you'd like reviewers to focus on?

Have I made all the necessary changes to documentation?

CHANGELOG.md entry:

[enhancement]: added option to no-shadowed-variable to ignore shadowed underscores

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Thanks for starting this! I think we should expand the allowed nameset a bit.

src/rules/noShadowedVariableRule.ts Outdated Show resolved Hide resolved
@rrogowski
Copy link
Contributor Author

@JoshuaKGoldberg suggestions have been addressed. Ready for your review.

Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Awesome work, thanks!

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.

no-shadowed-variable should ignore shadowed _-params
3 participants