Skip to content

Commit 0c4944d

Browse files
authored
Merge pull request #2843 from input-output-hk/chore/ddw-773-migrate-to-typecript
Chore/ddw 773 migrate to typecript
2 parents de6ce25 + 1e3fb33 commit 0c4944d

File tree

2,072 files changed

+122088
-120968
lines changed

Some content is hidden

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

2,072 files changed

+122088
-120968
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"presets": [
33
"@babel/preset-env",
44
"@babel/preset-react",
5-
"@babel/preset-flow"
5+
"@babel/preset-typescript"
66
],
77
"plugins": [
88
["@babel/plugin-proposal-decorators", { "legacy": true }],

.eslintrc

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"parser": "@babel/eslint-parser",
2+
"parser": "@typescript-eslint/parser",
33
"parserOptions": {
44
"ecmaFeatures": {
55
"legacyDecorators": true
66
}
77
},
88
"extends": [
99
"airbnb",
10-
"plugin:flowtype/recommended",
10+
"plugin:@typescript-eslint/recommended",
1111
"plugin:react/recommended",
1212
"prettier",
1313
"prettier/babel",
14-
"prettier/flowtype",
14+
"prettier/@typescript-eslint",
1515
"prettier/react",
1616
"plugin:jest/recommended"
1717
],
@@ -24,7 +24,7 @@
2424
"rules": {
2525
"class-methods-use-this": 0,
2626
"consistent-return": "warn",
27-
"flowtype/generic-spacing": 0,
27+
"@typescript-eslint/generic-spacing": 0,
2828
"jsx-a11y/alt-text": 0,
2929
"lines-between-class-members": 0,
3030
"global-require": 0,
@@ -71,17 +71,22 @@
7171
"react/prefer-stateless-function": 0,
7272
"react/prop-types": "warn",
7373
"react/require-default-props": 0,
74+
"react/jsx-first-prop-new-line": [1, "multiline-multiprop"],
75+
"@typescript-eslint/ban-ts-comment": 1,
76+
"@typescript-eslint/no-empty-function": 1,
77+
"@typescript-eslint/ban-types": 1,
78+
"import/no-unresolved": 1,
79+
"@typescript-eslint/no-var-requires": 1,
80+
"camelcase": 1,
81+
"no-empty": 1,
82+
"@typescript-eslint/no-explicit-any": 1,
83+
"no-shadow": 1,
84+
"react/no-did-update-set-state": 1,
7485
"react/sort-comp": 0,
7586
"react/state-in-constructor": 0,
7687
"react/static-property-placement": 0
7788
},
78-
"plugins": [
79-
"flowtype",
80-
"import",
81-
"promise",
82-
"react",
83-
"jest"
84-
],
89+
"plugins": ["@typescript-eslint", "import", "promise", "react", "jest"],
8590
"globals": {
8691
"API": true,
8792
"API_VERSION": true,
@@ -91,6 +96,8 @@
9196
"Process": true // TODO: remove after fix
9297
},
9398
"settings": {
94-
"import/resolver": "webpack"
99+
"import/resolver": {
100+
"node": { "extensions": [".js", ".jsx", ".ts", ".tsx"] }
101+
}
95102
}
96103
}

.flowconfig

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

.github/pull_request_template.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ or animated GIFs of important UI changes in both English and Japanese.
2020
Do not use shadow or any effects. On macOS this can be accomplished the following way:
2121
1. Use the Command+Shift+4 keyboard shortcut.
2222
2. Press the Spacebar.
23-
3. Hold the Option button and click the window you want to capture.
23+
3. Hold the Option button and click the window you want to capture.
2424
-->
2525

2626
## Testing Checklist
@@ -29,7 +29,6 @@ Do not use shadow or any effects. On macOS this can be accomplished the followin
2929
Open a thread on #daedalus-qa on Slack, mention `@daedalusqa` and `@daedalusteam`, link the thread below
3030
-->
3131

32-
3332
- [Slack QA thread](https://input-output-rnd.slack.com/messages/GGKFXSKC6)
3433
- [ ] Test
3534

@@ -38,7 +37,8 @@ Open a thread on #daedalus-qa on Slack, mention `@daedalusqa` and `@daedalusteam
3837
## Review Checklist
3938

4039
### Basics
41-
- [ ] PR assigned to the PR author(s)
40+
41+
- [ ] PR assigned to the PR author(s)
4242
- [ ] `input-output-hk/daedalus-dev` and `input-output-hk/daedalus-qa` assigned as PR reviewers
4343
- [ ] If there are UI changes, Alexander Rukin assigned as an additional reviewer
4444
- [ ] All visual regression testing has been reviewed (Go to Github Actions tab -> Select Chromatic workflow -> Run on your working branch)
@@ -47,25 +47,28 @@ Open a thread on #daedalus-qa on Slack, mention `@daedalusqa` and `@daedalusteam
4747
- [ ] PR is updated to the most recent version of the target branch (and there are no conflicts)
4848
- [ ] PR has a good description that summarizes all changes
4949
- [ ] PR contains screenshots (in case of UI changes)
50-
- [ ] CHANGELOG entry has been added to the top of the appropriate section (*Features*, *Fixes*, *Chores*) and is linked to the correct PR on GitHub
50+
- [ ] CHANGELOG entry has been added to the top of the appropriate section (_Features_, _Fixes_, _Chores_) and is linked to the correct PR on GitHub
5151
- [ ] There are no missing translations (running `yarn manage:translations` produces no changes)
5252
- [ ] Text changes are proofread and approved (Jane Wild / Amy Reeve)
5353
- [ ] Japanese text changes are proofread and approved (Junko Oda)
5454
- [ ] Storybook works and no stories are broken (`yarn storybook`)
5555
- [ ] In case of dependency changes `yarn.lock` file is updated
5656

5757
### Code Quality
58+
5859
- [ ] Important parts of the code are properly commented and documented
59-
- [ ] Code is properly typed with flow
60+
- [ ] Code is properly typed with typescript types
6061
- [ ] React components are split-up enough to avoid unnecessary re-renderings
6162
- [ ] Any code that only works in main process is neatly separated from components
6263

6364
### Testing
65+
6466
- [ ] New feature/change is covered by acceptance tests
6567
- [ ] New feature/change is manually tested and approved by QA team
6668
- [ ] All existing acceptance tests are still up-to-date
6769
- [ ] New feature/change is covered by Daedalus Testing scenario
6870
- [ ] All existing Daedalus Testing scenarios are still up-to-date
6971

7072
### After Review
73+
7174
- [ ] Update Slack QA thread by marking it with a green checkmark

.github/workflows/linter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010
- name: Setup Node.js
1111
uses: actions/setup-node@v2
1212
with:
13-
node-version: "14"
13+
node-version: '14'
1414
- run: yarn install --frozen-lockfile
15-
- run: yarn prettier:check && yarn lint && yarn stylelint
15+
- run: yarn prettier:check && yarn compile && yarn lint && yarn stylelint

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
# But not these file types
1313
!*.js
14+
!*.ts
15+
!*.tsx
1416
!*.scss
1517
!*.json
1618

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
### Chores
1313

14+
- Migrated codebase from javascript to typescript ([PR 2843](https://github.com/input-output-hk/daedalus/pull/2843))
1415
- Updated the list of team members ([PR 2805](https://github.com/input-output-hk/daedalus/pull/2805))
1516

1617
## 4.8.0-FC1

declaration.d.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
declare module '*.svg' {
2+
const content: any;
3+
export default content;
4+
}
5+
6+
declare module '*.scss' {
7+
const content: any;
8+
export default content;
9+
}
10+
11+
type Daedalus = {
12+
actions: ActionsMap;
13+
api: Api;
14+
environment: Object;
15+
reset: Function;
16+
stores: StoresMap;
17+
translations: Object;
18+
utils: {
19+
crypto: {
20+
generateMnemonic: Function;
21+
};
22+
};
23+
};
24+
25+
export type $ElementType<
26+
T extends { [P in K & any]: any },
27+
K extends keyof T | number
28+
> = T[K];
29+
30+
export type EnumMap<
31+
K extends string,
32+
V,
33+
O extends Record<string, any> = any
34+
> = O & Record<K, V & $ElementType<O, K>>;
35+
36+
declare global {
37+
namespace NodeJS {
38+
interface ProcessEnv {
39+
WALLET_COUNT: number;
40+
}
41+
}
42+
var daedalus: Daedalus;
43+
}
44+
45+
export {};

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ let
319319
electron = pkgs.callPackage ./installers/nix/electron.nix {};
320320

321321
tests = {
322-
runFlow = self.callPackage ./tests/flow.nix {};
322+
runTsc = self.callPackage ./tests/tsc.nix {};
323323
runLint = self.callPackage ./tests/lint.nix {};
324324
runShellcheck = self.callPackage ./tests/shellcheck.nix { src = ./.;};
325325
};

flow/declarations/EnumMap.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)