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

False positive of no-param-reassign on destruction assigment #8279

Closed
tinovyatkin opened this issue Mar 18, 2017 · 1 comment · Fixed by singapore/lint-condo#244 or renovatebot/renovate#147 · May be fixed by iamhunter/teammates#4
Closed
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@tinovyatkin
Copy link
Contributor

tinovyatkin commented Mar 18, 2017

Tell us about your environment

  • ESLint Version: 3.18
  • Node Version: 7.7.3

What parser (default, Babel-ESLint, etc.) are you using? default

What did you do? Please include the actual source code causing the issue.

/* eslint no-param-reassign: ["error", {"props": true}] */

const { hasOwnProperty: has } = Object.prototype;
module.exports.hasDeepProperty = (obj, propertyPath) => {
  if (!obj) return false;

  const properties = propertyPath.split('.');
  let o = obj;
  return !properties.some((propertyName) => {
    if (!has.call(o, propertyName)) return true;
    ({ [propertyName]: o } = o);
    return false;
  });
};

What did you expect to happen?
Nothing, no errors

What actually happened? Please include the actual, raw output from ESLint.
no-param-reassign thinks I'm reassigning propertyName at destruction

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Mar 18, 2017
@not-an-aardvark
Copy link
Member

I can reproduce this, thanks for the report.

I've edited the issue to include the configuration that causes this issue to appear.

@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Mar 18, 2017
not-an-aardvark added a commit that referenced this issue Mar 18, 2017
This updates no-param-reassign to stop traversing up the AST if it encounters a Property node where the variable reference is part of the key.
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
3 participants