Skip to content

Commit 839eb98

Browse files
committed
chore: fix lint
1 parent c72ecbf commit 839eb98

File tree

20 files changed

+196
-794
lines changed

20 files changed

+196
-794
lines changed

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ export default antfu({
1616
'vue/no-template-shadow',
1717
'pnpm/json-prefer-workspace-settings',
1818
'markdown/fenced-code-language',
19+
'e18e/prefer-static-regex',
20+
'e18e/prefer-spread-syntax',
1921
)

packages/core/src/client/webcomponents/components/ViewIframe.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function navigateTo(url: string) {
8787
8888
// Ensure URL has protocol
8989
let normalizedUrl = url.trim()
90-
if (normalizedUrl && !normalizedUrl.match(/^https?:\/\//i)) {
90+
if (normalizedUrl && !/^https?:\/\//i.test(normalizedUrl)) {
9191
// If it starts with /, treat as same-origin path
9292
if (normalizedUrl.startsWith('/')) {
9393
normalizedUrl = `${window.location.origin}${normalizedUrl}`

packages/rolldown/src/app/components/chunks/Graph.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ createModuleGraph<ChunkInfo, ChunkImport>({
132132
133133
const _additionalLinks = chunks.value.flatMap(chunk =>
134134
chunk.imports
135-
.filter(_import => !_links.find(x => x.id === `${chunk.chunk_id}|${_import.chunk_id}`))
135+
.filter(_import => !_links.some(x => x.id === `${chunk.chunk_id}|${_import.chunk_id}`))
136136
.map(_import => ({
137137
source: nodesMap.get(`${chunk.chunk_id}`)!,
138138
target: nodesMap.get(`${_import.chunk_id}`)!,

packages/rolldown/src/app/components/data/ChunkDetails.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function getModuleSize(modules: string[]) {
3030
return total
3131
3232
const transforms = moduleInfo.buildMetrics.transforms
33-
return total + transforms[transforms.length - 1]!.transformed_code_size
33+
return total + transforms.at(-1)!.transformed_code_size
3434
}, 0)
3535
}
3636

packages/rolldown/src/app/components/data/PluginDetailsTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const { state: durationSortType, next } = useCycleList(['', 'desc', 'asc'], {
4242
})
4343
const filtered = computed(() => {
4444
const sorted = durationSortType.value
45-
? [...props.buildMetrics.calls].sort((a, b) => {
45+
? props.buildMetrics.calls.toSorted((a, b) => {
4646
if (durationSortType.value === 'asc') {
4747
return a.duration - b.duration
4848
}

packages/rolldown/src/app/components/display/FileSizeBadge.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const color = computed(() => {
3939
if (bytes < limit)
4040
return color
4141
}
42-
return colorScale[colorScale.length - 1]?.[1]
42+
return colorScale.at(-1)?.[1]
4343
})
4444
4545
const ratio = computed(() => props.total ? (props.bytes || 0) * 100 / props.total : 0)

packages/rolldown/src/app/components/display/HighlightedPath.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ export default defineComponent({
3333
type = 'query'
3434

3535
if (type === 'path') {
36-
if (part.match(/^\.+$/)) {
36+
if (/^\.+$/.test(part)) {
3737
classes[index]?.push('op50')
3838
}
3939
else if (part === '/') {
4040
classes[index]?.push('op50')
4141
}
42-
else if (part === 'node_modules' || part === 'dist' || part === 'lib' || part.match(/^\.\w/)) {
42+
else if (part === 'node_modules' || part === 'dist' || part === 'lib' || /^\.\w/.test(part)) {
4343
classes[index]?.push('op60')
4444
}
4545

packages/rolldown/src/app/components/display/ModuleId.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const relativePath = computed(() => {
3939
relate = `./${relate}`
4040
if (relate.startsWith('./'))
4141
return relate
42-
if (relate.match(/^(?:\.\.\/){1,3}[^.]/))
42+
if (/^(?:\.\.\/){1,3}[^.]/.test(relate))
4343
return relate
4444
return id
4545
})

packages/rolldown/src/app/components/flowmap/PluginFlowTimeline.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const endTime = computed(() => {
4545
if (!calls?.length) {
4646
return
4747
}
48-
return calls[calls.length - 1]!.timestamp_end
48+
return calls.at(-1)!.timestamp_end
4949
})
5050
</script>
5151

packages/rolldown/src/app/components/modules/BuildMetrics.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const sourceCodeSize = computed(() => {
3838
3939
const transformedCodeSize = computed(() => {
4040
const data = props.metrics?.transforms.filter(t => t.transformed_code_size)
41-
return data?.[data.length - 1]?.transformed_code_size
41+
return data.at(-1)?.transformed_code_size
4242
})
4343
</script>
4444

0 commit comments

Comments
 (0)