Skip to content
This repository was archived by the owner on Jan 14, 2023. It is now read-only.

Commit a064672

Browse files
authored
refactor: migrate user state from redux to overmind (#44)
* feat: setup overmind * chore: typescript, overmind, webpack revamp * chore: revamp test setup * refactor: wip - use overmind to save storage instead of redux * feat: overmind settings state, actions, effects * feat: move requests to main thread. User actions and storage effects * refactor: migrated pages to use user data from overmind state instead of redux * chore: resolve linting problems
1 parent 80d44be commit a064672

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+6072
-3183
lines changed

.DS_Store

-6 KB
Binary file not shown.

.env.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
PORT=8080
22
NODE_ENV=develop
3-
ENCRYPTION_KEY=
3+
ENCRYPTION_KEY=test

.eslintrc.json

Lines changed: 120 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,125 @@
11
{
2-
"parser": "babel-eslint",
3-
"env": {
4-
"browser": true,
5-
"es6": true,
6-
"jest": true
2+
"parser": "@typescript-eslint/parser",
3+
"env": {
4+
"browser": true,
5+
"es6": true,
6+
"jest": true
7+
},
8+
"extends": [
9+
"airbnb",
10+
"plugin:@typescript-eslint/eslint-recommended",
11+
"plugin:@typescript-eslint/recommended"
12+
],
13+
"globals": {
14+
"Atomics": "readonly",
15+
"SharedArrayBuffer": "readonly"
16+
},
17+
"parserOptions": {
18+
"ecmaFeatures": {
19+
"jsx": true
720
},
8-
"extends": "airbnb",
9-
"globals": {
10-
"Atomics": "readonly",
11-
"SharedArrayBuffer": "readonly"
12-
},
13-
"parserOptions": {
14-
"ecmaFeatures": {
15-
"jsx": true
21+
"ecmaVersion": 11,
22+
"sourceType": "module"
23+
},
24+
"plugins": ["react"],
25+
"rules": {
26+
"class-methods-use-this": "off",
27+
"comma-dangle": "off",
28+
"object-curly-newline": "warn",
29+
"no-plusplus": "off",
30+
"no-param-reassign": "warn",
31+
"no-underscore-dangle": [
32+
"error",
33+
{
34+
"allow": ["__initialize", "__reset"]
35+
}
36+
],
37+
"max-len": ["error", { "code": 200, "ignoreComments": true }],
38+
"no-restricted-syntax": "off",
39+
"camelcase": [
40+
"error",
41+
{
42+
"allow": [
43+
"api_key",
44+
"time_entry",
45+
"spent_on",
46+
"issue_id",
47+
"activity_id",
48+
"user_id",
49+
"spent_hours",
50+
"total_spent_hours",
51+
"time_entries",
52+
"project_id",
53+
"tracker_id",
54+
"status_id",
55+
"assigned_to_id",
56+
"author_id",
57+
"due_date",
58+
"created_on",
59+
"priority_id",
60+
"private_notes",
61+
"total_count",
62+
"estimated_duration",
63+
"estimated_hours",
64+
"done_ratio",
65+
"assigned_to",
66+
"start_date",
67+
"custom_fields",
68+
"closed_on",
69+
"progress_info"
70+
]
71+
}
72+
],
73+
"jsx-a11y/label-has-associated-control": "off",
74+
"jsx-a11y/anchor-is-valid": "off",
75+
"react/no-array-index-key": "off",
76+
"no-mixed-operators": "off",
77+
"react/forbid-prop-types": "off",
78+
"react/require-default-props": "off",
79+
"react/jsx-props-no-spreading": "off",
80+
"max-classes-per-file": "off",
81+
"no-use-before-define": "off",
82+
"arrow-parens": "off",
83+
"react/jsx-filename-extension": [
84+
2,
85+
{ "extensions": [".js", ".jsx", ".ts", ".tsx"] }
86+
],
87+
"import/no-extraneous-dependencies": [
88+
"error",
89+
{
90+
"devDependencies": true,
91+
"optionalDependencies": false,
92+
"peerDependencies": false
93+
}
94+
],
95+
"jsx-a11y/label-has-for": [
96+
2,
97+
{
98+
"required": {
99+
"every": ["nesting", "id"]
16100
},
17-
"ecmaVersion": 2018,
18-
"sourceType": "module"
19-
},
20-
"plugins": [
21-
"react"
101+
"allowChildren": true
102+
}
22103
],
23-
"rules": {
24-
"class-methods-use-this": "off",
25-
"comma-dangle": "off",
26-
"object-curly-newline": "warn",
27-
"no-plusplus": "off",
28-
"no-underscore-dangle": [ "error", {
29-
"allow": ["__initialize", "__reset"]
30-
}],
31-
"max-len": ["error", { "code": 120, "ignoreComments": true }],
32-
"no-restricted-syntax": "off",
33-
"camelcase": [ "error", {
34-
"allow": [
35-
"api_key",
36-
"time_entry",
37-
"spent_on",
38-
"issue_id",
39-
"activity_id",
40-
"user_id",
41-
"spent_hours",
42-
"total_spent_hours",
43-
"time_entries",
44-
"project_id",
45-
"tracker_id",
46-
"status_id",
47-
"assigned_to_id",
48-
"author_id",
49-
"due_date",
50-
"created_on",
51-
"priority_id",
52-
"private_notes",
53-
"total_count",
54-
"estimated_duration",
55-
"estimated_hours",
56-
"done_ratio",
57-
"assigned_to",
58-
"start_date",
59-
"custom_fields",
60-
"closed_on",
61-
"progress_info"
62-
]
63-
}],
64-
"jsx-a11y/label-has-associated-control": "off",
65-
"jsx-a11y/anchor-is-valid": "off",
66-
"react/no-array-index-key": "off",
67-
"no-mixed-operators": "off",
68-
"react/forbid-prop-types": "off",
69-
"react/require-default-props": "off",
70-
"react/jsx-props-no-spreading": "off",
71-
"max-classes-per-file": "off",
72-
"no-use-before-define": "off",
73-
"jsx-a11y/label-has-for": [ 2, {
74-
"required": {
75-
"every": [ "nesting", "id" ]
76-
},
77-
"allowChildren": true
78-
}],
79-
"react/prefer-stateless-function": "off",
80-
"react/jsx-boolean-value": "off"
81-
}
104+
"react/prefer-stateless-function": "off",
105+
"import/prefer-default-export": "off",
106+
"react/jsx-boolean-value": "off",
107+
"@typescript-eslint/no-var-requires": "off",
108+
"import/extensions": [
109+
"error",
110+
"ignorePackages",
111+
{
112+
"js": "never",
113+
"jsx": "never",
114+
"ts": "never",
115+
"tsx": "never"
116+
}
117+
]
118+
},
119+
"settings": {
120+
"import/resolver": {
121+
"typescript": {}
122+
},
123+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"]
124+
}
82125
}

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"singleQuote": true,
6+
"jsxBracketSameLine": true
7+
}

__mocks__/electron-is-dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default true;

__mocks__/electron-util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const openNewGitHubIssue = () => {};
1+
const openNewGitHubIssue = () => { /* noop */ };
22
const debugInfo = () => '';
33

44
export {

__mocks__/electron.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,53 @@
11
import { name } from '../package.json';
22

33
const shell = {
4-
openExternal: () => {}
4+
openExternal: () => { /* noop */ },
55
};
66

77
const powerMonitor = {
8-
getSystemIdleTime: jest.fn()
8+
getSystemIdleTime: jest.fn(),
99
};
1010

1111
const remote = {
1212
shell,
1313
process: {
14-
platform: 'darwin'
14+
platform: 'darwin',
1515
},
1616
app: {
1717
getName: () => name,
18-
isPackaged: false
18+
isPackaged: false,
1919
},
2020
require: (path) => {
2121
if (path.includes('/common/request')) {
22-
return require('../common/request'); // eslint-disable-line
22+
return require("../common/request"); // eslint-disable-line
2323
}
2424
if (path.includes('electron')) {
2525
return { powerMonitor };
2626
}
2727
return undefined;
28-
}
28+
},
2929
};
3030

3131
const ipcRenderer = {
3232
on: jest.fn(),
3333
send: jest.fn(),
34-
removeListener: jest.fn()
34+
removeListener: jest.fn(),
35+
};
36+
37+
export default {
38+
require: jest.fn().mockReturnThis({ remote, require: global.require }),
39+
match: jest.fn(),
40+
app: jest.fn(),
41+
dialog: jest.fn(),
42+
remote,
43+
ipcRenderer,
3544
};
3645

3746
module.exports = {
47+
require: jest.fn().mockReturnThis({ remote, require: global.require }),
48+
match: jest.fn(),
49+
app: jest.fn(),
50+
dialog: jest.fn(),
3851
remote,
39-
ipcRenderer
52+
ipcRenderer,
4053
};

babel.config.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

babel.config.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"exclude": ["transform-regenerator", "transform-async-to-generator"],
7+
"targets": {
8+
"browsers": "last 2 versions"
9+
},
10+
"modules": "auto"
11+
}
12+
],
13+
[
14+
"@babel/react",
15+
{
16+
"exclude": ["transform-regenerator", "transform-async-to-generator"],
17+
"debug": true,
18+
"modules": false,
19+
"useBuiltIns": "usage",
20+
"modules": "auto"
21+
}
22+
]
23+
],
24+
"plugins": ["module:fast-async"],
25+
"env": {
26+
"test": {
27+
"plugins": ["@babel/plugin-transform-modules-commonjs"]
28+
}
29+
}
30+
}

common/config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
const storage = require('./storage');
21
const env = require('./env');
32

4-
let config = { ...env };
5-
6-
if (storage.has('settings')) {
7-
config = { ...config, ...storage.get('settings', {}) };
8-
}
3+
const config = { ...env };
94

105
module.exports = config;

0 commit comments

Comments
 (0)