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

Assignment to ternary expression using function parameter as condition triggers no-param-reassign #11236

Closed
lpaladin opened this issue Jan 4, 2019 · 2 comments · Fixed by #11239, WealthWizardsEngineering/hpropagate#8 or DavidKindler/burger-builder#46 · May be fixed by jakeherp/burger-builder#11 or jakeherp/burger-builder#15
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

@lpaladin
Copy link
Contributor

lpaladin commented Jan 4, 2019

Tell us about your environment

  • ESLint Version: 5.9.0
  • Node Version: 8.12.0
  • npm Version: 6.4.1

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

Please show your full configuration:

Configuration
{
    "parser": "babel-eslint",
    "extends": "airbnb",
    "env": {
        "browser": true
    },
    "rules": {
        "jsx-a11y/click-events-have-key-events": "off",
        "jsx-a11y/no-static-element-interactions": "off",
        "react/jsx-one-expression-per-line": [true, { "allow": "literal" }],
        "no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"]
    }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

function test(arg) {
  const array = [[1], [2]];
  (arg ? array[0] : array[1])[0] = 3;
  return array;
}
yarn eslint src/

What did you expect to happen?
The above code should not emit lint errors.

What actually happened? Please include the actual, raw output from ESLint.
error Assignment to property of function parameter 'arg' no-param-reassign

Are you willing to submit a pull request to fix this bug?
Will try if possible.

@lpaladin lpaladin added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jan 4, 2019
@lpaladin lpaladin changed the title Assignment to ternary expression using function parameter triggers no-param-reassign Assignment to ternary expression using function parameter as condition triggers no-param-reassign Jan 4, 2019
lpaladin added a commit to lpaladin/eslint that referenced this issue Jan 4, 2019
lpaladin added a commit to lpaladin/eslint that referenced this issue Jan 4, 2019
@not-an-aardvark not-an-aardvark added rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jan 4, 2019
@not-an-aardvark
Copy link
Member

Thanks for the report, I can reproduce this issue. It seems to only occur when using the props: true option.

@platinumazure
Copy link
Member

Hi @zhouhaoyu, thanks for the issue!

I can reproduce in the demo, so I'm marking this as accepted. Thanks also for the PR-- I'll review that shortly!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 4, 2019
@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 Jul 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.