mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
workspace: add eslint-config package (#510)
This commit is contained in:
1 parent
e7945a104f
commit
65311529bd
28 files changed
+230
-267
No files matched your search
@@ -122,7 +122,7 @@ const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, re
|
||||
setCurrentItem(null);
|
||||
return;
|
||||
}
|
||||
if (!queryCache[query]) queryCache[query] = await queryItems(query);
|
||||
queryCache[query] ||= await queryItems(query);
|
||||
for (const item of queryCache[query]) valueCache[itemKey(item)] = item;
|
||||
setItemList(queryCache[query]);
|
||||
setCurrentItem((!freeSolo && queryCache[query].length > 0) ? 0 : null);
|
||||
|
||||
@@ -349,7 +349,7 @@ export default class Calendar {
|
||||
};
|
||||
banner.endAt = banner.event.maskFrom.clone().subtract(1, 'day');
|
||||
banner.endSnap = true;
|
||||
bannerSpans[i].span -= newBannerSpan.span; // eslint-disable-line no-param-reassign
|
||||
bannerSpans[i].span -= newBannerSpan.span;
|
||||
bannerSpans.splice(i + 1, 0, newBannerSpan);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ function Reaction({ payload, ele }) {
|
||||
const [finish, updateFinish] = React.useState(false);
|
||||
if (finish) setTimeout(() => updateFinish(false), 1000);
|
||||
return (
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
<Popover usePortal interactionKind="hover" isOpen={finish ? false : (focus ? true : undefined)}>
|
||||
<span className="icon icon-emoji"></span>
|
||||
<div>
|
||||
|
||||
@@ -26,7 +26,6 @@ export const config = {
|
||||
inlineDigit: true,
|
||||
},
|
||||
theme: {
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
path: `${UiContext.cdn_prefix}vditor/dist/css/content-theme`,
|
||||
current: 'light',
|
||||
},
|
||||
@@ -81,7 +80,6 @@ export default class Editor extends DOMAttachedObject {
|
||||
$dom.hide();
|
||||
origin.parentElement.appendChild(ele);
|
||||
const value = this.options.value || $dom.val();
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
this.model = typeof model === 'string'
|
||||
? monaco.editor.getModel(monaco.Uri.parse(model))
|
||||
|| monaco.editor.createModel(value, language === 'auto' ? undefined : language, monaco.Uri.parse(model))
|
||||
|
||||
@@ -31,7 +31,6 @@ loadLanguages();
|
||||
languageMeta.forEach((meta) => {
|
||||
for (let i = 0; i < meta.ext.length; ++i) {
|
||||
if (Prism.languages[meta.ext[i]] !== undefined) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
meta.target = meta.ext[i];
|
||||
break;
|
||||
}
|
||||
@@ -44,7 +43,7 @@ languageMeta.forEach((meta) => {
|
||||
// Copy to Clipboard
|
||||
Prism.plugins.toolbar.registerButton('copy-to-clipboard', (env) => {
|
||||
const linkCopy = document.createElement('a');
|
||||
linkCopy.href = 'javascript:;'; // eslint-disable-line no-script-url
|
||||
linkCopy.href = 'javascript:;';
|
||||
linkCopy.textContent = 'Copy';
|
||||
const clip = new Clipboard(linkCopy, { text: () => env.code });
|
||||
clip.on('success', () => {
|
||||
@@ -89,8 +88,8 @@ function handlerInvisiblesToken(tokens, name) {
|
||||
} else if (type === 'Array') {
|
||||
for (let i = 0, l = value.length; i < l; i++) handlerInvisiblesToken(value, i);
|
||||
} else {
|
||||
const inside = value.inside || (value.inside = {});
|
||||
addInvisibles(inside);
|
||||
value.inside ||= {};
|
||||
addInvisibles(value.inside);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export default connect(mapStateToProps)(class MessagePadDialogueContentContainer
|
||||
const data = JSON.parse(msg.content);
|
||||
const str = i18n(data.message).replace(/\{([^{}]+)\}/g, (match, key) => `%placeholder%${key}%placeholder%`);
|
||||
const arr = str.split('%placeholder%');
|
||||
data.params = data.params || {};
|
||||
data.params ||= {};
|
||||
for (let i = 1; i < arr.length; i += 2) {
|
||||
if (arr[i].endsWith(':link')) {
|
||||
const link = data.params[arr[i].split(':link')[0]];
|
||||
|
||||
@@ -16,7 +16,7 @@ function format(message, args) {
|
||||
|
||||
export const getConfiguredDefaultLocale = () => 'zh';
|
||||
|
||||
let CURRENT_LOCALE_DATA = {};
|
||||
let CURRENT_LOCALE_DATA = {}; // eslint-disable-line @typescript-eslint/naming-convention
|
||||
|
||||
function find(path, message) {
|
||||
for (const key of Object.keys(CURRENT_LOCALE_DATA)) {
|
||||
|
||||
@@ -120,7 +120,7 @@ export async function previewFile(ev?, type = '') {
|
||||
if (ev) {
|
||||
const link = $(ev.currentTarget).find('a').attr('href');
|
||||
if (!link) return null;
|
||||
if (!type) type = ev.currentTarget.getAttribute('data-preview');
|
||||
type ||= ev.currentTarget.getAttribute('data-preview');
|
||||
const ext = filename.split('.').pop();
|
||||
if (['zip', 'rar', '7z'].includes(ext) || filesize > 8 * 1024 * 1024) {
|
||||
const action = await new ActionDialog({
|
||||
|
||||
@@ -34,7 +34,7 @@ const votePage = new AutoloadPage('votePage', () => {
|
||||
setVoteState($container, data.vote, data.user_vote);
|
||||
})
|
||||
.catch((e) => {
|
||||
Notification.error(`Failed to vote: ${ e.message}`);
|
||||
Notification.error(`Failed to vote: ${e.message}`);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user