Treat this as more of a (possible) sign post.
I setup ESLint extending the plugin:import/recommended, airbnb-typescript and prettier configs.
{
"parserOptions": {
"ecmaVersion": "ES2019",
"sourceType": "module",
"project": "./tsconfig.json"
},
"extends": [
"plugin:import/recommended",
"airbnb-typescript",
"prettier"
],
"plugins": [
"react"
],
"settings": {
"import/ignore": [
"node_modules/react-native/index\\.js$"
]
}
}
When doing this, code like:
function test(path: boolean) {
if (path) {
const name = 'path 1';
} else {
const name = 'path 2';
}
}
Would produce
error 'name' is already defined @typescript-eslint/no-redeclare
After trying to reproduce with just ESLint and then just @typescript-eslint, I found that including airbnb-typescript in the extends was introducing the issue.
I've not traced further at this point, but this seemed to be a rarely reported issue, so hope the helps someone.
Node version: v14.21.1
npm version: v6.14.17
Local ESLint version: v8.38.0 (Currently used)
Global ESLint version: Not found
Operating System: linux 5.15.0-69-generic
eslint-config-airbnb-base@^15.0.0
eslint-config-airbnb-typescript@^17.0.0