Summary:
I don't think there's an easy way to do this based on types
which would be ideal ...
So instead I'm checking for
- Importing `remote` from `electron`.
- Accessing `electron.remote`.
You can still hack this by importing `electron`, saving
it to a differently named variable and accessing `remote` on it,
but this should cover all reasonable cases we see in real code.
Reviewed By: mweststrate
Differential Revision: D26453006
fbshipit-source-id: 4b3d223bed43ca3f0d1a4f592ea8f8060a823479
Summary: importing `antd` in a plugin that lives in the Flipper repo will give a int warning. This fixes that, antd is provided by the host package.
Reviewed By: nikoant
Differential Revision: D26073161
fbshipit-source-id: 897357fafce20129f7e12c035ff99cb4870cc814
Summary:
* Removed Flow compilation step
* Removed all `flow` annotations
* Removed all FlowFixMe's
* Removed flow typings for Flipper
* Left flow transpilation (stripping) in babel, in case there is any external user using Flow in his plugin
* Left `eslint-plugin-flowtype` dependencies, as `eslint-config-fbjs` requires it
Reviewed By: passy
Differential Revision: D24755545
fbshipit-source-id: 9c0a7910657fd1cba88294e041bf2bfdf7b565bf
Summary:
I noticed that after the typescript upgrade, I got several weird positives from ESLint (like unused parameters in a type definition, which are obviously always unused, e.g. `type onClick = (e: Event) => void`). After some investigation, it turned out these warnings are generated by eslint, but that those rules should be performaned by typescript/eslint instead. For future reference to which rules this applies:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/README.md#extension-rules
Updated the config, and while at it, fixed all warnings in our codebase, except for `react-hooks/exhaustive-deps` warnings, since those require semantic changes.
This reduces the amount of eslint warnings from 86 to 39.
Reviewed By: passy
Differential Revision: D23905630
fbshipit-source-id: 0557708fd9ec6b17840a3c191e7d3baf225bdf23
Summary:
allow-large-files
Updated to typescript 4. Note that this is no new major, the way TS numbers is that 4.0 is simply the number after 3.9 (so they refuse to use 3.10).
Primarily reason is that it allows us to use `/** deprecated */`. although there are definitely more interesting improvements
Reviewed By: passy, nikoant
Differential Revision: D23869445
fbshipit-source-id: 54e251b398b8698d9b18898ce66c3203b32aa356
Summary: Now that the vanilla JS QuickPerformanceLoggerCore was created with the core methods from QPL, we are using this in Flipper so that we have one source of truth
Reviewed By: nubbel
Differential Revision: D23128231
fbshipit-source-id: 16841aab2563509c7184a09ecb8d3f534c53e896
Summary:
Added infra for writing and using custom eslint rules and created a rule for disallowing cross-package file imports. Such imports are anti-pattern and they also break standalone plugin bundling.
We still have a bunch of places where Flipper core references code directly from plugins. I've ignored these places for now and added task T71355623 to revisit them.
Reviewed By: passy
Differential Revision: D22998955
fbshipit-source-id: d04cff8fc115ba1300a7e6830306ec134046e927
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
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
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
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
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
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
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
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