Convert frontend code to typescript (#31559)
None of the frontend js/ts files was touched besides these two commands
(edit: no longer true, I touched one file in
61105d0618
because of a deprecation that was not showing before the rename).
`tsc` currently reports 778 errors, so I have disabled it in CI as
planned.
Everything appears to work fine.
This commit is contained in:
parent
5115c278ff
commit
5791a73e75
168 changed files with 562 additions and 386 deletions
|
@ -1,4 +1,4 @@
|
|||
import {isDocumentFragmentOrElementNode} from '../utils/dom.js';
|
||||
import {isDocumentFragmentOrElementNode} from '../utils/dom.ts';
|
||||
|
||||
// for performance considerations, it only uses performant syntax
|
||||
function attachDirAuto(el) {
|
|
@ -1,4 +1,4 @@
|
|||
import {GET, POST, PATCH, PUT, DELETE} from './fetch.js';
|
||||
import {GET, POST, PATCH, PUT, DELETE} from './fetch.ts';
|
||||
|
||||
// tests here are only to satisfy the linter for unused functions
|
||||
test('exports', () => {
|
|
@ -1,4 +1,4 @@
|
|||
import {isObject} from '../utils.js';
|
||||
import {isObject} from '../utils.ts';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
import $ from 'jquery';
|
||||
import {initFomanticApiPatch} from './fomantic/api.js';
|
||||
import {initAriaCheckboxPatch} from './fomantic/checkbox.js';
|
||||
import {initAriaFormFieldPatch} from './fomantic/form.js';
|
||||
import {initAriaDropdownPatch} from './fomantic/dropdown.js';
|
||||
import {initAriaModalPatch} from './fomantic/modal.js';
|
||||
import {initFomanticTransition} from './fomantic/transition.js';
|
||||
import {initFomanticDimmer} from './fomantic/dimmer.js';
|
||||
import {svg} from '../svg.js';
|
||||
import {initFomanticApiPatch} from './fomantic/api.ts';
|
||||
import {initAriaCheckboxPatch} from './fomantic/checkbox.ts';
|
||||
import {initAriaFormFieldPatch} from './fomantic/form.ts';
|
||||
import {initAriaDropdownPatch} from './fomantic/dropdown.ts';
|
||||
import {initAriaModalPatch} from './fomantic/modal.ts';
|
||||
import {initFomanticTransition} from './fomantic/transition.ts';
|
||||
import {initFomanticDimmer} from './fomantic/dimmer.ts';
|
||||
import {svg} from '../svg.ts';
|
||||
|
||||
export const fomanticMobileScreen = window.matchMedia('only screen and (max-width: 767.98px)');
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import {linkLabelAndInput} from './base.js';
|
||||
import {linkLabelAndInput} from './base.ts';
|
||||
|
||||
export function initAriaCheckboxPatch() {
|
||||
// link the label and the input element so it's clickable and accessible
|
|
@ -1,5 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
import {queryElemChildren} from '../../utils/dom.js';
|
||||
import {queryElemChildren} from '../../utils/dom.ts';
|
||||
|
||||
export function initFomanticDimmer() {
|
||||
// stand-in for removed dimmer module
|
|
@ -1,5 +1,5 @@
|
|||
import $ from 'jquery';
|
||||
import {generateAriaId} from './base.js';
|
||||
import {generateAriaId} from './base.ts';
|
||||
|
||||
const ariaPatchKey = '_giteaAriaPatchDropdown';
|
||||
const fomanticDropdownFn = $.fn.dropdown;
|
|
@ -1,4 +1,4 @@
|
|||
import {linkLabelAndInput} from './base.js';
|
||||
import {linkLabelAndInput} from './base.ts';
|
||||
|
||||
export function initAriaFormFieldPatch() {
|
||||
// link the label and the input element so it's clickable and accessible
|
|
@ -1,6 +1,6 @@
|
|||
import tippy, {followCursor} from 'tippy.js';
|
||||
import {isDocumentFragmentOrElementNode} from '../utils/dom.js';
|
||||
import {formatDatetime} from '../utils/time.js';
|
||||
import {isDocumentFragmentOrElementNode} from '../utils/dom.ts';
|
||||
import {formatDatetime} from '../utils/time.ts';
|
||||
|
||||
const visibleInstances = new Set();
|
||||
const arrowSvg = `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`;
|
|
@ -1,4 +1,4 @@
|
|||
import {showInfoToast, showErrorToast, showWarningToast} from './toast.js';
|
||||
import {showInfoToast, showErrorToast, showWarningToast} from './toast.ts';
|
||||
|
||||
test('showInfoToast', async () => {
|
||||
showInfoToast('success 😀', {duration: -1});
|
|
@ -1,6 +1,6 @@
|
|||
import {htmlEscape} from 'escape-goat';
|
||||
import {svg} from '../svg.js';
|
||||
import {animateOnce, showElem} from '../utils/dom.js';
|
||||
import {svg} from '../svg.ts';
|
||||
import {animateOnce, showElem} from '../utils/dom.ts';
|
||||
import Toastify from 'toastify-js'; // don't use "async import", because when network error occurs, the "async import" also fails and nothing is shown
|
||||
|
||||
const levels = {
|
|
@ -1,4 +1,4 @@
|
|||
import {sleep} from '../utils.js';
|
||||
import {sleep} from '../utils.ts';
|
||||
|
||||
const {appSubUrl} = window.config;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue