Skip to content

Commit 41b48e7

Browse files
committed
build: introduce oxlint
1 parent 6fc087f commit 41b48e7

File tree

11 files changed

+369
-15
lines changed

11 files changed

+369
-15
lines changed

.oxlintrc.jsonc

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"ignorePatterns": ["packages/*/lib/**"],
4+
"categories": {
5+
"correctness": "error",
6+
"suspicious": "warn",
7+
"pedantic": "warn",
8+
"perf": "warn",
9+
"style": "warn",
10+
"restriction": "off",
11+
},
12+
"plugins": ["import", "unicorn", "oxc", "promise", "jsdoc"],
13+
"rules": {
14+
"catch-error-name": ["warn", { "name": "err" }],
15+
"curly": ["off", "multi-line"],
16+
"group-exports": "off",
17+
"id-length": [
18+
"warn",
19+
{ "exceptions": ["_", "a", "b", "d", "h", "i", "x", "y", "z"] },
20+
],
21+
"init-declarations": "off",
22+
"max-dependencies": "off",
23+
"max-lines": "off",
24+
"max-lines-per-function": "off",
25+
"max-params": ["warn", 4],
26+
"no-continue": "off",
27+
"no-console": "warn",
28+
"no-duplicate-imports": "off",
29+
"no-magic-numbers": "off",
30+
// "no-magic-numbers": ["warn", { "ignore": [-1, 0, 1, 2] }],
31+
"no-nested-ternary": "off",
32+
"no-null": "off",
33+
"no-ternary": "off",
34+
"no-warning-comments": "off",
35+
"no-unused-vars": ["warn", { "ignoreRestSiblings": true }],
36+
"sort-imports": "off",
37+
"sort-keys": "off",
38+
39+
"import/exports-last": "off",
40+
// usually we just export vue components as default export without naming it
41+
"import/no-anonymous-default-export": "off",
42+
// a rule that shall not be enabled anyway
43+
"import/no-named-export": "off",
44+
"import/no-unassigned-import": [
45+
"error",
46+
{ "allow": ["**/*.css", "**/*.scss"] },
47+
],
48+
// named export is preferred in our codebase
49+
"import/prefer-default-export": "off",
50+
"jsdoc/require-param": "off",
51+
"jsdoc/require-param-type": "off",
52+
"jsdoc/require-returns": "off",
53+
"jsdoc/require-returns-type": "off",
54+
"promise/always-return": "off",
55+
"promise/avoid-new": "off",
56+
"promise/prefer-await-to-then": "off",
57+
"unicorn/filename-case": "off",
58+
// toReversed can introduce memory overhead
59+
"unicorn/no-array-reverse": "off",
60+
// toSorted can introduce memory overhead
61+
"unicorn/no-array-sort": "off",
62+
"unicorn/no-nested-ternary": "off",
63+
// at is not supported by our target environments
64+
"unicorn/prefer-at": "off",
65+
"unicorn/prefer-global-this": "off",
66+
67+
// seems conflicts with prettier
68+
"number-literal-case": "off",
69+
"numeric-separators-style": "off",
70+
71+
// style rules
72+
"capitalized-comments": "off",
73+
"max-statements": ["warn", { "max": 30 }],
74+
"no-inline-comments": "off",
75+
76+
// the following rules are still not supported by oxlint yet
77+
// "import-x/no-restricted-paths": [
78+
// "error",
79+
// {
80+
// "zones": [
81+
// {
82+
// "target": "packages/*/src/client/**",
83+
// "from": "packages/*/src/node/**",
84+
// },
85+
// {
86+
// "target": "packages/*/src/node/**",
87+
// "from": "packages/*/src/client/**",
88+
// },
89+
// ],
90+
// },
91+
// ],
92+
// "vue/multi-word-component-names": [
93+
// "error",
94+
// { "ignores": ["Blog", "Layout", "Slides"] },
95+
// ],
96+
},
97+
"overrides": [
98+
{
99+
"files": ["**/*.ts"],
100+
"plugins": ["typescript"],
101+
"rules": {
102+
"typescript/no-floating-promises": [
103+
"error",
104+
{
105+
"allowForKnownSafeCalls": [
106+
// Avoid explicit marking void for router.push
107+
{
108+
"from": "package",
109+
"name": "push",
110+
"package": "vue-router",
111+
},
112+
// Avoid explicit marking void for router.replace
113+
{
114+
"from": "package",
115+
"name": "replace",
116+
"package": "vue-router",
117+
},
118+
],
119+
},
120+
],
121+
// we make type casts only when necessary
122+
"typescript/no-unsafe-type-assertion": "off",
123+
// skipping it for now, may enable it later
124+
"typescript/switch-exhaustiveness-check": "off",
125+
// a lot of time we are just want to check existence
126+
"typescript/strict-boolean-expressions": "off",
127+
},
128+
},
129+
{
130+
"files": ["**/node/**/*.ts"],
131+
"plugins": ["node"],
132+
"rules": {
133+
"no-restricted-imports": [
134+
"error",
135+
"@vuepress/helper/client",
136+
"vuepress/client",
137+
],
138+
},
139+
},
140+
{
141+
"files": ["**/client/**/*.ts"],
142+
"plugins": ["vue"],
143+
"rules": {
144+
"no-restricted-imports": [
145+
"error",
146+
"@vuepress/helper",
147+
"@vuepress/helper/node",
148+
"vuepress/core",
149+
"vuepress/markdown",
150+
"vuepress/utils",
151+
],
152+
"typescript/prefer-nullish-coalescing": [
153+
"warn",
154+
{ "ignoreConditionalTests": true },
155+
],
156+
},
157+
},
158+
{
159+
"files": ["**/__tests__/**"],
160+
"plugins": ["vitest"],
161+
},
162+
{
163+
"files": ["**/create/src/**/*.ts"],
164+
"rules": {
165+
"no-console": "off",
166+
},
167+
},
168+
],
169+
}

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"format": "prettier --write .",
1414
"lint": "eslint . && prettier --check . && stylelint **/*.{css,html,scss,vue}",
1515
"lint:fix": "eslint . --fix && prettier --check --write . && stylelint **/*.{css,html,scss,vue} --fix",
16+
"lint:ox": "oxlint . --type-aware",
1617
"prepare": "husky",
1718
"release": "pnpm release:check && pnpm release:version && pnpm release:publish",
1819
"release:check": "pnpm lint && pnpm clean && pnpm build && pnpm test",
@@ -30,6 +31,10 @@
3031
"package.json": "sort-package-json"
3132
},
3233
"prettier": "prettier-config-vuepress",
34+
"dependencies": {
35+
"oxlint": "^1.37.0",
36+
"oxlint-tsgolint": "^0.10.1"
37+
},
3338
"devDependencies": {
3439
"@commitlint/cli": "^20.3.0",
3540
"@commitlint/config-conventional": "^20.3.0",

plugins/features/plugin-notice/src/client/components/Notice.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ export const Notice = defineComponent({
3434

3535
if (!option) return null
3636

37-
const {
38-
noticeKey,
39-
actions = [],
40-
title = '',
41-
content = '',
42-
...rest
43-
} = option
37+
const { noticeKey, actions = [], title, content = '', ...rest } = option
4438

4539
return {
4640
...rest,

plugins/markdown/plugin-revealjs/src/client/layouts/SlidePage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const SlidePage = defineComponent({
3535

3636
const home = (): void => {
3737
closeMenu()
38-
void router.push(routeLocale.value)
38+
router.push(routeLocale.value)
3939
}
4040

4141
onClickOutside(menu, closeMenu)

plugins/search/plugin-search/src/client/components/SearchBox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const SearchBox = defineComponent({
7878
| undefined
7979

8080
if (suggestion)
81-
void router.push(suggestion.link).then(() => {
81+
router.push(suggestion.link).then(() => {
8282
query.value = ''
8383
focusIndex.value = 0
8484
})

plugins/search/plugin-slimsearch/src/client/components/SearchResult.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ export default defineComponent({
307307

308308
addQueryHistory(props.queries.join(' '))
309309
addResultHistory(item)
310-
void router.push(getResultPath(item))
310+
router.push(getResultPath(item))
311311
resetSearchResult()
312312
}
313313
} else if (enableResultHistory) {
@@ -322,7 +322,7 @@ export default defineComponent({
322322
event.preventDefault()
323323
emit('updateQuery', queryHistories.value[index])
324324
} else {
325-
void router.push(resultHistories.value[index].link)
325+
router.push(resultHistories.value[index].link)
326326
resetSearchResult()
327327
}
328328
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {}

0 commit comments

Comments
 (0)