wc-mixin/oxlint.config.ts
Buddy 8865b49f4e Add examples page with a context manager
DSD, open/closed template, and light-DOM components that talk through
<main-context>: children register on… callbacks and share updates as events.
Served by Vite via npm run examples; examples/ is linted, formatted and
typechecked.
2026-11-10 09:59:09 -08:00

71 lines
2.6 KiB
TypeScript

import { defineConfig } from 'oxlint';
export default defineConfig({
plugins: ['typescript', 'unicorn', 'oxc', 'import', 'promise'],
categories: {
correctness: 'error',
suspicious: 'error',
pedantic: 'error',
perf: 'error',
restriction: 'error',
},
rules: {
// Guards for code compiled down to pre-ES2018/2020; this targets ESNext.
'oxc/no-optional-chaining': 'off',
'oxc/no-rest-spread-properties': 'off',
'oxc/no-async-await': 'off',
// `void promise;` is how `no-floating-promises` says to ignore one on purpose.
'eslint/no-void': ['error', { allowAsStatement: true }],
// `undefined` is a real prop value (`userId: number | undefined`).
'eslint/no-undefined': 'off',
// Members are public by default and private via `#`; `public` is noise.
'typescript/explicit-member-accessibility': 'off',
// DOM types can't be deeply readonly, so every `Element` parameter fails.
'typescript/prefer-readonly-parameter-types': 'off',
// `function foo()` over `const foo = () => ...`. Inline callbacks
// (`.map((x) => ...)`) and arrows that use `this` aren't affected.
'eslint/func-style': ['error', 'declaration'],
// The mixin's hooks are deliberately empty methods for subclasses to override.
'eslint/class-methods-use-this': [
'error',
{
exceptMethods: ['handleEvent', 'onConnect', 'onDisconnect', 'onPropChange'],
ignoreOverrideMethods: true,
},
],
},
overrides: [
{
files: ['test/**/*.ts'],
plugins: ['typescript', 'unicorn', 'oxc', 'import', 'promise', 'vitest'],
rules: {
// Tests import the source under test from `../src`.
'import/no-relative-parent-imports': 'off',
// `describe` callbacks are long, and each test of a class factory
// needs its own small class.
'eslint/max-lines-per-function': 'off',
'eslint/max-classes-per-file': 'off',
// Test files grow with coverage; splitting them by line count doesn't help.
'eslint/max-lines': 'off',
},
},
{
files: ['examples/**/*.ts'],
rules: {
// Examples import the library from `../src`, like the tests.
'import/no-relative-parent-imports': 'off',
// Importing a component module is how it gets registered.
'import/no-unassigned-import': 'off',
// `onPropChange` switches are exhaustive over prop names, which
// `switch-exhaustiveness-check` enforces; a `default` would hide a missed one.
'eslint/default-case': 'off',
},
},
],
env: {
builtin: true,
browser: true,
},
ignorePatterns: ['dist/'],
});