Skip to content

Commit bed8685

Browse files
committed
Convert frontend code to typescript
1 parent 2c92c7c commit bed8685

File tree

166 files changed

+556
-366
lines changed

Some content is hidden

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

166 files changed

+556
-366
lines changed

.eslintrc.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ overrides:
6161
- files: ["*.config.*"]
6262
rules:
6363
i/no-unused-modules: [0]
64-
- files: ["**/*.test.*", "web_src/js/test/setup.js"]
64+
- files: ["**/*.test.*", "web_src/js/test/setup.ts"]
6565
env:
6666
vitest-globals/env: true
6767
rules:
@@ -114,7 +114,7 @@ overrides:
114114
vitest/valid-describe-callback: [2]
115115
vitest/valid-expect: [2]
116116
vitest/valid-title: [2]
117-
- files: ["web_src/js/modules/fetch.js", "web_src/js/standalone/**/*"]
117+
- files: ["web_src/js/modules/fetch.ts", "web_src/js/standalone/**/*"]
118118
rules:
119119
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
120120
- files: ["**/*.vue"]
@@ -133,6 +133,9 @@ overrides:
133133
plugins:
134134
- eslint-plugin-playwright
135135
extends: plugin:playwright/recommended
136+
- files: ["**/*.d.ts"]
137+
rules:
138+
i/no-unused-modules: [0]
136139

137140
rules:
138141
"@eslint-community/eslint-comments/disable-enable-pair": [2]
@@ -467,7 +470,7 @@ rules:
467470
no-dupe-else-if: [2]
468471
no-dupe-keys: [2]
469472
no-duplicate-case: [2]
470-
no-duplicate-imports: [2]
473+
no-duplicate-imports: [0]
471474
no-else-return: [2]
472475
no-empty-character-class: [2]
473476
no-empty-function: [0]
@@ -619,7 +622,7 @@ rules:
619622
no-restricted-exports: [0]
620623
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top, __dirname, __filename]
621624
no-restricted-imports: [0]
622-
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression, {selector: "CallExpression[callee.name='fetch']", message: "use modules/fetch.js instead"}]
625+
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression, {selector: "CallExpression[callee.name='fetch']", message: "use modules/fetch.ts instead"}]
623626
no-return-assign: [0]
624627
no-script-url: [2]
625628
no-self-assign: [2, {props: true}]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
144144
GO_DIRS := build cmd models modules routers services tests
145145
WEB_DIRS := web_src/js web_src/css
146146

147-
ESLINT_FILES := web_src/js tools *.js tests/e2e
147+
ESLINT_FILES := web_src/js tools *.js *.ts tests/e2e
148148
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
149149
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml))
150150
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini

package-lock.json

Lines changed: 166 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@
6868
"@stoplight/spectral-cli": "6.11.1",
6969
"@stylistic/eslint-plugin-js": "2.2.1",
7070
"@stylistic/stylelint-plugin": "2.1.2",
71+
"@types/dropzone": "~5.7.8",
72+
"@types/eslint": "~8.56.10",
73+
"@types/jquery": "~3.5.30",
74+
"@types/katex": "~0.16.7",
75+
"@types/license-checker-webpack-plugin": "~0.2.4",
76+
"@types/pdfobject": "~2.2.5",
77+
"@types/primer__octicons": "~19.6.3",
78+
"@types/sortablejs": "~1.15.8",
79+
"@types/swagger-ui-dist": "~3.30.5",
80+
"@types/throttle-debounce": "~5.0.2",
81+
"@types/tinycolor2": "~1.4.6",
82+
"@types/toastify-js": "~1.12.3",
7183
"@typescript-eslint/eslint-plugin": "7.14.1",
7284
"@typescript-eslint/parser": "7.14.1",
7385
"@vitejs/plugin-vue": "5.0.5",

tsconfig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,10 @@
2626
"noUnusedParameters": true,
2727
"noPropertyAccessFromIndexSignature": false,
2828
"exactOptionalPropertyTypes": false,
29+
"sourceMap": true,
30+
"types": [
31+
"vitest/globals",
32+
"./types.d.ts",
33+
],
2934
}
3035
}

types.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.svg' {
2+
const value: string;
3+
export default value;
4+
}

vitest.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {stringPlugin} from 'vite-string-plugin';
44

55
export default defineConfig({
66
test: {
7-
include: ['web_src/**/*.test.js'],
8-
setupFiles: ['web_src/js/vitest.setup.js'],
7+
include: ['web_src/**/*.test.ts'],
8+
setupFiles: ['web_src/js/vitest.setup.ts'],
99
environment: 'happy-dom',
1010
testTimeout: 20000,
1111
open: false,

web_src/js/bootstrap.test.js renamed to web_src/js/bootstrap.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {showGlobalErrorMessage} from './bootstrap.js';
1+
import {showGlobalErrorMessage} from './bootstrap.ts';
22

33
test('showGlobalErrorMessage', () => {
44
document.body.innerHTML = '<div class="page-content"></div>';
File renamed without changes.

web_src/js/components/ActionRunStatus.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
action status accepted: success, skipped, waiting, blocked, running, failure, cancelled, unknown
44
-->
55
<script>
6-
import {SvgIcon} from '../svg.js';
6+
import {SvgIcon} from '../svg.ts';
77
88
export default {
99
components: {SvgIcon},

web_src/js/components/ContextPopup.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import {SvgIcon} from '../svg.js';
3-
import {GET} from '../modules/fetch.js';
2+
import {SvgIcon} from '../svg.ts';
3+
import {GET} from '../modules/fetch.ts';
44
55
const {appSubUrl, i18n} = window.config;
66

web_src/js/components/DashboardRepoList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script>
22
import {createApp, nextTick} from 'vue';
33
import $ from 'jquery';
4-
import {SvgIcon} from '../svg.js';
5-
import {GET} from '../modules/fetch.js';
4+
import {SvgIcon} from '../svg.ts';
5+
import {GET} from '../modules/fetch.ts';
66
77
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
88

web_src/js/components/DiffCommitSelector.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import {SvgIcon} from '../svg.js';
3-
import {GET} from '../modules/fetch.js';
2+
import {SvgIcon} from '../svg.ts';
3+
import {GET} from '../modules/fetch.ts';
44
55
export default {
66
components: {SvgIcon},

web_src/js/components/DiffFileList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import {loadMoreFiles} from '../features/repo-diff.js';
3-
import {diffTreeStore} from '../modules/stores.js';
2+
import {loadMoreFiles} from '../features/repo-diff.ts';
3+
import {diffTreeStore} from '../modules/stores.ts';
44
55
export default {
66
data: () => {

web_src/js/components/DiffFileTree.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<script>
22
import DiffFileTreeItem from './DiffFileTreeItem.vue';
3-
import {loadMoreFiles} from '../features/repo-diff.js';
4-
import {toggleElem} from '../utils/dom.js';
5-
import {diffTreeStore} from '../modules/stores.js';
6-
import {setFileFolding} from '../features/file-fold.js';
3+
import {loadMoreFiles} from '../features/repo-diff.ts';
4+
import {toggleElem} from '../utils/dom.ts';
5+
import {diffTreeStore} from '../modules/stores.ts';
6+
import {setFileFolding} from '../features/file-fold.ts';
77
88
const LOCAL_STORAGE_KEY = 'diff_file_tree_visible';
99

web_src/js/components/DiffFileTreeItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script>
2-
import {SvgIcon} from '../svg.js';
3-
import {diffTreeStore} from '../modules/stores.js';
2+
import {SvgIcon} from '../svg.ts';
3+
import {diffTreeStore} from '../modules/stores.ts';
44
55
export default {
66
components: {SvgIcon},

0 commit comments

Comments
 (0)