Commit Graph

9 Commits

Author SHA1 Message Date
Michel Weststrate
1029a6c97c Introduce types for Sandy plugins through code base
Summary:
So far there were 2 types of plugins: `FlipperPlugin` and `FlipperDevicePlugin`. This introduces a third kind: `SandyPluginDefinition`.

Unlike with the old plugins, the export of the module is not directly exposed as the plugin definition. Rather, we use class `SandyPluginDefinition` (instance) that holds a loaded definition and its meta data separately (`PluginDetails`). This means that we don't have to mix in and mutate loaded definitions, and that for unit tests we can avoid needing to provide a bunch of meta data. This also prevents a bunch of meta data existing on two places: on the loaded classes as static fields, and in the meta data field of the loaded class as well. Finally, we can now freely extends the `PluginDetails` interface in flipper, without needing to store it on the loaded classes and we are sure that no naming conflicts are caused by this in the future.

For compatibility with the existing code base, common fields are delegated from the `SandyPluginDefinition` class to the meta data.

Also cleaned up types around plugins a little bit and removed some unnecessary casts.

For all features that reason about plugins in general (such as exports), sandy plugins are ignored for now.

`SandyPluginInstance` is worked out in further diffs

The `instanceof` calls are replaced by a utility function in later diffs.

{F241363645}

Reviewed By: jknoxville

Differential Revision: D22091432

fbshipit-source-id: 3aa6b12fda5925268913779f3c3c9e84494438f8
2020-07-01 09:12:35 -07:00
Michel Weststrate
2383dc85f8 Initialized flipper-plugin library
Summary: Set up an initial library which can (should) be used by plugins in the future.

Reviewed By: jknoxville

Differential Revision: D22019554

fbshipit-source-id: 502b14b34b2c9c117cea377ab6ebbf150e6faee9
2020-07-01 09:12:35 -07:00
Michel Weststrate
7b69b96190 Fix code formatting
Summary:
Had some horrible dev experience caused by  VSCode and Jest not agreeing what snapshots should look like, every time saving a test in VSCode, it would break the jest snapshots. After investigating eslint and prettier, turned out VSCode itself was the culprit. Caused by a global user setting, but this makes sure nobody else runs into it :)

Also made sure Jest uses the correct prettier settings (it didn't before).

Reviewed By: passy

Differential Revision: D22114656

fbshipit-source-id: aef6c278a668bce049c96aba95c7a5101ca840ad
2020-06-19 03:54:49 -07:00
Michel Weststrate
54162d480c Enable react hooks linting
Summary:
Enabled linting rules that help to signal making errors with effect dependencies and such.

Fixed all errors, left any warnings generated by the hooks untouched

Reviewed By: nikoant

Differential Revision: D21721497

fbshipit-source-id: 9548453443fa7b663dc4d4289132f388c6697283
2020-05-28 10:14:05 -07:00
Anton Nikolaev
ec07272c78 Linter checks for extraneous dependencies
Summary: Added eslint rule "no-extraneous-imports" which disallow using modules which are not listed as dependencies in the corresponding package.json. Fixed a bunch of reported errors after the rule applied.

Reviewed By: passy

Differential Revision: D21186848

fbshipit-source-id: 0af9ac4b3fffdfd0ab7c23ae4ff12a3f5989d5e9
2020-04-23 05:33:20 -07:00
Michael Bolin
49fc4b46b6 Set arrowParens option explicitly.
Differential Revision: D20640296

fbshipit-source-id: 0ecaa78f964fce8297342db99be29b1a7d1cfab6
2020-03-24 22:49:33 -07:00
Pascal Hartig
fc9ed65762 prettier 2
Summary:
Quick notes:

- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.

Close https://github.com/facebook/flipper/pull/915

Reviewed By: jknoxville

Differential Revision: D20594929

fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
2020-03-24 09:38:11 -07:00
Anton Nikolaev
beb5c85e69 Enable eslint import checks and fixed the reported errors (#878)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/878

1) Enabled eslint error reporting for unresolved imports and fixed all the errors
2) Enabled eslint for typings (d.ts) and fixed all the errors

Reviewed By: passy

Differential Revision: D20335151

fbshipit-source-id: 7b142281a406b32df0f02a5cd0d7d05eba941acd
2020-03-14 14:35:18 -07:00
Anton Nikolaev
85c13bb1f3 Move desktop-related code to "desktop" subfolder (#872)
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/872
Move all the JS code related to desktop app to "desktop" subfolder.

The structure of "desktop" folder:
- `src` - JS code of Flipper desktop app executing in Electron Renderer (Chrome) process. This folder also contains all the Flipper plugins in subfolder "src/plugins".
- `static` - JS code of Flipper desktop app bootstrapping executing in Electron Main (Node.js) process
- `pkg` - Flipper packaging lib and CLI tool
- `doctor` - Flipper diagnostics lib and CLI tool
- `scripts` - Build scripts for Flipper desktop app
- `headless` - Headless version of Flipper app
- `headless-tests` - Integration tests running agains Flipper headless version

Reviewed By: passy

Differential Revision: D20249304

fbshipit-source-id: 9a51c63b51b92b758a02fc8ebf7d3d116770efe9
2020-03-14 14:35:17 -07:00