Skip to content

Commit 491cac1

Browse files
Bart Venemanbartveneman
authored andcommitted
add oxlint, closes #12
1 parent 24bcd2f commit 491cac1

File tree

6 files changed

+234
-21
lines changed

6 files changed

+234
-21
lines changed

.github/workflows/test.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ on:
1010
branches: [main]
1111

1212
jobs:
13+
lint:
14+
name: Lint JS
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
- name: Lint JS
20+
run: npx --yes oxlint@latest -D perf
21+
1322
test:
1423
name: Unit tests
1524
runs-on: ubuntu-latest
@@ -23,9 +32,9 @@ jobs:
2332
- 18
2433

2534
steps:
26-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
2736
- name: Use Node.js ${{ matrix.node-version }}
28-
uses: actions/setup-node@v3
37+
uses: actions/setup-node@v4
2938
with:
3039
node-version: ${{ matrix.node-version }}
3140
cache: npm

package-lock.json

Lines changed: 202 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@
3737
"types": "./dist/index.d.ts",
3838
"scripts": {
3939
"test": "uvu",
40+
"lint": "oxlint",
4041
"build": "microbundle"
4142
},
4243
"dependencies": {
4344
"@projectwallace/css-analyzer": "^5.14.0"
4445
},
4546
"devDependencies": {
4647
"microbundle": "^0.15.1",
48+
"oxlint": "^0.2.13",
4749
"uvu": "^0.5.6"
4850
}
49-
}
51+
}

src/complexity.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const Complexity = suite('Complexity')
66

77
Complexity('should deduct points for a lot of Selectors more complex than most common Complexity', () => {
88
const fixture = `
9-
${new Array(1000)
9+
${Array.from({ length: 1000 })
1010
.fill('')
1111
.map(_ => `selector { }`)
1212
.join('')
1313
}
1414
15-
${new Array(500)
15+
${Array.from({ length: 500 })
1616
.fill('')
1717
.map(_ => `:where(selector) { }`)
1818
.join('')
@@ -25,21 +25,21 @@ Complexity('should deduct points for a lot of Selectors more complex than most c
2525
id: 'MoreThanMostCommonSelectorComplexity',
2626
score: 5,
2727
value: 1 / 3,
28-
actuals: (new Array(1000).fill(1)).concat(new Array(500).fill(2)),
28+
actuals: (Array.from({ length: 1000 }).fill(1)).concat(Array.from({ length: 500 }).fill(2)),
2929
}
3030
])
3131
assert.is(actual.complexity.score, 95)
3232
})
3333

3434
Complexity('should deduct points for a lot of Selectors more complex than most common Specificity', () => {
3535
const fixture = `
36-
${new Array(500)
36+
${Array.from({ length: 500 })
3737
.fill('')
3838
.map(_ => `selector1 { }`)
3939
.join('')
4040
}
4141
42-
${new Array(200)
42+
${Array.from({ length: 200 })
4343
.fill('')
4444
.map(_ => `.selector { }`)
4545
.join('')
@@ -52,7 +52,7 @@ Complexity('should deduct points for a lot of Selectors more complex than most c
5252
id: 'MoreThanMostCommonSelectorSpecificity',
5353
score: 2,
5454
value: 200 / 700,
55-
actuals: (new Array(500).fill([0, 0, 1])).concat(new Array(200).fill([0, 1, 0])),
55+
actuals: (Array.from({ length: 500 }).fill([0, 0, 1])).concat(Array.from({ length: 200 }).fill([0, 1, 0])),
5656
}
5757
])
5858
assert.is(actual.complexity.score, 98)

0 commit comments

Comments
 (0)