Skip to content
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

Breaking: make no-redeclare stricter (fixes #11370, fixes #11405) #11509

Merged
merged 17 commits into from Apr 25, 2019

Conversation

Projects
3 participants
@mysticatea
Copy link
Member

commented Mar 15, 2019

What is the purpose of this pull request? (put an "X" next to item)

[X] Changes an existing rule
[X] Add something to the core

What changes did you make? (Give an overview)

This PR makes no-redeclare rule stricter.

  • Implements eslint/rfcs#17
  • Adds /*globals*/ comment check to no-redeclare rule. (#11370)
  • Enables { builtinGlobals: true } option by default. (#11405)
  • Adds some items to the migration guide. (moved to #11515)

And some chore:

  • Removes the accesses to parserOptions from no-redeclare rule. The parserOptions is not safe because each parser has different options.
  • Moves a utility that determines the location of a variable name in /*globals*/ comments to ast-utils because it's shared with no-unused-vars rule and no-redeclare rule.
  • Adds several tests for lexical bindings into no-redeclare rule along with a loose parser that doesn't throw syntax errors on redeclaration of lexical bindings.
  • Makes eslint-plugin/test-case-property-ordering rule's option more reasonable. (moved to #11511)

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

  • Should no-redeclare rule handle lexical bindings still? Since acorn 5.0.0, it throws syntax errors by such a redeclaration.

mysticatea added some commits Mar 15, 2019

Breaking: make no-redeclare checking comments
- Implement eslint/rfcs#17
- Fixes #11370
- Remvoes the access to parserOptions from no-redeclare rule
- Adds several tests for lexical bindings to no-redeclare rule

@mysticatea mysticatea added this to Implemented, pending review in v6.0.0 Mar 15, 2019

@not-an-aardvark
Copy link
Member

left a comment

Thanks for working on this! I haven't gone through the implementation thoroughly yet, but I left a few suggestions.

Show resolved Hide resolved docs/user-guide/migrating-to-6.0.0.md Outdated
Show resolved Hide resolved lib/rules/no-redeclare.js Outdated
Show resolved Hide resolved lib/rules/no-unused-vars.js Outdated
Show resolved Hide resolved package.json Outdated
Show resolved Hide resolved .eslintrc.js Outdated
Show resolved Hide resolved docs/developer-guide/working-with-rules.md Outdated

not-an-aardvark and others added some commits Mar 15, 2019

remove unnecessary compare
Co-Authored-By: mysticatea <star.ctor@gmail.com>

@platinumazure platinumazure self-requested a review Mar 15, 2019

Merge branch 'master' into no-redeclare/issue11370and11405
# Conflicts:
#	tests/lib/rules/no-redeclare.js
@platinumazure
Copy link
Member

left a comment

Left a few small suggestions.

I'm a little leery about consuming acorn in ESLint, but there's probably not much choice here. Part of me wonders if we should expose a loose parsing mode in espree and just use that, but maybe that would just be a support headache as people ask us about issues involving loose espree...

Show resolved Hide resolved docs/developer-guide/working-with-rules.md Outdated
Show resolved Hide resolved lib/util/ast-utils.js Outdated
Show resolved Hide resolved tests/lib/rules/no-redeclare.js Outdated

platinumazure and others added some commits Mar 29, 2019

Update docs/developer-guide/working-with-rules.md
Co-Authored-By: mysticatea <star.ctor@gmail.com>
Update lib/util/ast-utils.js
Co-Authored-By: mysticatea <star.ctor@gmail.com>

@mysticatea mysticatea removed the do not merge label Apr 2, 2019

Merge branch 'master' into no-redeclare/issue11370and11405
# Conflicts:
#	lib/config/config-ops.js
#	lib/linter.js
#	tests/lib/config/config-ops.js

@mysticatea mysticatea moved this from Implemented, pending review to Ready to merge in v6.0.0 Apr 8, 2019

@mysticatea mysticatea moved this from Ready to merge to Implemented, pending review in v6.0.0 Apr 8, 2019

I'm not sure when I'll have time to review this thoroughly, but my previous review has been addressed.

@platinumazure
Copy link
Member

left a comment

LGTM, thanks! Sorry for the delay.

@mysticatea

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2019

Thank you very much!

@mysticatea mysticatea merged commit 20364cc into master Apr 25, 2019

5 checks passed

commit-message PR title follows commit message guidelines
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details

v6.0.0 automation moved this from Implemented, pending review to Done Apr 25, 2019

@mysticatea mysticatea deleted the no-redeclare/issue11370and11405 branch Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.