mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ci: lint for ui
This commit is contained in:
1 parent
c2db7d7797
commit
8bb072a5a4
11 files changed
+43
-61
No files matched your search
@@ -35,7 +35,9 @@ jobs:
|
||||
yarn build
|
||||
yarn build:ui:production
|
||||
- name: Lint
|
||||
run: yarn lint:ci
|
||||
run: |
|
||||
yarn lint:ci
|
||||
yarn lint:ui:ci
|
||||
- name: Publish
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
run: node build/publish.js
|
||||
|
||||
@@ -41,6 +41,7 @@ packages/**/*.js
|
||||
packages/ui-default/public
|
||||
packages/ui-default/misc/.iconfont
|
||||
packages/ui-default/static/locale
|
||||
plugins/**
|
||||
|
||||
# Data files
|
||||
*.mmdb
|
||||
|
||||
+9
-11
@@ -2,7 +2,8 @@
|
||||
"name": "hydro-workspace",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
"packages/*",
|
||||
"plugins/*"
|
||||
],
|
||||
"main": "package.json",
|
||||
"scripts": {
|
||||
@@ -13,22 +14,20 @@
|
||||
"build:ui:production": "node packages/ui-default/build --production",
|
||||
"lint": "eslint packages --ext ts --fix",
|
||||
"lint:ci": "eslint packages --ext ts",
|
||||
"lint:ui": "yarn run --cwd=packages/ui-default eslint . --fix",
|
||||
"lint:ui:ci": "yarn run --cwd=packages/ui-default eslint .",
|
||||
"pub": "node build/publish",
|
||||
"lint:ui": "yarn workspace @hydrooj/ui-default eslint --ext .js,.ts,.jsx,.tsx . --fix",
|
||||
"lint:ui:ci": "yarn workspace @hydrooj/ui-default eslint --ext .js,.ts,.jsx,.tsx .",
|
||||
"typedoc": "cross-env NODE_OPTIONS=--max_old_space_size=8192 typedoc",
|
||||
"debug:all": "node --trace-warnings --async-stack-traces --trace-deprecation build/start --debug --template",
|
||||
"debug": "node --trace-warnings --async-stack-traces --trace-deprecation node_modules/hydrooj/bin/hydrooj --debug --template",
|
||||
"start:all": "node build/start",
|
||||
"start": "node_modules/.bin/hydrooj",
|
||||
"postinstall": "node build/hack",
|
||||
"clean": "zsh -c \"rm -rf tsconfig.build.tsbuildinfo ./packages/*/tsconfig.tsbuildinfo ./.coverage\""
|
||||
"postinstall": "node build/hack && node build/prepare.js"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"license": "AGPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/node": "^16.11.25",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/semver": "^7.3.9",
|
||||
"@typescript-eslint/eslint-plugin": "5.12.0",
|
||||
"@typescript-eslint/parser": "5.12.0",
|
||||
@@ -36,19 +35,18 @@
|
||||
"cross-env": "^7.0.3",
|
||||
"cross-spawn": "^7.0.3",
|
||||
"esbuild": "0.14.3",
|
||||
"eslint": "^8.9.0",
|
||||
"eslint": "^8.10.0",
|
||||
"eslint-config-airbnb-typescript": "12.3.1",
|
||||
"eslint-import-resolver-typescript": "2.5.0",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-simple-import-sort": "7.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"fs-extra": "^10.0.1",
|
||||
"globby": "11.1.0",
|
||||
"latest-version": "^6.0.0",
|
||||
"mongodb": "^3.7.3",
|
||||
"nmls": "^3.0.1",
|
||||
"ora": "5.4.1",
|
||||
"semver": "^7.3.5",
|
||||
"typedoc": "^0.22.11",
|
||||
"typedoc": "^0.22.12",
|
||||
"typescript": "4.4.3"
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,7 @@ function extractVideoParameters(url) {
|
||||
return parameterMap;
|
||||
}
|
||||
function videoUrl(service, videoID, url, options) {
|
||||
switch (service) {
|
||||
case 'youtube': {
|
||||
if (service === 'youtube') {
|
||||
const parameters = extractVideoParameters(url);
|
||||
if (options.youtube.parameters) {
|
||||
Object.keys(options.youtube.parameters).forEach((key) => {
|
||||
@@ -75,20 +74,15 @@ function videoUrl(service, videoID, url, options) {
|
||||
if (parameterArray.length > 0) finalUrl += `?${parameterArray.join('&')}`;
|
||||
return finalUrl;
|
||||
}
|
||||
case 'vimeo':
|
||||
return `https://player.vimeo.com/video/${videoID}`;
|
||||
case 'vine':
|
||||
return `https://vine.co/v/${videoID}/embed/${options.vine.embed}`;
|
||||
case 'prezi':
|
||||
return `https://prezi.com/embed/${videoID
|
||||
}/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0&`
|
||||
if (service === 'vimeo') return `https://player.vimeo.com/video/${videoID}`;
|
||||
if (service === 'vine') return `https://vine.co/v/${videoID}/embed/${options.vine.embed}`;
|
||||
if (service === 'prezi') {
|
||||
return `https://prezi.com/embed/${videoID}/?bgcolor=ffffff&lock_to_path=0&autoplay=0&autohide_ctrls=0&`
|
||||
+ 'landing_data=bHVZZmNaNDBIWnNjdEVENDRhZDFNZGNIUE43MHdLNWpsdFJLb2ZHanI5N1lQVHkxSHFxazZ0UUNCRHloSXZROHh3PT0&'
|
||||
+ 'landing_sign=1kD6c0N6aYpMUS0wxnQjxzSqZlEB8qNFdxtdjYhwSuI';
|
||||
case 'osf':
|
||||
return `https://mfr.osf.io/render?url=https://osf.io/${videoID}/?action=download`;
|
||||
default:
|
||||
return videoID;
|
||||
}
|
||||
if (service === 'osf') return `https://mfr.osf.io/render?url=https://osf.io/${videoID}/?action=download`;
|
||||
return videoID;
|
||||
}
|
||||
|
||||
module.exports = function videoPlugin(md) {
|
||||
@@ -138,10 +132,10 @@ module.exports = function videoPlugin(md) {
|
||||
}
|
||||
if (options[service]?.width) {
|
||||
return `<div class="embed-responsive embed-responsive-16by9">
|
||||
<iframe class="embed-responsive-item ${service}-player" type="text/html" width="${options[service].width || 640
|
||||
}" height="${options[service].height || 390
|
||||
}" src="${options.url(service, videoID, tokens[idx].url, options)
|
||||
}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`;
|
||||
<iframe class="embed-responsive-item ${service}-player" type="text/html" width="${options[service].width || 640}"\
|
||||
height="${options[service].height || 390}"\
|
||||
src="${options.url(service, videoID, tokens[idx].url, options)}"
|
||||
frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`;
|
||||
}
|
||||
return `<div data-${service}>${escapeHtml(videoID)}</div>`;
|
||||
};
|
||||
|
||||
@@ -4,11 +4,11 @@ export default function reducer(state = {}, action) {
|
||||
switch (action.type) {
|
||||
case 'DIALOGUES_LOAD_DIALOGUES_FULFILLED': {
|
||||
const { messages } = action.payload;
|
||||
return {...state, ..._.keyBy(messages, 'udoc._id')};
|
||||
return { ...state, ..._.keyBy(messages, 'udoc._id') };
|
||||
}
|
||||
case 'DIALOGUES_CREATE': {
|
||||
const { user } = action.payload;
|
||||
if (state[user._id]) return state
|
||||
if (state[user._id]) return state;
|
||||
return {
|
||||
...state,
|
||||
[user._id]: {
|
||||
|
||||
@@ -40,10 +40,10 @@ export function setLocaleData(data) {
|
||||
CURRENT_LOCALE_DATA = data;
|
||||
}
|
||||
|
||||
export function loadMessageBundle(file) {
|
||||
export function loadMessageBundle() {
|
||||
return localize;
|
||||
}
|
||||
|
||||
export function config(opt) {
|
||||
export function config() {
|
||||
return loadMessageBundle;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default class DomComponent extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
this.refs.dom.appendChild(this.props.childDom);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
$(this.refs.dom).empty();
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
childDom,
|
||||
...rest
|
||||
} = this.props;
|
||||
return (
|
||||
<div {...rest} ref="dom"></div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DomComponent.propTypes = {
|
||||
childDom: PropTypes.instanceOf(HTMLElement).isRequired,
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import { omit } from 'lodash';
|
||||
|
||||
export default function DomComponent(props: React.HTMLAttributes<HTMLDivElement> & { childDom: HTMLElement }) {
|
||||
const ref = React.useRef<HTMLDivElement>();
|
||||
React.useEffect(() => {
|
||||
ref.current.appendChild(props.childDom);
|
||||
return () => {
|
||||
$(ref.current).empty();
|
||||
};
|
||||
});
|
||||
return <div {...omit(props, 'childDom')} ref={ref}></div>;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.33.2",
|
||||
"version": "4.33.3",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
@@ -254,7 +254,7 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
|
||||
window.onresize = function () {
|
||||
statusChart.resize();
|
||||
scoreChart.resize();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$(document).on('click', '[name="problem-sidebar__open-scratchpad"]', (ev) => {
|
||||
|
||||
Whitespace-only changes.
Reference in new issue
Block a user