Incorrect no-use-before-define warning when using TypeScript.
Yes.
N/A
System:
OS: macOS Sierra 10.12.6
CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
Binaries:
Node: 9.4.0 - ~/.nvm/versions/node/v9.4.0/bin/node
Yarn: Not Found
npm: 6.5.0 - ~/.nvm/versions/node/v9.4.0/bin/npm
Browsers:
Chrome: 75.0.3770.100
Firefox: 65.0.1
Safari: 12.1.1
npmPackages:
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6
react-scripts: ^3.0.1 => 3.0.1
npmGlobalPackages:
create-react-app: Not Found
npx create-react-app my-app --typescript.tsx file and write the code below:type Foo = ReturnType<typeof bar>
const bar = (): string => 'baz';
react-scripts start command.Should emit all files without any warning.
Line 11: 'bar' was used before it was defined no-use-before-define
See code / example upper.
Update — Published npm module hasn't the same rules as specified in the Git repository.
eslint-config-react-app (4.0.1) - (fetched via react-scripts)
'no-use-before-define': [
'warn',
{
functions: false,
classes: false,
variables: false,
},
]
/packages/eslint-config-react-app (4.0.1) - GitHub
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
classes: false,
variables: false,
typedefs: false
}
]
Once updated by myself the warning disappeared.
Thanks, a new version should be released soon.