You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eslint: Use new hermes-eslint parser, instead of @babel/eslint-parser
This is "the recommended parser for use for linting with Flow code"
( https://www.npmjs.com/package/hermes-eslint )
and it's the one most recommended in Flow's guide to enabling Flow
enums, which we'd like to do soon:
https://flow.org/en/docs/enums/enabling-enums/
Since that Flow-enums guide says "Upgrade hermes-parser to at least
version 0.4.8", add a `resolutions` line to guarantee that.
The hermes-eslint code seems to live here on GitHub:
https://github.com/facebook/hermes/tree/main/tools/hermes-parser/js/hermes-eslint
With this parser, it will be possible (once we enable Flow enums,
coming up) to define a Flow enum without getting an ESLint error
like
Parsing error: Unexpected token, expected "{"
.
The new parsing also gives better feedback on existing code. We fix
a new warning and a new error in this commit:
- A warning "'V' is defined but never used" on the type param V at
src/generics.js:175:54. Sure enough, V isn't used; remove it.
- The eslint-disable for no-use-before-define, at
src/presence/__tests__/heartbeat-test.js:49:5, isn't suppressing
any error and can be removed. Yep, the use isn't before the
definition; remove the eslint-disable.
Finally, repeal a few now-redundant ESLint rules, with comments. For
posterity, here's the full error output that I abbreviated in a
comment on ft-flow/define-flow-type:
Running lint...
Oops! Something went wrong! :(
ESLint: 8.17.0
TypeError: globalScope.__defineGeneric is not a function
Occurred while linting /Users/chrisbobbe/dev/zulip-mobile/src/api/modelTypes.js:53
Rule: "ft-flow/define-flow-type"
at makeDefined (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint-plugin-ft-flow/dist/rules/defineFlowType.js:21:21)
at GenericTypeAnnotation (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint-plugin-ft-flow/dist/rules/defineFlowType.js:67:9)
at ruleErrorHandler (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/linter.js:1114:28)
at /Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
at CodePathAnalyzer.enterNode (/Users/chrisbobbe/dev/zulip-mobile/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23)
0 commit comments