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
ESLint upgrade to use hermes-eslint #25915
Conversation
| @@ -77,7 +79,7 @@ declare module 'react-test-renderer/shallow' { | |||
| static createRenderer(): ShallowRenderer; | |||
| getMountedInstance(): ReactTestInstance; | |||
| getRenderOutput<E: React$Element<any>>(): E; | |||
| getRenderOutput(): React$Element<any>; | |||
| getRenderOutput(): React$Element<any>; // eslint-disable-line ft-flow/no-dupe-keys | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this declaration for? can this line be deleted entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was method overloading, but looking at it again that doesn't seem to be the case. I'll try if flow passes when I remove this.
Hermes parser is the preferred parser for Flow code going forward. We need to upgrade to this parser to support new Flow syntax like function `this` context type annotations or `ObjectType['prop']` syntax. Unfortunately, there's quite a few upgrades here to make it work somehow (dependencies between the changes) - ~Upgrade `eslint` to `8.*`~ reverted this as the React eslint plugin tests depend on the older version and there's a [yarn bug](yarnpkg/yarn#6285) that prevents `devDependencies` and `peerDependencies` to different versions. - Remove `eslint-config-fbjs` preset dependency and inline the rules, imho this makes it a lot clearer what the rules are. - Remove the turned off `jsx-a11y/*` rules and it's dependency instead of inlining those from the `fbjs` config. - Update parser and dependency from `babel-eslint` to `hermes-eslint`. - `ft-flow/no-unused-expressions` rule replaces `no-unused-expressions` which now allows standalone type asserts, e.g. `(foo: number);` - Bunch of globals added to the eslint config - Disabled `no-redeclare`, seems like the eslint upgrade started making this more precise and warn against re-defined globals like `__EXPERIMENTAL__` (in rollup scripts) or `fetch` (when importing fetch from node-fetch). - Minor lint fixes like duplicate keys in objects. DiffTrain build for [2b1fb91](2b1fb91) [View git log for this commit](https://github.com/facebook/react/commits/2b1fb91a55deb9b7b60452cb57184c2f182a42fd)
Hermes parser is the preferred parser for Flow code going forward. We need to upgrade to this parser to support new Flow syntax like function
thiscontext type annotations orObjectType['prop']syntax.Unfortunately, there's quite a few upgrades here to make it work somehow (dependencies between the changes)
Upgradereverted this as the React eslint plugin tests depend on the older version and there's a yarn bug that preventseslintto8.*devDependenciesandpeerDependenciesto different versions.eslint-config-fbjspreset dependency and inline the rules, imho this makes it a lot clearer what the rules are.jsx-a11y/*rules and it's dependency instead of inlining those from thefbjsconfig.babel-eslinttohermes-eslint.ft-flow/no-unused-expressionsrule replacesno-unused-expressionswhich now allows standalone type asserts, e.g.(foo: number);no-redeclare, seems like the eslint upgrade started making this more precise and warn against re-defined globals like__EXPERIMENTAL__(in rollup scripts) orfetch(when importing fetch from node-fetch).