Update to eslint 10 (#36925)
- Enable a few more rules, fix issues. The 2 `value` issues are false-positives. - Add exact types for `window.pageData` and `window.notificationSettings`. - peerDependencyRules for eslint-plugin-github unrestricted, the plugin works in v10, but does not declare compatibility, pending https://github.com/github/eslint-plugin-github/issues/680. - Added [eslint-plugin-de-morgan](https://github.com/azat-io/eslint-plugin-de-morgan), no violations. --------- Signed-off-by: silverwind <me@silverwind.io> Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import arrayFunc from 'eslint-plugin-array-func';
|
import arrayFunc from 'eslint-plugin-array-func';
|
||||||
import comments from '@eslint-community/eslint-plugin-eslint-comments';
|
import comments from '@eslint-community/eslint-plugin-eslint-comments';
|
||||||
|
import deMorgan from 'eslint-plugin-de-morgan';
|
||||||
import github from 'eslint-plugin-github';
|
import github from 'eslint-plugin-github';
|
||||||
import globals from 'globals';
|
import globals from 'globals';
|
||||||
import importPlugin from 'eslint-plugin-import-x';
|
import importPlugin from 'eslint-plugin-import-x';
|
||||||
@@ -63,6 +64,7 @@ export default defineConfig([
|
|||||||
'@stylistic': stylistic,
|
'@stylistic': stylistic,
|
||||||
'@typescript-eslint': typescriptPlugin.plugin,
|
'@typescript-eslint': typescriptPlugin.plugin,
|
||||||
'array-func': arrayFunc,
|
'array-func': arrayFunc,
|
||||||
|
'de-morgan': deMorgan,
|
||||||
'import-x': importPlugin as unknown as ESLint.Plugin, // https://github.com/un-ts/eslint-plugin-import-x/issues/203
|
'import-x': importPlugin as unknown as ESLint.Plugin, // https://github.com/un-ts/eslint-plugin-import-x/issues/203
|
||||||
regexp,
|
regexp,
|
||||||
sonarjs,
|
sonarjs,
|
||||||
@@ -179,7 +181,7 @@ export default defineConfig([
|
|||||||
'@typescript-eslint/naming-convention': [0],
|
'@typescript-eslint/naming-convention': [0],
|
||||||
'@typescript-eslint/no-array-constructor': [2],
|
'@typescript-eslint/no-array-constructor': [2],
|
||||||
'@typescript-eslint/no-array-delete': [2],
|
'@typescript-eslint/no-array-delete': [2],
|
||||||
'@typescript-eslint/no-base-to-string': [0],
|
'@typescript-eslint/no-base-to-string': [2],
|
||||||
'@typescript-eslint/no-confusing-non-null-assertion': [2],
|
'@typescript-eslint/no-confusing-non-null-assertion': [2],
|
||||||
'@typescript-eslint/no-confusing-void-expression': [0],
|
'@typescript-eslint/no-confusing-void-expression': [0],
|
||||||
'@typescript-eslint/no-deprecated': [2],
|
'@typescript-eslint/no-deprecated': [2],
|
||||||
@@ -254,10 +256,10 @@ export default defineConfig([
|
|||||||
'@typescript-eslint/prefer-function-type': [2],
|
'@typescript-eslint/prefer-function-type': [2],
|
||||||
'@typescript-eslint/prefer-includes': [2],
|
'@typescript-eslint/prefer-includes': [2],
|
||||||
'@typescript-eslint/prefer-literal-enum-member': [0],
|
'@typescript-eslint/prefer-literal-enum-member': [0],
|
||||||
'@typescript-eslint/prefer-namespace-keyword': [0],
|
'@typescript-eslint/prefer-namespace-keyword': [2],
|
||||||
'@typescript-eslint/prefer-nullish-coalescing': [0],
|
'@typescript-eslint/prefer-nullish-coalescing': [0],
|
||||||
'@typescript-eslint/prefer-optional-chain': [2, {requireNullish: true}],
|
'@typescript-eslint/prefer-optional-chain': [2, {requireNullish: true}],
|
||||||
'@typescript-eslint/prefer-promise-reject-errors': [0],
|
'@typescript-eslint/prefer-promise-reject-errors': [2],
|
||||||
'@typescript-eslint/prefer-readonly': [0],
|
'@typescript-eslint/prefer-readonly': [0],
|
||||||
'@typescript-eslint/prefer-readonly-parameter-types': [0],
|
'@typescript-eslint/prefer-readonly-parameter-types': [0],
|
||||||
'@typescript-eslint/prefer-reduce-type-parameter': [0],
|
'@typescript-eslint/prefer-reduce-type-parameter': [0],
|
||||||
@@ -268,7 +270,7 @@ export default defineConfig([
|
|||||||
'@typescript-eslint/require-array-sort-compare': [0],
|
'@typescript-eslint/require-array-sort-compare': [0],
|
||||||
'@typescript-eslint/require-await': [0],
|
'@typescript-eslint/require-await': [0],
|
||||||
'@typescript-eslint/restrict-plus-operands': [2],
|
'@typescript-eslint/restrict-plus-operands': [2],
|
||||||
'@typescript-eslint/restrict-template-expressions': [0],
|
'@typescript-eslint/restrict-template-expressions': [2],
|
||||||
'@typescript-eslint/return-await': [0],
|
'@typescript-eslint/return-await': [0],
|
||||||
'@typescript-eslint/strict-boolean-expressions': [0],
|
'@typescript-eslint/strict-boolean-expressions': [0],
|
||||||
'@typescript-eslint/strict-void-return': [0],
|
'@typescript-eslint/strict-void-return': [0],
|
||||||
@@ -295,6 +297,8 @@ export default defineConfig([
|
|||||||
'consistent-this': [0],
|
'consistent-this': [0],
|
||||||
'constructor-super': [2],
|
'constructor-super': [2],
|
||||||
'curly': [0],
|
'curly': [0],
|
||||||
|
'de-morgan/no-negated-conjunction': [2],
|
||||||
|
'de-morgan/no-negated-disjunction': [2],
|
||||||
'default-case-last': [2],
|
'default-case-last': [2],
|
||||||
'default-case': [0],
|
'default-case': [0],
|
||||||
'default-param-last': [0],
|
'default-param-last': [0],
|
||||||
@@ -586,6 +590,7 @@ export default defineConfig([
|
|||||||
'no-undef-init': [2],
|
'no-undef-init': [2],
|
||||||
'no-undef': [2], // it is still needed by eslint & IDE to prompt undefined names in real time
|
'no-undef': [2], // it is still needed by eslint & IDE to prompt undefined names in real time
|
||||||
'no-undefined': [0],
|
'no-undefined': [0],
|
||||||
|
'no-unassigned-vars': [2],
|
||||||
'no-underscore-dangle': [0],
|
'no-underscore-dangle': [0],
|
||||||
'no-unexpected-multiline': [2],
|
'no-unexpected-multiline': [2],
|
||||||
'no-unmodified-loop-condition': [2],
|
'no-unmodified-loop-condition': [2],
|
||||||
@@ -626,19 +631,20 @@ export default defineConfig([
|
|||||||
'prefer-numeric-literals': [2],
|
'prefer-numeric-literals': [2],
|
||||||
'prefer-object-has-own': [2],
|
'prefer-object-has-own': [2],
|
||||||
'prefer-object-spread': [2],
|
'prefer-object-spread': [2],
|
||||||
'prefer-promise-reject-errors': [2, {allowEmptyReject: false}],
|
'prefer-promise-reject-errors': [0], // handled by @typescript-eslint/prefer-promise-reject-errors
|
||||||
'prefer-regex-literals': [2],
|
'prefer-regex-literals': [2],
|
||||||
'prefer-rest-params': [2],
|
'prefer-rest-params': [2],
|
||||||
'prefer-spread': [2],
|
'prefer-spread': [2],
|
||||||
'prefer-template': [2],
|
'prefer-template': [2],
|
||||||
'radix': [2, 'as-needed'],
|
'preserve-caught-error': [0],
|
||||||
|
'radix': [0],
|
||||||
'regexp/confusing-quantifier': [2],
|
'regexp/confusing-quantifier': [2],
|
||||||
'regexp/control-character-escape': [2],
|
'regexp/control-character-escape': [2],
|
||||||
'regexp/hexadecimal-escape': [0],
|
'regexp/hexadecimal-escape': [0],
|
||||||
'regexp/letter-case': [0],
|
'regexp/letter-case': [0],
|
||||||
'regexp/match-any': [2],
|
'regexp/match-any': [2],
|
||||||
'regexp/negation': [2],
|
'regexp/negation': [2],
|
||||||
'regexp/no-contradiction-with-assertion': [0],
|
'regexp/no-contradiction-with-assertion': [2],
|
||||||
'regexp/no-control-character': [0],
|
'regexp/no-control-character': [0],
|
||||||
'regexp/no-dupe-characters-character-class': [2],
|
'regexp/no-dupe-characters-character-class': [2],
|
||||||
'regexp/no-dupe-disjunctions': [2],
|
'regexp/no-dupe-disjunctions': [2],
|
||||||
@@ -654,8 +660,8 @@ export default defineConfig([
|
|||||||
'regexp/no-invisible-character': [2],
|
'regexp/no-invisible-character': [2],
|
||||||
'regexp/no-lazy-ends': [2],
|
'regexp/no-lazy-ends': [2],
|
||||||
'regexp/no-legacy-features': [2],
|
'regexp/no-legacy-features': [2],
|
||||||
'regexp/no-misleading-capturing-group': [0],
|
'regexp/no-misleading-capturing-group': [2],
|
||||||
'regexp/no-misleading-unicode-character': [0],
|
'regexp/no-misleading-unicode-character': [2],
|
||||||
'regexp/no-missing-g-flag': [2],
|
'regexp/no-missing-g-flag': [2],
|
||||||
'regexp/no-non-standard-flag': [2],
|
'regexp/no-non-standard-flag': [2],
|
||||||
'regexp/no-obscure-range': [2],
|
'regexp/no-obscure-range': [2],
|
||||||
@@ -991,6 +997,7 @@ export default defineConfig([
|
|||||||
'vitest/require-top-level-describe': [0],
|
'vitest/require-top-level-describe': [0],
|
||||||
'vitest/valid-describe-callback': [2],
|
'vitest/valid-describe-callback': [2],
|
||||||
'vitest/valid-expect': [2, {maxArgs: 2}],
|
'vitest/valid-expect': [2, {maxArgs: 2}],
|
||||||
|
'vitest/valid-expect-in-promise': [2],
|
||||||
'vitest/valid-title': [2],
|
'vitest/valid-title': [2],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
26
package.json
26
package.json
@@ -67,7 +67,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
|
"@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
|
||||||
"@eslint/json": "0.14.0",
|
"@eslint/json": "1.1.0",
|
||||||
"@playwright/test": "1.58.2",
|
"@playwright/test": "1.58.2",
|
||||||
"@stylistic/eslint-plugin": "5.10.0",
|
"@stylistic/eslint-plugin": "5.10.0",
|
||||||
"@stylistic/stylelint-plugin": "5.0.1",
|
"@stylistic/stylelint-plugin": "5.0.1",
|
||||||
@@ -82,17 +82,18 @@
|
|||||||
"@types/swagger-ui-dist": "3.30.6",
|
"@types/swagger-ui-dist": "3.30.6",
|
||||||
"@types/throttle-debounce": "5.0.2",
|
"@types/throttle-debounce": "5.0.2",
|
||||||
"@types/toastify-js": "1.12.4",
|
"@types/toastify-js": "1.12.4",
|
||||||
"@typescript-eslint/parser": "8.56.1",
|
"@typescript-eslint/parser": "8.57.1",
|
||||||
"@vitejs/plugin-vue": "6.0.4",
|
"@vitejs/plugin-vue": "6.0.4",
|
||||||
"@vitest/eslint-plugin": "1.6.9",
|
"@vitest/eslint-plugin": "1.6.12",
|
||||||
"eslint": "9.39.2",
|
"eslint": "10.0.3",
|
||||||
"eslint-import-resolver-typescript": "4.4.4",
|
"eslint-import-resolver-typescript": "4.4.4",
|
||||||
"eslint-plugin-array-func": "5.1.0",
|
"eslint-plugin-array-func": "5.1.1",
|
||||||
"eslint-plugin-github": "6.0.0",
|
"eslint-plugin-github": "6.0.0",
|
||||||
"eslint-plugin-import-x": "4.16.1",
|
"eslint-plugin-de-morgan": "2.1.1",
|
||||||
"eslint-plugin-playwright": "2.9.0",
|
"eslint-plugin-import-x": "4.16.2",
|
||||||
"eslint-plugin-regexp": "3.0.0",
|
"eslint-plugin-playwright": "2.10.1",
|
||||||
"eslint-plugin-sonarjs": "4.0.1",
|
"eslint-plugin-regexp": "3.1.0",
|
||||||
|
"eslint-plugin-sonarjs": "4.0.2",
|
||||||
"eslint-plugin-unicorn": "63.0.0",
|
"eslint-plugin-unicorn": "63.0.0",
|
||||||
"eslint-plugin-vue": "10.8.0",
|
"eslint-plugin-vue": "10.8.0",
|
||||||
"eslint-plugin-vue-scoped-css": "3.0.0",
|
"eslint-plugin-vue-scoped-css": "3.0.0",
|
||||||
@@ -112,13 +113,18 @@
|
|||||||
"stylelint-value-no-unknown-custom-properties": "6.1.1",
|
"stylelint-value-no-unknown-custom-properties": "6.1.1",
|
||||||
"svgo": "4.0.1",
|
"svgo": "4.0.1",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"typescript-eslint": "8.56.1",
|
"typescript-eslint": "8.57.1",
|
||||||
"updates": "17.8.3",
|
"updates": "17.8.3",
|
||||||
"vite-string-plugin": "2.0.1",
|
"vite-string-plugin": "2.0.1",
|
||||||
"vitest": "4.0.18",
|
"vitest": "4.0.18",
|
||||||
"vue-tsc": "3.2.5"
|
"vue-tsc": "3.2.5"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
"peerDependencyRules": {
|
||||||
|
"allowedVersions": {
|
||||||
|
"eslint-plugin-github>eslint": ">=9"
|
||||||
|
}
|
||||||
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"array-includes": "npm:@nolyfill/array-includes@^1",
|
"array-includes": "npm:@nolyfill/array-includes@^1",
|
||||||
"array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@^1",
|
"array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@^1",
|
||||||
|
|||||||
562
pnpm-lock.yaml
generated
562
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,8 +4,6 @@ export default {
|
|||||||
exclude: [
|
exclude: [
|
||||||
'@mcaptcha/vanilla-glue', // breaking changes in rc versions need to be handled
|
'@mcaptcha/vanilla-glue', // breaking changes in rc versions need to be handled
|
||||||
'cropperjs', // need to migrate to v2 but v2 is not compatible with v1
|
'cropperjs', // need to migrate to v2 but v2 is not compatible with v1
|
||||||
'eslint', // need to migrate to v10
|
|
||||||
'tailwindcss', // need to migrate
|
'tailwindcss', // need to migrate
|
||||||
'@eslint/json', // needs eslint 10
|
|
||||||
],
|
],
|
||||||
} satisfies Config;
|
} satisfies Config;
|
||||||
|
|||||||
@@ -3,14 +3,30 @@ import {nextTick, defineComponent} from 'vue';
|
|||||||
import {SvgIcon} from '../svg.ts';
|
import {SvgIcon} from '../svg.ts';
|
||||||
import {GET} from '../modules/fetch.ts';
|
import {GET} from '../modules/fetch.ts';
|
||||||
import {fomanticQuery} from '../modules/fomantic/base.ts';
|
import {fomanticQuery} from '../modules/fomantic/base.ts';
|
||||||
|
import type {SvgName} from '../svg.ts';
|
||||||
|
|
||||||
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
|
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
|
||||||
|
|
||||||
|
type DashboardRepo = {
|
||||||
|
id: number,
|
||||||
|
link: string,
|
||||||
|
full_name: string,
|
||||||
|
archived: boolean,
|
||||||
|
fork: boolean,
|
||||||
|
mirror: boolean,
|
||||||
|
template: boolean,
|
||||||
|
private: boolean,
|
||||||
|
internal: boolean,
|
||||||
|
latest_commit_status_state?: CommitStatus,
|
||||||
|
latest_commit_status_state_link?: string,
|
||||||
|
locale_latest_commit_status_state?: string,
|
||||||
|
};
|
||||||
|
|
||||||
type CommitStatus = 'pending' | 'success' | 'error' | 'failure' | 'warning' | 'skipped';
|
type CommitStatus = 'pending' | 'success' | 'error' | 'failure' | 'warning' | 'skipped';
|
||||||
|
|
||||||
type CommitStatusMap = {
|
type CommitStatusMap = {
|
||||||
[status in CommitStatus]: {
|
[status in CommitStatus]: {
|
||||||
name: string,
|
name: SvgName,
|
||||||
color: string,
|
color: string,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -38,8 +54,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
tab,
|
tab,
|
||||||
repos: [],
|
repos: [] as DashboardRepo[],
|
||||||
reposTotalCount: null,
|
reposTotalCount: null as number | null,
|
||||||
reposFilter,
|
reposFilter,
|
||||||
archivedFilter,
|
archivedFilter,
|
||||||
privateFilter,
|
privateFilter,
|
||||||
@@ -48,7 +64,7 @@ export default defineComponent({
|
|||||||
searchQuery,
|
searchQuery,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
staticPrefix: assetUrlPrefix,
|
staticPrefix: assetUrlPrefix,
|
||||||
counts: {},
|
counts: {} as Record<string, number>,
|
||||||
repoTypes: {
|
repoTypes: {
|
||||||
all: {
|
all: {
|
||||||
searchMode: '',
|
searchMode: '',
|
||||||
@@ -65,16 +81,49 @@ export default defineComponent({
|
|||||||
collaborative: {
|
collaborative: {
|
||||||
searchMode: 'collaborative',
|
searchMode: 'collaborative',
|
||||||
},
|
},
|
||||||
},
|
} as Record<string, {searchMode: string}>,
|
||||||
textArchivedFilterTitles: {},
|
textArchivedFilterTitles: {} as Record<string, string>,
|
||||||
textPrivateFilterTitles: {},
|
textPrivateFilterTitles: {} as Record<string, string>,
|
||||||
|
organizations: [] as Array<{name: string, full_name: string, num_repos: number, org_visibility: string}>,
|
||||||
organizations: [],
|
|
||||||
isOrganization: true,
|
isOrganization: true,
|
||||||
canCreateOrganization: false,
|
canCreateOrganization: false,
|
||||||
organizationsTotalCount: 0,
|
organizationsTotalCount: 0,
|
||||||
organizationId: 0,
|
organizationId: 0,
|
||||||
|
searchLimit: 0,
|
||||||
|
uid: 0,
|
||||||
|
teamId: 0,
|
||||||
|
isMirrorsEnabled: false,
|
||||||
|
isStarsEnabled: false,
|
||||||
|
canCreateMigrations: false,
|
||||||
|
textNoOrg: '',
|
||||||
|
textNoRepo: '',
|
||||||
|
textRepository: '',
|
||||||
|
textOrganization: '',
|
||||||
|
textMyRepos: '',
|
||||||
|
textNewRepo: '',
|
||||||
|
textSearchRepos: '',
|
||||||
|
textFilter: '',
|
||||||
|
textShowArchived: '',
|
||||||
|
textShowPrivate: '',
|
||||||
|
textShowBothArchivedUnarchived: '',
|
||||||
|
textShowOnlyUnarchived: '',
|
||||||
|
textShowOnlyArchived: '',
|
||||||
|
textShowBothPrivatePublic: '',
|
||||||
|
textShowOnlyPublic: '',
|
||||||
|
textShowOnlyPrivate: '',
|
||||||
|
textAll: '',
|
||||||
|
textSources: '',
|
||||||
|
textForks: '',
|
||||||
|
textMirrors: '',
|
||||||
|
textCollaborative: '',
|
||||||
|
textFirstPage: '',
|
||||||
|
textPreviousPage: '',
|
||||||
|
textNextPage: '',
|
||||||
|
textLastPage: '',
|
||||||
|
textMyOrgs: '',
|
||||||
|
textNewOrg: '',
|
||||||
|
textOrgVisibilityLimited: '',
|
||||||
|
textOrgVisibilityPrivate: '',
|
||||||
subUrl: appSubUrl,
|
subUrl: appSubUrl,
|
||||||
...pageData.dashboardRepoList,
|
...pageData.dashboardRepoList,
|
||||||
activeIndex: -1, // don't select anything at load, first cursor down will select
|
activeIndex: -1, // don't select anything at load, first cursor down will select
|
||||||
@@ -250,7 +299,7 @@ export default defineComponent({
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
// MDN: If there's no focused element, this is the Document.body or Document.documentElement.
|
// MDN: If there's no focused element, this is the Document.body or Document.documentElement.
|
||||||
if ((document.activeElement === document.body || document.activeElement === document.documentElement)) {
|
if ((document.activeElement === document.body || document.activeElement === document.documentElement)) {
|
||||||
this.$refs.search.focus({preventScroll: true});
|
(this.$refs.search as HTMLInputElement).focus({preventScroll: true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -283,7 +332,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
repoIcon(repo: any) {
|
repoIcon(repo: DashboardRepo) {
|
||||||
if (repo.fork) {
|
if (repo.fork) {
|
||||||
return 'octicon-repo-forked';
|
return 'octicon-repo-forked';
|
||||||
} else if (repo.mirror) {
|
} else if (repo.mirror) {
|
||||||
@@ -435,7 +484,7 @@ export default defineComponent({
|
|||||||
<svg-icon name="octicon-archive" :size="16"/>
|
<svg-icon name="octicon-archive" :size="16"/>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a class="tw-flex tw-items-center" v-if="repo.latest_commit_status_state" :href="repo.latest_commit_status_state_link || null" :data-tooltip-content="repo.locale_latest_commit_status_state">
|
<a class="tw-flex tw-items-center" v-if="repo.latest_commit_status_state" :href="repo.latest_commit_status_state_link || undefined" :data-tooltip-content="repo.locale_latest_commit_status_state">
|
||||||
<!-- the commit status icon logic is taken from templates/repo/commit_status.tmpl -->
|
<!-- the commit status icon logic is taken from templates/repo/commit_status.tmpl -->
|
||||||
<svg-icon :name="statusIcon(repo.latest_commit_status_state)" :class="'tw-ml-2 commit-status icon ' + statusColor(repo.latest_commit_status_state)" :size="16"/>
|
<svg-icon :name="statusIcon(repo.latest_commit_status_state)" :class="'tw-ml-2 commit-status icon ' + statusColor(repo.latest_commit_status_state)" :size="16"/>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {toggleElem} from '../utils/dom.ts';
|
|||||||
|
|
||||||
const {pageData} = window.config;
|
const {pageData} = window.config;
|
||||||
|
|
||||||
const mergeForm = pageData.pullRequestMergeForm;
|
const mergeForm = pageData.pullRequestMergeForm!;
|
||||||
|
|
||||||
const mergeTitleFieldValue = shallowRef('');
|
const mergeTitleFieldValue = shallowRef('');
|
||||||
const mergeMessageFieldValue = shallowRef('');
|
const mergeMessageFieldValue = shallowRef('');
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ defineProps<{
|
|||||||
|
|
||||||
const isLoading = shallowRef(false);
|
const isLoading = shallowRef(false);
|
||||||
const errorText = shallowRef('');
|
const errorText = shallowRef('');
|
||||||
const repoLink = pageData.repoLink;
|
const repoLink = pageData.repoLink!;
|
||||||
const data = shallowRef<DayData[]>([]);
|
const data = shallowRef<DayData[]>([]);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ defineProps<{
|
|||||||
|
|
||||||
const isLoading = shallowRef(false);
|
const isLoading = shallowRef(false);
|
||||||
const errorText = shallowRef('');
|
const errorText = shallowRef('');
|
||||||
const repoLink = pageData.repoLink;
|
const repoLink = pageData.repoLink!;
|
||||||
const data = ref<DayData[]>([]);
|
const data = ref<DayData[]>([]);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ async function initInputCitationValue(citationCopyApa: HTMLButtonElement, citati
|
|||||||
import(/* webpackChunkName: "citation-js-bibtex" */'@citation-js/plugin-bibtex'),
|
import(/* webpackChunkName: "citation-js-bibtex" */'@citation-js/plugin-bibtex'),
|
||||||
import(/* webpackChunkName: "citation-js-csl" */'@citation-js/plugin-csl'),
|
import(/* webpackChunkName: "citation-js-csl" */'@citation-js/plugin-csl'),
|
||||||
]);
|
]);
|
||||||
const {citationFileContent} = pageData;
|
const citationFileContent = pageData.citationFileContent!;
|
||||||
const config = plugins.config.get('@bibtex');
|
const config = plugins.config.get('@bibtex');
|
||||||
config.constants.fieldTypes.doi = ['field', 'literal'];
|
config.constants.fieldTypes.doi = ['field', 'literal'];
|
||||||
config.constants.fieldTypes.version = ['field', 'literal'];
|
config.constants.fieldTypes.version = ['field', 'literal'];
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export async function submitFormFetchAction(formEl: HTMLFormElement, opts: Submi
|
|||||||
if (formMethod.toLowerCase() === 'get') {
|
if (formMethod.toLowerCase() === 'get') {
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
for (const [key, value] of formData) {
|
for (const [key, value] of formData) {
|
||||||
params.append(key, value.toString());
|
params.append(key, value as string);
|
||||||
}
|
}
|
||||||
const pos = reqUrl.indexOf('?');
|
const pos = reqUrl.indexOf('?');
|
||||||
if (pos !== -1) {
|
if (pos !== -1) {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import {setFileFolding} from './file-fold.ts';
|
|||||||
import {POST} from '../modules/fetch.ts';
|
import {POST} from '../modules/fetch.ts';
|
||||||
|
|
||||||
const {pageData} = window.config;
|
const {pageData} = window.config;
|
||||||
const prReview = pageData.prReview || {};
|
// it is undefined on most pages, fortunately, when it is accessed by the related functions, it exists
|
||||||
|
const prReview = pageData.prReview!;
|
||||||
const viewedStyleClass = 'viewed-file-checked-form';
|
const viewedStyleClass = 'viewed-file-checked-form';
|
||||||
const viewedCheckboxSelector = '.viewed-file-form'; // Selector under which all "Viewed" checkbox forms can be found
|
const viewedCheckboxSelector = '.viewed-file-form'; // Selector under which all "Viewed" checkbox forms can be found
|
||||||
const expandFilesBtnSelector = '#expand-files-btn';
|
const expandFilesBtnSelector = '#expand-files-btn';
|
||||||
@@ -13,11 +14,11 @@ const collapseFilesBtnSelector = '#collapse-files-btn';
|
|||||||
// The data used will be window.config.pageData.prReview.numberOf{Viewed}Files
|
// The data used will be window.config.pageData.prReview.numberOf{Viewed}Files
|
||||||
function refreshViewedFilesSummary() {
|
function refreshViewedFilesSummary() {
|
||||||
const viewedFilesProgress = document.querySelector('#viewed-files-summary')!;
|
const viewedFilesProgress = document.querySelector('#viewed-files-summary')!;
|
||||||
viewedFilesProgress.setAttribute('value', prReview.numberOfViewedFiles);
|
viewedFilesProgress.setAttribute('value', String(prReview.numberOfViewedFiles));
|
||||||
const summaryLabel = document.querySelector<HTMLElement>('#viewed-files-summary-label')!;
|
const summaryLabel = document.querySelector<HTMLElement>('#viewed-files-summary-label')!;
|
||||||
summaryLabel.textContent = summaryLabel.getAttribute('data-text-changed-template')!
|
summaryLabel.textContent = summaryLabel.getAttribute('data-text-changed-template')!
|
||||||
.replace('%[1]d', prReview.numberOfViewedFiles)
|
.replace('%[1]d', String(prReview.numberOfViewedFiles))
|
||||||
.replace('%[2]d', prReview.numberOfFiles);
|
.replace('%[2]d', String(prReview.numberOfFiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes a listener for all children of the given html element
|
// Initializes a listener for all children of the given html element
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export function initRepositorySearch() {
|
|||||||
|
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
for (const [key, value] of new FormData(repositorySearchForm).entries()) {
|
for (const [key, value] of new FormData(repositorySearchForm).entries()) {
|
||||||
params.set(key, value.toString());
|
params.set(key, value as string);
|
||||||
}
|
}
|
||||||
if ((e.target as HTMLInputElement).name === 'clear-filter') {
|
if ((e.target as HTMLInputElement).name === 'clear-filter') {
|
||||||
params.delete('archived');
|
params.delete('archived');
|
||||||
|
|||||||
26
web_src/js/globals.d.ts
vendored
26
web_src/js/globals.d.ts
vendored
@@ -26,8 +26,30 @@ interface Window {
|
|||||||
assetUrlPrefix: string,
|
assetUrlPrefix: string,
|
||||||
runModeIsProd: boolean,
|
runModeIsProd: boolean,
|
||||||
customEmojis: Record<string, string>,
|
customEmojis: Record<string, string>,
|
||||||
pageData: Record<string, any>,
|
pageData: Record<string, any> & {
|
||||||
notificationSettings: Record<string, any>,
|
adminUserListSearchForm?: {
|
||||||
|
SortType: string,
|
||||||
|
StatusFilterMap: Record<string, string>,
|
||||||
|
},
|
||||||
|
citationFileContent?: string,
|
||||||
|
prReview?: {
|
||||||
|
numberOfFiles: number,
|
||||||
|
numberOfViewedFiles: number,
|
||||||
|
},
|
||||||
|
DiffFileTree?: import('./modules/diff-file.ts').DiffFileTreeData,
|
||||||
|
FolderIcon?: string,
|
||||||
|
FolderOpenIcon?: string,
|
||||||
|
repoLink?: string,
|
||||||
|
repoActivityTopAuthors?: any[],
|
||||||
|
pullRequestMergeForm?: Record<string, any>,
|
||||||
|
dashboardRepoList?: Record<string, any>,
|
||||||
|
},
|
||||||
|
notificationSettings: {
|
||||||
|
MinTimeout: number,
|
||||||
|
TimeoutStep: number,
|
||||||
|
MaxTimeout: number,
|
||||||
|
EventSourceUpdateTime: number,
|
||||||
|
},
|
||||||
enableTimeTracking: boolean,
|
enableTimeTracking: boolean,
|
||||||
mermaidMaxSourceCharacters: number,
|
mermaidMaxSourceCharacters: number,
|
||||||
i18n: Record<string, string>,
|
i18n: Record<string, string>,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export type DiffTreeEntry = {
|
|||||||
ParentEntry?: DiffTreeEntry,
|
ParentEntry?: DiffTreeEntry,
|
||||||
};
|
};
|
||||||
|
|
||||||
type DiffFileTreeData = {
|
export type DiffFileTreeData = {
|
||||||
TreeRoot: DiffTreeEntry,
|
TreeRoot: DiffTreeEntry,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ type DiffFileTree = {
|
|||||||
let diffTreeStoreReactive: Reactive<DiffFileTree>;
|
let diffTreeStoreReactive: Reactive<DiffFileTree>;
|
||||||
export function diffTreeStore() {
|
export function diffTreeStore() {
|
||||||
if (!diffTreeStoreReactive) {
|
if (!diffTreeStoreReactive) {
|
||||||
diffTreeStoreReactive = reactiveDiffTreeStore(pageData.DiffFileTree, pageData.FolderIcon, pageData.FolderOpenIcon);
|
diffTreeStoreReactive = reactiveDiffTreeStore(pageData.DiffFileTree!, pageData.FolderIcon!, pageData.FolderOpenIcon!);
|
||||||
}
|
}
|
||||||
return diffTreeStoreReactive;
|
return diffTreeStoreReactive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ export function blobToDataURI(blob: Blob): Promise<string> {
|
|||||||
reject(new Error('blobToDataURI: FileReader error'));
|
reject(new Error('blobToDataURI: FileReader error'));
|
||||||
});
|
});
|
||||||
reader.readAsDataURL(blob);
|
reader.readAsDataURL(blob);
|
||||||
} catch (err) {
|
} catch (err: unknown) {
|
||||||
reject(err);
|
reject(err instanceof Error ? err : new Error(String(err)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -135,16 +135,16 @@ export function convertImage(blob: Blob, mime: string): Promise<Blob> {
|
|||||||
if (!(blob instanceof Blob)) return reject(new Error('convertImage: toBlob failed'));
|
if (!(blob instanceof Blob)) return reject(new Error('convertImage: toBlob failed'));
|
||||||
resolve(blob);
|
resolve(blob);
|
||||||
}, mime);
|
}, mime);
|
||||||
} catch (err) {
|
} catch (err: unknown) {
|
||||||
reject(err);
|
reject(err instanceof Error ? err : new Error(String(err)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
img.addEventListener('error', () => {
|
img.addEventListener('error', () => {
|
||||||
reject(new Error('convertImage: image failed to load'));
|
reject(new Error('convertImage: image failed to load'));
|
||||||
});
|
});
|
||||||
img.src = await blobToDataURI(blob);
|
img.src = await blobToDataURI(blob);
|
||||||
} catch (err) {
|
} catch (err: unknown) {
|
||||||
reject(err);
|
reject(err instanceof Error ? err : new Error(String(err)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ window.config = {
|
|||||||
runModeIsProd: true,
|
runModeIsProd: true,
|
||||||
customEmojis: {},
|
customEmojis: {},
|
||||||
pageData: {},
|
pageData: {},
|
||||||
notificationSettings: {},
|
notificationSettings: {MinTimeout: 0, TimeoutStep: 0, MaxTimeout: 0, EventSourceUpdateTime: 0},
|
||||||
enableTimeTracking: true,
|
enableTimeTracking: true,
|
||||||
mermaidMaxSourceCharacters: 5000,
|
mermaidMaxSourceCharacters: 5000,
|
||||||
i18n: {},
|
i18n: {},
|
||||||
|
|||||||
Reference in New Issue
Block a user