Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 9 additions & 43 deletions oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,25 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"extends": ["./node_modules/@projectwallace/preset-oxlint/index.json"],
"options": {
"typeAware": true
},
"plugins": ["import", "typescript", "oxc", "unicorn"],
"env": {
"node": true,
"browser": true,
"es2024": true
},
"categories": {
"perf": "error",
"correctness": "error",
"pedantic": "error"
"browser": true
},
"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-unassigned-vars": "off",
"eslint/no-unassigned-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",
"curly": "error",
"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",
"no-warning-comments": "off",
"no-inline-comments": "off",
"prefer-at": "off",
"no-map-spread": "off",
"strict-boolean-expressions": "off",
"no-confusing-void-expression": "off",
"typescript/prefer-readonly-parameter-types": "off",
"require-unicode-regexp": "off",
"unicorn/prefer-number-coercion": "off"
},
"overrides": [
Expand All @@ -74,6 +34,12 @@
"rules": {
"unicorn/no-null": "off"
}
},
{
"files": ["**/*.spec.ts", "**/spec.ts"],
"rules": {
"vitest/no-conditional-in-test": "off"
}
}
]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
},
"devDependencies": {
"@playwright/test": "^1.62.0",
"@projectwallace/preset-oxlint": "^0.0.11",
"@projectwallace/stylelint-plugin": "catalog:",
"@sveltejs/adapter-netlify": "next",
"@sveltejs/enhanced-img": "^0.11.0",
Expand Down
48 changes: 30 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/lib/components/AstExplorer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
}

function find_node_at_cursor(start: number, end: number): CSSNode | undefined {
if (!ast) return
if (!ast) {
return
}
let found = undefined
walk(ast, (node) => {
if (node.start <= start && node.end >= end) {
Expand Down
12 changes: 9 additions & 3 deletions src/lib/components/CssTree.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@
let node_element: HTMLElement | undefined = undefined

function compare_nodes(a: Node, b: PlainCSSNode | undefined): boolean {
if (!b) return false
if (!b) {
return false
}
return a.start === b.start && a.end === b.end && a.type === b.type
}

function filter_properties(obj: Node): string[] {
return Object.keys(obj).filter((key) => {
if (IGNORED_KEYS.has(key)) return false
if (obj[key] === false) return false
if (IGNORED_KEYS.has(key)) {
return false
}
if (obj[key] === false) {
return false
}
return true
})
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/HighlightedTextarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
let textarea: HTMLTextAreaElement | undefined = undefined

function set_cursor_positions() {
if (!textarea || !on_cursor_move) return
if (!textarea || !on_cursor_move) {
return
}
on_cursor_move({ start: textarea.selectionStart, end: textarea.selectionEnd })
}
</script>
Expand Down
8 changes: 6 additions & 2 deletions src/lib/components/Nav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
let popover = $state<HTMLElement | undefined>(undefined)

onNavigate(({ shallow }) => {
if (shallow) return
if (shallow) {
return
}

hide_popover()
})
Expand Down Expand Up @@ -50,7 +52,9 @@
})

function on_resize() {
if (document.documentElement.dataset.theme === 'naked') return
if (document.documentElement.dataset.theme === 'naked') {
return
}
// The first node that doesn't have the same top position as the previous one
// is the first node that's wrapped on a new line
let first_top = nodes[0].getBoundingClientRect().top
Expand Down
12 changes: 9 additions & 3 deletions src/lib/components/NetworkPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@
}

let tr = target.closest('tr')
if (tr === null) return
if (tr === null) {
return
}

let index = tr.sectionRowIndex

Expand All @@ -110,10 +112,14 @@
}

let mapped_index = sorted[index]
if (mapped_index === undefined) return
if (mapped_index === undefined) {
return
}

let origin = css_state.origins.at(mapped_index)
if (origin === undefined) return
if (origin === undefined) {
return
}

if (event.metaKey || event.shiftKey || event.ctrlKey) {
if (origin.type === 'local-file') {
Expand Down
25 changes: 18 additions & 7 deletions src/lib/components/Pre.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,19 @@
}

function jump_to_next_uncovered() {
if (!coverage_chunks) return
if (!body) return
if (!coverage_chunks) {
return
}
if (!body) {
return
}

let current_scroll_offset = body?.scrollTop || 0

let next_uncovered_chunk = coverage_chunks.find((chunk) => {
if (chunk.is_covered) return false
if (chunk.is_covered) {
return false
}
let chunk_top = chunk.start_line * LINE_HEIGHT
return chunk_top > current_scroll_offset + SCROLL_MARGIN_LINES * LINE_HEIGHT
})
Expand All @@ -134,13 +140,19 @@
}

function jump_to_previous_uncovered() {
if (!coverage_chunks) return
if (!body) return
if (!coverage_chunks) {
return
}
if (!body) {
return
}

let current_scroll_offset = body?.scrollTop || 0

let previous_uncovered_chunk = coverage_chunks.findLast((chunk) => {
if (chunk.is_covered) return false
if (chunk.is_covered) {
return false
}

let chunk_top = chunk.start_line * LINE_HEIGHT

Expand Down Expand Up @@ -330,5 +342,4 @@
overflow-x: clip;
}
}

</style>
Loading
Loading