Skip to content

Commit 15b1069

Browse files
authored
chore: Move to Typescript (outline#2783)
This PR moves the entire project to Typescript. Due to the ~1000 ignores this will lead to a messy codebase for a while, but the churn is worth it – all of those ignore comments are places that were never type-safe previously. closes outline#1282
1 parent 25ccfb5 commit 15b1069

File tree

1,679 files changed

+68927
-106459
lines changed

Some content is hidden

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

1,679 files changed

+68927
-106459
lines changed

.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"presets": [
33
"@babel/preset-react",
4-
"@babel/preset-flow",
4+
"@babel/preset-typescript",
55
[
66
"@babel/preset-env",
77
{

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
name: lint
4242
command: yarn lint
4343
- run:
44-
name: flow
45-
command: yarn flow check --max-workers 4
44+
name: typescript
45+
command: yarn tsc
4646
- run:
4747
name: test
4848
command: yarn test

.dockerignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ __mocks__
66
.DS_Store
77
.env*
88
.eslint*
9-
.flowconfig
109
.log
1110
Makefile
1211
Procfile
1312
app.json
13+
crowdin.yml
1414
build
1515
docker-compose.yml
1616
fakes3
17-
flow-typed
1817
node_modules
19-
setupJest.js
18+
tsconfig.json

.eslintrc

+43-42
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
11
{
2-
"parser": "babel-eslint",
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"sourceType": "module",
5+
"extraFileExtensions": [".json"],
6+
"ecmaFeatures": {
7+
"jsx": true
8+
}
9+
},
310
"extends": [
4-
"react-app",
5-
"plugin:import/errors",
6-
"plugin:import/warnings",
7-
"plugin:flowtype/recommended",
8-
"plugin:react-hooks/recommended"
11+
"eslint:recommended",
12+
"plugin:@typescript-eslint/recommended",
13+
"plugin:import/recommended",
14+
"plugin:import/typescript",
15+
"plugin:react-hooks/recommended",
16+
"plugin:prettier/recommended"
917
],
1018
"plugins": [
11-
"prettier",
12-
"flowtype"
19+
"@typescript-eslint",
20+
"eslint-plugin-import",
21+
"eslint-plugin-node",
22+
"eslint-plugin-react",
23+
"eslint-plugin-react-hooks",
24+
"import"
1325
],
1426
"rules": {
1527
"eqeqeq": 2,
16-
"no-unused-vars": 2,
1728
"no-mixed-operators": "off",
29+
"padding-line-between-statements": ["error", { "blankLine": "always", "prev": "*", "next": "export" }],
30+
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
31+
"import/newline-after-import": 2,
1832
"import/order": [
1933
"error",
2034
{
@@ -23,53 +37,48 @@
2337
},
2438
"pathGroups": [
2539
{
26-
"pattern": "shared/**",
40+
"pattern": "@shared/**",
41+
"group": "external",
42+
"position": "after"
43+
},
44+
{
45+
"pattern": "@server/**",
46+
"group": "external",
47+
"position": "after"
48+
},
49+
{
50+
"pattern": "~/stores",
2751
"group": "external",
2852
"position": "after"
2953
},
3054
{
31-
"pattern": "stores",
55+
"pattern": "~/stores/**",
3256
"group": "external",
3357
"position": "after"
3458
},
3559
{
36-
"pattern": "stores/**",
60+
"pattern": "~/models/**",
3761
"group": "external",
3862
"position": "after"
3963
},
4064
{
41-
"pattern": "models/**",
65+
"pattern": "~/scenes/**",
4266
"group": "external",
4367
"position": "after"
4468
},
4569
{
46-
"pattern": "scenes/**",
70+
"pattern": "~/components/**",
4771
"group": "external",
4872
"position": "after"
4973
},
5074
{
51-
"pattern": "components/**",
75+
"pattern": "~/**",
5276
"group": "external",
5377
"position": "after"
5478
}
5579
]
5680
}
5781
],
58-
"flowtype/require-valid-file-annotation": [
59-
2,
60-
"always",
61-
{
62-
"annotationStyle": "line"
63-
}
64-
],
65-
"flowtype/space-after-type-colon": [
66-
2,
67-
"always"
68-
],
69-
"flowtype/space-before-type-colon": [
70-
2,
71-
"never"
72-
],
7382
"prettier/prettier": [
7483
"error",
7584
{
@@ -84,21 +93,13 @@
8493
"pragma": "React",
8594
"version": "detect"
8695
},
87-
"import/resolver": {
88-
"node": {
89-
"paths": [
90-
"app",
91-
"."
92-
]
93-
}
96+
"import/parsers": {
97+
"@typescript-eslint/parser": [".ts", ".tsx"]
9498
},
95-
"flowtype": {
96-
"onlyFilesWithFlowAnnotation": false
99+
"import/resolver": {
100+
"typescript": {}
97101
}
98102
},
99-
"env": {
100-
"jest": true
101-
},
102103
"globals": {
103104
"EDITOR_VERSION": true
104105
}

.flowconfig

-44
This file was deleted.

.vscode/settings.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"javascript.validate.enable": false,
3-
"javascript.format.enable": false,
4-
"typescript.validate.enable": false,
5-
"typescript.format.enable": false,
2+
"javascript.validate.enable": true,
3+
"javascript.format.enable": true,
4+
"typescript.validate.enable": true,
5+
"typescript.format.enable": true,
66
"editor.formatOnSave": true,
77
}

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
</p>
99
<p align="center">
1010
<a href="https://circleci.com/gh/outline/outline" rel="nofollow"><img src="https://circleci.com/gh/outline/outline.svg?style=shield&amp;circle-token=c0c4c2f39990e277385d5c1ae96169c409eb887a"></a>
11-
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat"></a>
12-
<a href="https://github.com/styled-components/styled-components"><img src="https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg"></a>
13-
<a href="https://translate.getoutline.com/project/outline"><img src="https://badges.crowdin.net/outline/localized.svg"></a>
11+
<a href="http://www.typescriptlang.org" rel="nofollow"><img src="https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg" alt="TypeScript"></a>
12+
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat" alt="Prettier"></a>
13+
<a href="https://github.com/styled-components/styled-components"><img src="https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg" alt="Styled Components"></a>
14+
<a href="https://translate.getoutline.com/project/outline" alt="Localized"><img src="https://badges.crowdin.net/outline/localized.svg"></a>
1415
</p>
1516

1617
This is the source code that runs [**Outline**](https://www.getoutline.com) and all the associated services. If you want to use Outline then you don't need to run this code, we offer a hosted version of the app at [getoutline.com](https://www.getoutline.com).

__mocks__/bull.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable flowtype/require-valid-file-annotation */
21
export default class Queue {
32
name;
43

app/.eslintrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": [
3+
"../.eslintrc"
4+
],
5+
"env": {
6+
"jest": true,
7+
"browser": true
8+
}
9+
}

app/.jestconfig.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
"<rootDir>/shared"
88
],
99
"moduleNameMapper": {
10-
"^shared/(.*)$": "<rootDir>/shared/$1",
10+
"^~/(.*)$": "<rootDir>/app/$1",
11+
"^@shared/(.*)$": "<rootDir>/shared/$1",
1112
"^.*[.](gif|ttf|eot|svg)$": "<rootDir>/__test__/fileMock.js"
1213
},
13-
"moduleFileExtensions": [
14-
"js",
15-
"jsx",
16-
"json"
17-
],
1814
"moduleDirectories": [
1915
"node_modules"
2016
],
@@ -25,6 +21,6 @@
2521
"<rootDir>/__mocks__/window.js"
2622
],
2723
"setupFilesAfterEnv": [
28-
"./app/test/setup.js"
24+
"./app/test/setup.ts"
2925
]
3026
}

app/actions/definitions/collections.js

-70
This file was deleted.

0 commit comments

Comments
 (0)