Page MenuHomePhabricator

D6174.id20654.diff
No OneTemporary

D6174.id20654.diff

diff --git a/.buildkite/eslint_flow_jest.yml b/.buildkite/eslint_flow_jest.yml
--- a/.buildkite/eslint_flow_jest.yml
+++ b/.buildkite/eslint_flow_jest.yml
@@ -5,7 +5,7 @@
- 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y'
- '. /root/.cargo/env'
- 'yarn cleaninstall --frozen-lockfile --skip-optional --network-timeout 180000'
- - 'yarn eslint --max-warnings=0 && yarn workspace lib flow && yarn workspace web flow && yarn workspace landing flow && yarn workspace native flow && yarn workspace keyserver flow'
+ - 'yarn eslint --max-warnings=0 && yarn workspace lib flow && yarn workspace web flow && yarn workspace landing flow && yarn workspace native flow && yarn workspace keyserver flow && yarn workspace desktop flow'
- 'yarn workspace lib test && yarn workspace keyserver test'
plugins:
- docker#v3.13.0:
diff --git a/.github/workflows/eslint_flow_jest.yml b/.github/workflows/eslint_flow_jest.yml
--- a/.github/workflows/eslint_flow_jest.yml
+++ b/.github/workflows/eslint_flow_jest.yml
@@ -41,6 +41,10 @@
working-directory: ./native
run: ./node_modules/.bin/flow
+ - name: '[desktop] flow'
+ working-directory: ./desktop
+ run: ./node_modules/.bin/flow
+
- name: '[lib] test'
working-directory: ./lib
run: yarn test
diff --git a/.lintstagedrc.js b/.lintstagedrc.js
--- a/.lintstagedrc.js
+++ b/.lintstagedrc.js
@@ -38,6 +38,9 @@
'{landing,lib}/**/*.js': function landingFlow(files) {
return 'yarn workspace landing flow --quiet';
},
+ '{desktop,lib}/**/*.js': function desktopFlow(files) {
+ return 'yarn workspace desktop flow --quiet';
+ },
'services/identity/**/*.rs': function testIdentity(files) {
return 'bash -c "cd services/identity && cargo test"';
},
diff --git a/desktop/.eslintrc.json b/desktop/.eslintrc.json
--- a/desktop/.eslintrc.json
+++ b/desktop/.eslintrc.json
@@ -1,6 +1,3 @@
{
- "rules": {
- "flowtype/require-valid-file-annotation": "off"
- },
"env": { "node": true }
}
diff --git a/desktop/.flowconfig b/desktop/.flowconfig
new file mode 100644
--- /dev/null
+++ b/desktop/.flowconfig
@@ -0,0 +1,29 @@
+[include]
+../lib
+
+[libs]
+../lib/flow-typed
+
+[options]
+exact_by_default=true
+
+format.bracket_spacing=false
+
+[lints]
+sketchy-null-number=warn
+sketchy-null-mixed=warn
+sketchy-number=warn
+untyped-type-import=warn
+nonstrict-import=warn
+deprecated-type=warn
+unsafe-getters-setters=warn
+unnecessary-invariant=warn
+
+[strict]
+deprecated-type
+nonstrict-import
+sketchy-null
+unclear-type
+unsafe-getters-setters
+untyped-import
+untyped-type-import
diff --git a/desktop/babel.config.cjs b/desktop/babel.config.cjs
--- a/desktop/babel.config.cjs
+++ b/desktop/babel.config.cjs
@@ -1,6 +1,7 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { electron: 22 }, modules: 'commonjs' }],
+ '@babel/preset-flow',
],
plugins: [
'@babel/plugin-proposal-class-properties',
diff --git a/desktop/flow-typed/npm/electron_vx.x.x.js b/desktop/flow-typed/npm/electron_vx.x.x.js
new file mode 100644
--- /dev/null
+++ b/desktop/flow-typed/npm/electron_vx.x.x.js
@@ -0,0 +1,19 @@
+// @flow
+// flow-typed signature: f8bfa3876f1890f644b65b1ebd801ed8
+// flow-typed version: <<STUB>>/electron_v22.0.0/flow_v0.182.0
+
+/**
+ * This is an autogenerated libdef stub for:
+ *
+ * 'electron'
+ *
+ * Fill this stub out by replacing all the `any` types.
+ *
+ * Once filled out, we encourage you to share your work with the
+ * community by sending a pull request to:
+ * https://github.com/flowtype/flow-typed
+ */
+
+declare module 'electron' {
+ declare module.exports: any;
+}
diff --git a/desktop/forge.config.cjs b/desktop/forge.config.cjs
--- a/desktop/forge.config.cjs
+++ b/desktop/forge.config.cjs
@@ -61,7 +61,13 @@
packagerConfig: {
name: 'Comm',
icon: 'icons/icon',
- ignore: ['src', '.*config\\.cjs', '\\.eslintrc\\.json'],
+ ignore: [
+ 'src',
+ '.*config\\.cjs',
+ '\\.eslintrc\\.json',
+ '\\.flowconfig',
+ 'flow-typed',
+ ],
appBundleId: 'app.comm.macos',
osxSign: { identity: 'Developer ID Application' },
osxNotarize: {
diff --git a/desktop/package.json b/desktop/package.json
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -34,6 +34,8 @@
"@electron-forge/maker-squirrel": "^6.0.4",
"@electron-forge/plugin-base": "^6.0.4",
"electron": "^22.0.0",
+ "flow-bin": "^0.182.0",
+ "flow-typed": "^3.2.1",
"fs-extra": "^10.1.0",
"klaw": "^4.0.1"
}
diff --git a/desktop/src/handle-squirrel-event.js b/desktop/src/handle-squirrel-event.js
--- a/desktop/src/handle-squirrel-event.js
+++ b/desktop/src/handle-squirrel-event.js
@@ -1,3 +1,5 @@
+// @flow
+
import { spawn } from 'child_process';
import { app } from 'electron';
import path from 'path';
@@ -6,7 +8,7 @@
// uninstalling and updating so we can for example create or delete shortcuts.
// After handling some of these events the app will be closed. If this function
// returns false, the app should start normally.
-export function handleSquirrelEvent() {
+export function handleSquirrelEvent(): boolean {
if (process.argv.length === 1) {
return false;
}
diff --git a/desktop/src/main.js b/desktop/src/main.js
--- a/desktop/src/main.js
+++ b/desktop/src/main.js
@@ -1,3 +1,5 @@
+// @flow
+
import {
app,
BrowserWindow,
diff --git a/desktop/src/preload.js b/desktop/src/preload.js
--- a/desktop/src/preload.js
+++ b/desktop/src/preload.js
@@ -1,3 +1,5 @@
+// @flow
+
import { contextBridge, ipcRenderer } from 'electron';
const bridge = {
diff --git a/native/.flowconfig b/native/.flowconfig
--- a/native/.flowconfig
+++ b/native/.flowconfig
@@ -14,6 +14,7 @@
.*/comm/web/.*
.*/comm/keyserver/.*
+.*/comm/desktop/.*
.*/android/app/build/.*

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 11:53 PM (18 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692070
Default Alt Text
D6174.id20654.diff (5 KB)

Event Timeline