eslint: `prefer-const` not triggered (regression from 2.4.0)
What version of ESLint are you using? 2.7.0
What parser (default, Babel-ESLint, etc.) are you using?
“babel-eslint”: “~6.0.0”
Please show your full configuration:
{
"parser": "babel-eslint",
"extends": "airbnb",
"rules": {
"semi": [2, "never"],
"arrow-body-style": 0
}
}
What did you do? Please include the actual source code causing the issue.
import React, { PropTypes } from 'react'
const innerStyle = {
color: '#343434',
color2: 'white',
}
const ToolBar = ({ style, draw }) => {
let dynStyle = {
...innerStyle,
...style,
}
dynStyle.color = draw ? dynStyle.color2 : dynStyle.color
return (
<div style={dynStyle} />
)
}
ToolBar.propTypes = {
style: PropTypes.object,
draw: PropTypes.bool,
}
export default ToolBar
What did you expect to happen?
prefer-const
should trigger and ask me to change let dynStyle
to const dynStyle
What actually happened? Please include the actual, raw output from ESLint.
ESLint don’t trigger the prefer-const
rule.
Note I tried these versions :
~2.4.0
: Works~2.5.0
: Doesn’t work~2.6.0
: Doesn’t work~2.7.0
: Doesn’t work
Commits that are related to prefer-const
(maybe I miss some) :
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (17 by maintainers)
Commits related to this issue
- Fix: `prefer-const` false negative about `eslintUsed` (fixes #5837) — committed to eslint/eslint by mysticatea 8 years ago
- Fix: `prefer-const` false negative about `eslintUsed` (fixes #5837) — committed to eslint/eslint by mysticatea 8 years ago
- Fix: `prefer-const` false negative about `eslintUsed` (fixes #5837) (#6971) — committed to eslint/eslint by mysticatea 8 years ago
Oh, I’m sorry. I had lost the track of this issue.
I will fix this.