Open
Bug 1574194
Opened 5 years ago
Updated 2 years ago
Require explicitly inexact Flowtype object types.
Categories
(DevTools :: Debugger, task, P3)
DevTools
Debugger
Tracking
(Not tracked)
NEW
People
(Reporter: loganfsmyth, Unassigned)
References
(Blocks 1 open bug)
Details
Flow currently has "inexact" and "exact" object types, where exact objects must have exactly the fields given in the type, and inexact objects must have those fields, but are also allowed to have additional properties.
The common syntax is
type SomeExactObj = {| prop: string |};
type SomeInexactObj = { prop: string };
but in fact, the Flow team eventually wants to make { prop: string }
exact by default. (https://medium.com/flow-type/on-the-roadmap-exact-objects-by-default-16b72933c5cf) Along the path to this eventual goal, they have added a new "..." token to mark an object inexact:
type SomeInexactObj = { prop: string, ... };
We should update our codebase to require ...
for all types that aren't exact. That should mean
- Enabling https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-require-inexact-type
- Fixing all of the places in the codebase that are inexact but don't have
...
I would recommend approaching this bug with a few steps
- Figure out what we need to do to enable
eslint-plugin-flowtype
inmozilla-central
, since right now it is not an ESLint plugin that we load. - Instead of manually fixing every instance of an inexact object, use this as motivation to submit a patch to
eslint-plugin-flowtype
to use ESlint's autofix framework to fix all the issues for you, that way you can run ESLint with--fix
to update all the debugger code. - Submit a patch adding
...
everywhere.
Reporter | ||
Updated•5 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Severity: normal normal → S3 S3
You need to log in
before you can comment on or make changes to this bug.
Description
•