chore: enable unicorn/better-dom-traversing, drop obsolete type stub

- Enable `unicorn/better-dom-traversing` and switch the flagged
  `.children[0]` / `.childNodes[0]` accesses to `.firstElementChild` /
  `.firstChild`.
- Remove the obsolete `eslint-plugin-no-use-extend-native` type stub; it is
  no longer a dependency.
- Drop misleading comments on `no-thenable` (enabled here, not disabled) and
  `try-complexity`.

Assisted-by: claude-code:opus-4.8
This commit is contained in:
silverwind
2026-06-09 12:14:13 +02:00
parent 76726bbfe4
commit c1e928ca96
4 changed files with 6 additions and 12 deletions
+3 -3
View File
@@ -723,7 +723,7 @@ export default defineConfig([
'strict': [0],
'symbol-description': [2],
'unicode-bom': [2, 'never'],
'unicorn/better-dom-traversing': [0], // false-positives on non-DOM `.children` access
'unicorn/better-dom-traversing': [2],
'unicorn/catch-error-name': [0],
'unicorn/consistent-assert': [0],
'unicorn/consistent-compound-words': [0], // too opinionated
@@ -790,7 +790,7 @@ export default defineConfig([
'unicorn/no-process-exit': [0],
'unicorn/no-single-promise-in-promise-methods': [2],
'unicorn/no-static-only-class': [2],
'unicorn/no-thenable': [2], // false-positives on json schemas
'unicorn/no-thenable': [2],
'unicorn/no-this-assignment': [2],
'unicorn/no-this-outside-of-class': [0], // false-positives on `this` in standalone functions
'unicorn/no-typeof-undefined': [2],
@@ -898,7 +898,7 @@ export default defineConfig([
'unicorn/template-indent': [2],
'unicorn/text-encoding-identifier-case': [0],
'unicorn/throw-new-error': [2],
'unicorn/try-complexity': [0], // overly strict at its default max complexity of 1
'unicorn/try-complexity': [0],
'use-isnan': [2],
'valid-typeof': [2, {requireStringLiterals: true}],
'vars-on-top': [0],
Vendored
-6
View File
@@ -1,9 +1,3 @@
declare module 'eslint-plugin-no-use-extend-native' {
import type {Eslint} from 'eslint';
const plugin: Eslint.Plugin;
export = plugin;
}
declare module 'eslint-plugin-array-func' {
import type {Eslint} from 'eslint';
const plugin: Eslint.Plugin;
+2 -2
View File
@@ -86,8 +86,8 @@ function prepareProcessors(ctx:ProcessorContext): Processors {
function processElement(ctx :ProcessorContext, processors: Processors, el: HTMLElement): string | void {
if (el.hasAttribute('data-markdown-generated-content')) return el.textContent;
if (el.tagName === 'A' && el.children.length === 1 && el.children[0].tagName === 'IMG') {
return processElement(ctx, processors, el.children[0] as HTMLElement);
if (el.tagName === 'A' && el.children.length === 1 && el.firstElementChild!.tagName === 'IMG') {
return processElement(ctx, processors, el.firstElementChild as HTMLElement);
}
const isListContainer = el.tagName === 'OL' || el.tagName === 'UL';
+1 -1
View File
@@ -24,7 +24,7 @@ export function showGlobalErrorMessage(msg: string, msgType: Intent = 'error', d
if (!msgContainer) {
const el = document.createElement('div');
el.innerHTML = html`<div class="ui container js-global-error tw-my-[--page-spacing]"><details class="ui ${msgType} message"><summary></summary></details></div>`;
msgContainer = el.childNodes[0] as HTMLDivElement;
msgContainer = el.firstChild as HTMLDivElement;
}
// merge duplicated messages into "the message (count)" format