зеркало из https://github.com/github/remote-form.git
Merge pull request #28 from github/update-dependencies
Update dependencies
This commit is contained in:
Коммит
fac24b84c9
|
@ -18,7 +18,10 @@
|
|||
},
|
||||
"rules": {
|
||||
"github/unescaped-html-literal": "off",
|
||||
"eslint-comments/no-use": "off"
|
||||
"import/no-unresolved": "off",
|
||||
"import/extensions": "off",
|
||||
"eslint-comments/no-use": "off",
|
||||
"github/no-inner-html": "off"
|
||||
},
|
||||
"env": {
|
||||
"mocha": true
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
13
package.json
13
package.json
|
@ -33,15 +33,14 @@
|
|||
"@github/prettier-config": "0.0.4",
|
||||
"chai": "^4.2.0",
|
||||
"chromium": "^3.0.3",
|
||||
"eslint": "^7.6.0",
|
||||
"eslint-plugin-github": "^4.1.1",
|
||||
"karma": "^5.1.1",
|
||||
"eslint": "^8.17.0",
|
||||
"eslint-plugin-github": "^4.3.6",
|
||||
"karma": "^6.4.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"mocha": "^8.1.1",
|
||||
"typescript": "^3.9.7"
|
||||
},
|
||||
"dependencies": {}
|
||||
"mocha": "^10.0.0",
|
||||
"typescript": "^4.7.3"
|
||||
}
|
||||
}
|
||||
|
|
11
src/index.ts
11
src/index.ts
|
@ -1,6 +1,7 @@
|
|||
// Parse HTML text into document fragment.
|
||||
function parseHTML(document: Document, html: string): DocumentFragment {
|
||||
const template = document.createElement('template')
|
||||
// eslint-disable-next-line github/no-inner-html
|
||||
template.innerHTML = html
|
||||
return document.importNode(template.content, true)
|
||||
}
|
||||
|
@ -23,8 +24,8 @@ export class ErrorWithResponse extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
function makeDeferred<T>(): [Promise<T>, () => void, () => void] {
|
||||
let resolve: () => void
|
||||
function makeDeferred<T>(): [Promise<T>, (x?: unknown) => void, () => void] {
|
||||
let resolve: (x?: unknown) => void
|
||||
let reject: () => void
|
||||
const promise = new Promise(function (_resolve, _reject) {
|
||||
resolve = _resolve
|
||||
|
@ -218,7 +219,7 @@ async function remoteSubmit(req: SimpleRequest): Promise<SimpleResponse> {
|
|||
headers: response.headers,
|
||||
text: '',
|
||||
get json() {
|
||||
// eslint-disable-next-line no-shadow, @typescript-eslint/no-this-alias
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow, @typescript-eslint/no-this-alias
|
||||
const response: SimpleResponse = this
|
||||
const data = JSON.parse(response.text)
|
||||
delete response.json
|
||||
|
@ -226,8 +227,10 @@ async function remoteSubmit(req: SimpleRequest): Promise<SimpleResponse> {
|
|||
return response.json
|
||||
},
|
||||
get html() {
|
||||
// eslint-disable-next-line no-shadow, @typescript-eslint/no-this-alias
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow, @typescript-eslint/no-this-alias
|
||||
const response: SimpleResponse = this
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
delete response.html
|
||||
|
||||
response.html = parseHTML(document, response.text)
|
||||
|
|
Загрузка…
Ссылка в новой задаче