workspace: update eslint rule (#1027)

This commit is contained in:
undefined authored and GitHub committed 2025-08-06 18:51:25 +01:00
1 parent 05c3b8f2bd
commit cee3c00ddb
150 files changed
+1069 -1043

No files matched your search

+4 -4
View File
@@ -24,10 +24,10 @@ export default new NamedPage(['contest_detail', 'contest_problemlist', 'contest_
addSpeculationRules({
prerender: [{
'where': {
'or': [
{ 'href_matches': '/p/*' },
{ 'href_matches': '/d/*/p/*' },
where: {
or: [
{ href_matches: '/p/*' },
{ href_matches: '/d/*/p/*' },
],
},
}],
@@ -37,7 +37,7 @@ function Balloon({ tdoc, val }) {
</td>
<td>
<HexColorInput
className='textbox'
className="textbox"
color={c}
onFocus={() => { setNow(pid); setColor(c); }}
onChange={(e) => { val[+pid].color = e; setColor(e); }}
@@ -194,15 +194,15 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
const ans = {};
const pids = [];
let cnt = 0;
const reg = /{{ (input|select|multiselect|textarea)\(\d+(-\d+)?\) }}/g;
const reg = /\{\{ (input|select|multiselect|textarea)\(\d+(-\d+)?\) \}\}/g;
$('.problem-content .typo').children().each((i, e) => {
if (e.tagName === 'PRE' && !e.children[0].className.includes('#input')) return;
const questions = [];
let q;
while (q = reg.exec(e.innerText)) questions.push(q); // eslint-disable-line no-cond-assign
while (q = reg.exec(e.textContent)) questions.push(q); // eslint-disable-line no-cond-assign
for (const [info, type] of questions) {
cnt++;
const id = info.replace(/{{ (input|select|multiselect|textarea)\((\d+(-\d+)?)\) }}/, '$2');
const id = info.replace(/\{\{ (input|select|multiselect|textarea)\((\d+(-\d+)?)\) \}\}/, '$2');
pids.push(id);
if (type === 'input') {
$(e).html($(e).html().replace(info, tpl`
@@ -37,7 +37,7 @@ async function updateSelection() {
}
}
const requestCategoryTags = _.uniq(selections
.filter((s) => s.indexOf(',') !== -1)
.filter((s) => s.includes(','))
.map((s) => s.split(',')[0]));
// drop the category if its subcategory is selected
const requestTags = _.uniq(_.pullAll(selections, requestCategoryTags));
@@ -267,7 +267,7 @@ export default new NamedPage(['problem_create', 'problem_edit'], () => {
val = JSON.parse(val);
if (!(val instanceof Array)) val = JSON.stringify(val);
} catch { }
const empty = /^\s*$/g.test(val);
const empty = /^\s*$/.test(val);
if (empty) delete content[activeTab];
else content[activeTab] = val;
if (!Object.keys(content).length) $field.text('');
@@ -175,14 +175,21 @@ const page = new NamedPage('problem_files', () => {
style={{ ...style, ...(highlight ? { color: 'transparent', background: 'transparent', caretColor: 'black' } : {}) }}
value={original}
onChange={(e) => setOriginal(e.currentTarget.value)}
></input>
/>
</div>
<div className="textbox-container" style={{
position: 'absolute', top: 0, left: 0, zIndex: 0,
}}>
{highlight && <span className="textbox" style={{
...style, border: 'none', display: 'inline-flex', alignItems: 'center',
}} dangerouslySetInnerHTML={{ __html: highlight }} />}
<div
className="textbox-container"
style={{
position: 'absolute', top: 0, left: 0, zIndex: 0,
}}
>
{highlight && <span
className="textbox"
style={{
...style, border: 'none', display: 'inline-flex', alignItems: 'center',
}}
dangerouslySetInnerHTML={{ __html: highlight }}
/>}
</div>
</div>
</label>
@@ -237,7 +244,7 @@ const page = new NamedPage('problem_files', () => {
</tbody>
</table>
</div>}
</div >;
</div>;
}
const promise = new ActionDialog({
@@ -456,19 +456,20 @@ const page = new NamedPage(['problem_main'], () => {
const selection = document.getElementById('problem_selection');
if (selection) {
ReactDOM.createRoot(selection)
.render(<ProblemSelectionDisplay
ReactDOM.createRoot(selection).render(
<ProblemSelectionDisplay
onChange={(pids) => { selectedPids = pids; }}
onClear={(handler) => { clearSelectionHandler = handler; }}
/>);
/>,
);
}
addSpeculationRules({
prerender: [{
'where': {
'or': [
{ 'href_matches': '/p/*' },
{ 'href_matches': '/d/*/p/*' },
where: {
or: [
{ href_matches: '/p/*' },
{ href_matches: '/d/*/p/*' },
],
},
}],
@@ -49,7 +49,8 @@ const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', '
root.render(<blockquote className="note">
<p>{i18n('This page is only for pasting code from other sources.')}</p>
<p>{i18n("To get a better editing experience, with code highlighting and test runs, \
please go back to the problem detail page and use 'Open Scratchpad' button.")}</p>
please go back to the problem detail page and use 'Open Scratchpad' button.")}
</p>
<a onClick={() => root.unmount()}>{i18n('Dismiss')}</a> / <a onClick={ignore}>{i18n("Don't show again")}</a>
</blockquote>);
});
+2 -1
View File
@@ -57,7 +57,8 @@ const page = new NamedPage('manage_config', async () => {
.omnibar-toggle {
display: none;
}
`}</style>
`}
</style>
</ComponentsProvider>,
);
});