From eb66d54cab6091f95e8f078e3961484f2cc87a54 Mon Sep 17 00:00:00 2001 From: Bart Veneman Date: Mon, 10 Nov 2025 22:28:47 +0100 Subject: [PATCH 1/2] chore: use @projectwallace/preset-oxlint --- .oxlintrc.json | 53 ++----------------------------- package-lock.json | 12 +++++++ package.json | 1 + src/cli/reporters/pretty.test.ts | 4 +-- src/cli/reporters/tap.ts | 2 +- src/lib/html-parser.ts | 2 +- src/lib/prettify.test.ts | 3 +- src/lib/test/kitchen-sink.test.ts | 2 +- 8 files changed, 21 insertions(+), 58 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index f92b8c3..392a237 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,56 +1,9 @@ { "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": [ - "import", - "typescript", - "oxc", - "unicorn" - ], + "extends": ["@projectwallace/preset-oxlint"], "env": { "node": true, - "browser": true, - "es2024": true + "browser": true }, - "categories": { - "perf": "error", - "correctness": "error", - "pedantic": "error" - }, - "rules": { - "unicorn/no-null": "error", - "unicorn/prefer-set-has": "off", - "prefer-string-slice": "off", - "prefer-code-point": "off", - "no-lonely-if": "off", - "no-unused-vars": "off", - "no-await-in-loop": "off", - "prefer-query-selector": "off", - "max-dependencies": "off", - "ban-types": "off", - "no-undefined": "off", - "no-useless-undefined": "off", - "max-classes-per-file": "off", - "max-lines-per-function": "off", - "prefer-math-trunc": "off", - "max-lines": "off", - "max-depth": [ - "warn", - { - "max": 5 - } - ], - "explicit-function-return-type": "off", - "no-console": "off", - "no-optional-chaining": "off", - "no-commonjs": "off", - "unambiguous": "off", - "no-default-export": "off", - "no-async-await": "off", - "no-non-null-assertion": "off", - "no-plusplus": "off", - "no-bitwise": "off", - "default-case": "off", - "no-rest-spread-properties": "off", - "require-await": "warn" - } + "rules": {} } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 24efc3a..202b5ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "devDependencies": { "@codecov/vite-plugin": "^1.9.1", "@playwright/test": "^1.56.0", + "@projectwallace/preset-oxlint": "^0.0.6", "@types/node": "^24.9.2", "c8": "^10.1.3", "knip": "^5.66.4", @@ -1414,6 +1415,16 @@ "node": ">=18.0.0" } }, + "node_modules/@projectwallace/preset-oxlint": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@projectwallace/preset-oxlint/-/preset-oxlint-0.0.6.tgz", + "integrity": "sha512-DFcKZano3DymmGNSFDZKlFc9LGvgEwYBOBdsTfEiGLVUqD+/duSSsIS1KAkhyktta8mv3OcyWaiaQUxSUf9mSA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "oxlint": "^1.0.0" + } + }, "node_modules/@publint/pack": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/@publint/pack/-/pack-0.1.2.tgz", @@ -3145,6 +3156,7 @@ "integrity": "sha512-O6iJ9xeuy9eQCi8/EghvsNO6lzSaUPs0FR1uLy51Exp3RkVpjvJKyPPhd9qv65KLnfG/BNd2HE/rH0NbEfVVzA==", "dev": true, "license": "MIT", + "peer": true, "bin": { "oxc_language_server": "bin/oxc_language_server", "oxlint": "bin/oxlint" diff --git a/package.json b/package.json index 9663356..b08dbb8 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "devDependencies": { "@codecov/vite-plugin": "^1.9.1", "@playwright/test": "^1.56.0", + "@projectwallace/preset-oxlint": "^0.0.6", "@types/node": "^24.9.2", "c8": "^10.1.3", "knip": "^5.66.4", diff --git a/src/cli/reporters/pretty.test.ts b/src/cli/reporters/pretty.test.ts index 0d6c8bd..72bd713 100644 --- a/src/cli/reporters/pretty.test.ts +++ b/src/cli/reporters/pretty.test.ts @@ -1,9 +1,8 @@ import { test, expect } from '@playwright/test' -import { print_lines as print, PrintLinesDependencies, type StyleTextFn, TextStyle } from './pretty' +import { print_lines as print, PrintLinesDependencies, TextStyle } from './pretty' import { Report } from '../program' import { CoverageResult } from '../../lib' import { CliArguments } from '../arguments' -import { PrettifiedChunk } from '../../lib/prettify' // test matrix // ------------------------------ @@ -59,7 +58,6 @@ const min_file_line_coverage_failure = { } const show_none = { 'show-uncovered': 'none' } as CliArguments -const show_all = { 'show-uncovered': 'all' } as CliArguments const show_violations = { 'show-uncovered': 'violations' } as CliArguments const context_empty = { diff --git a/src/cli/reporters/tap.ts b/src/cli/reporters/tap.ts index 173a1c1..0f68aa9 100644 --- a/src/cli/reporters/tap.ts +++ b/src/cli/reporters/tap.ts @@ -25,7 +25,7 @@ function meta(data: Record) { console.log(' ...') } -export function print({ report, context }: Report, params: CliArguments): void { +export function print({ report, context }: Report, _params: CliArguments): void { let total_files = context.coverage.coverage_per_stylesheet.length let total_checks = total_files + 1 let checks_added = 1 diff --git a/src/lib/html-parser.ts b/src/lib/html-parser.ts index 68580db..26ba3a5 100644 --- a/src/lib/html-parser.ts +++ b/src/lib/html-parser.ts @@ -28,7 +28,7 @@ export class DOMParser { pos = close + ''.length } return { - querySelectorAll(selector: 'style') { + querySelectorAll(_selector: 'style') { return styles }, } diff --git a/src/lib/prettify.test.ts b/src/lib/prettify.test.ts index 1d58963..b2b385e 100644 --- a/src/lib/prettify.test.ts +++ b/src/lib/prettify.test.ts @@ -1,5 +1,4 @@ -import { test, expect } from '@playwright/test' -import { prettify } from './prettify' +import { test } from '@playwright/test' test.skip('simple range at start', () => {}) test.skip('simple range at middle', () => {}) diff --git a/src/lib/test/kitchen-sink.test.ts b/src/lib/test/kitchen-sink.test.ts index 5c3740c..31ce5e5 100644 --- a/src/lib/test/kitchen-sink.test.ts +++ b/src/lib/test/kitchen-sink.test.ts @@ -1,5 +1,5 @@ import { test, expect } from '@playwright/test' -import { calculate_coverage, parse_coverage, type Coverage, type CoverageResult } from '../index.js' +import { calculate_coverage, parse_coverage, type Coverage } from '../index.js' import { generate_coverage } from './generate-coverage.js' import { format } from '@projectwallace/format-css' import * as fs from 'node:fs/promises' From e5637da44df240326616c67516e20d75d6e7aa94 Mon Sep 17 00:00:00 2001 From: Bart Veneman Date: Mon, 10 Nov 2025 22:33:54 +0100 Subject: [PATCH 2/2] knip --- knip.config.ts | 1 + src/cli/reporters/pretty.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/knip.config.ts b/knip.config.ts index cd84e35..bd6a1ab 100644 --- a/knip.config.ts +++ b/knip.config.ts @@ -3,6 +3,7 @@ import type { KnipConfig } from 'knip' const config: KnipConfig = { entry: ['src/lib/index.ts', 'src/cli/cli.ts'], project: ['src/**/*.ts'], + ignoreDependencies: ['@projectwallace/preset-oxlint'], } export default config diff --git a/src/cli/reporters/pretty.ts b/src/cli/reporters/pretty.ts index 6147216..345bace 100644 --- a/src/cli/reporters/pretty.ts +++ b/src/cli/reporters/pretty.ts @@ -16,7 +16,7 @@ function percentage(ratio: number, decimals: number = 2): string { export type TextStyle = 'bold' | 'red' | 'dim' | 'green' -export type StyleTextFn = (style: TextStyle | TextStyle[], input: string) => string +type StyleTextFn = (style: TextStyle | TextStyle[], input: string) => string export type PrintLinesDependencies = { styleText: StyleTextFn