@soybeanjs/oxc-config 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +10 -10
- package/README.md +10 -10
- package/dist/index.js +44 -9
- package/package.json +3 -2
package/README.en.md
CHANGED
|
@@ -27,7 +27,7 @@ pnpm add -D @soybeanjs/oxc-config oxfmt oxlint
|
|
|
27
27
|
Create `oxfmt.config.ts` at project root:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import { fmt } from
|
|
30
|
+
import { fmt } from '@soybeanjs/oxc-config';
|
|
31
31
|
|
|
32
32
|
export default fmt;
|
|
33
33
|
```
|
|
@@ -35,7 +35,7 @@ export default fmt;
|
|
|
35
35
|
You can also extend it:
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
|
-
import { fmt } from
|
|
38
|
+
import { fmt } from '@soybeanjs/oxc-config';
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
41
|
...fmt,
|
|
@@ -95,7 +95,7 @@ Config (config, setting, constants...)
|
|
|
95
95
|
Create `oxlint.config.ts` at project root:
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
|
-
import { lint } from
|
|
98
|
+
import { lint } from '@soybeanjs/oxc-config';
|
|
99
99
|
|
|
100
100
|
export default lint;
|
|
101
101
|
```
|
|
@@ -115,24 +115,24 @@ A custom oxlint JS plugin that ensures `import type` always comes after `import`
|
|
|
115
115
|
|
|
116
116
|
```ts
|
|
117
117
|
// ✅ Correct
|
|
118
|
-
import { ref } from
|
|
119
|
-
import type { Ref } from
|
|
118
|
+
import { ref } from 'vue';
|
|
119
|
+
import type { Ref } from 'vue';
|
|
120
120
|
|
|
121
121
|
// ❌ Incorrect
|
|
122
|
-
import type { Ref } from
|
|
123
|
-
import { ref } from
|
|
122
|
+
import type { Ref } from 'vue';
|
|
123
|
+
import { ref } from 'vue';
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
The exported `lint` config already includes this plugin and rule. To override or extend:
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
|
-
import { lint } from
|
|
129
|
+
import { lint } from '@soybeanjs/oxc-config';
|
|
130
130
|
|
|
131
131
|
export default {
|
|
132
132
|
...lint,
|
|
133
|
-
jsPlugins: [
|
|
133
|
+
jsPlugins: ['@soybeanjs/oxc-config/import-type-order'],
|
|
134
134
|
rules: {
|
|
135
|
-
|
|
135
|
+
'import-type-order/type-after-value': 'warn'
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
```
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ pnpm add -D @soybeanjs/oxc-config oxfmt oxlint
|
|
|
27
27
|
在项目根目录创建 `oxfmt.config.ts`:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import { fmt } from
|
|
30
|
+
import { fmt } from '@soybeanjs/oxc-config';
|
|
31
31
|
|
|
32
32
|
export default fmt;
|
|
33
33
|
```
|
|
@@ -35,7 +35,7 @@ export default fmt;
|
|
|
35
35
|
也可以在此基础上扩展:
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
|
-
import { fmt } from
|
|
38
|
+
import { fmt } from '@soybeanjs/oxc-config';
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
41
|
...fmt,
|
|
@@ -95,7 +95,7 @@ Internal 别名排序层级(`order.json`):
|
|
|
95
95
|
在项目根目录创建 `oxlint.config.ts`:
|
|
96
96
|
|
|
97
97
|
```ts
|
|
98
|
-
import { lint } from
|
|
98
|
+
import { lint } from '@soybeanjs/oxc-config';
|
|
99
99
|
|
|
100
100
|
export default lint;
|
|
101
101
|
```
|
|
@@ -115,12 +115,12 @@ export default lint;
|
|
|
115
115
|
|
|
116
116
|
```ts
|
|
117
117
|
// ✅ 正确
|
|
118
|
-
import { ref } from
|
|
119
|
-
import type { Ref } from
|
|
118
|
+
import { ref } from 'vue';
|
|
119
|
+
import type { Ref } from 'vue';
|
|
120
120
|
|
|
121
121
|
// ❌ 错误
|
|
122
|
-
import type { Ref } from
|
|
123
|
-
import { ref } from
|
|
122
|
+
import type { Ref } from 'vue';
|
|
123
|
+
import { ref } from 'vue';
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
在 `oxlint.config.ts` 中启用:
|
|
@@ -128,13 +128,13 @@ import { ref } from "vue";
|
|
|
128
128
|
(导出的lint默认已经包含了插件和规则,这里仅展示如何覆盖或添加规则)
|
|
129
129
|
|
|
130
130
|
```ts
|
|
131
|
-
import { lint } from
|
|
131
|
+
import { lint } from '@soybeanjs/oxc-config';
|
|
132
132
|
|
|
133
133
|
export default {
|
|
134
134
|
...lint,
|
|
135
|
-
jsPlugins: [
|
|
135
|
+
jsPlugins: ['@soybeanjs/oxc-config/import-type-order'],
|
|
136
136
|
rules: {
|
|
137
|
-
|
|
137
|
+
'import-type-order/type-after-value': 'warn'
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
```
|
package/dist/index.js
CHANGED
|
@@ -2,28 +2,42 @@
|
|
|
2
2
|
var external = [
|
|
3
3
|
"vite",
|
|
4
4
|
"@vitejs/**",
|
|
5
|
-
"vite
|
|
5
|
+
"vite-**",
|
|
6
6
|
"tsdown",
|
|
7
|
-
"unplugin-*",
|
|
8
7
|
"vitest",
|
|
9
8
|
"@vitest/**",
|
|
10
9
|
"playwright",
|
|
10
|
+
"unplugin-**",
|
|
11
11
|
"cypress",
|
|
12
12
|
"vue",
|
|
13
13
|
"@vue/**",
|
|
14
14
|
"vue-router",
|
|
15
|
+
"vue-router/**",
|
|
15
16
|
"@vueuse/**",
|
|
17
|
+
"vue-**",
|
|
16
18
|
"nuxt",
|
|
17
19
|
"@nuxt/**",
|
|
20
|
+
"nuxt-**",
|
|
18
21
|
"react",
|
|
19
22
|
"react-dom",
|
|
20
23
|
"@react/**",
|
|
24
|
+
"react-**",
|
|
21
25
|
"next",
|
|
22
26
|
"@next/**",
|
|
23
27
|
"pinia",
|
|
24
|
-
"pinia
|
|
28
|
+
"pinia-**",
|
|
25
29
|
"zustand",
|
|
26
30
|
"jotai",
|
|
31
|
+
"unocss",
|
|
32
|
+
"unocss/**",
|
|
33
|
+
"@unocss/**",
|
|
34
|
+
"unocss-**",
|
|
35
|
+
"tailwindcss",
|
|
36
|
+
"@tailwindcss/**",
|
|
37
|
+
"tailwind-**",
|
|
38
|
+
"postcss",
|
|
39
|
+
"@postcss/**",
|
|
40
|
+
"postcss-**",
|
|
27
41
|
"@soybeanjs/**",
|
|
28
42
|
"nuxt-ui",
|
|
29
43
|
"element-plus",
|
|
@@ -32,12 +46,6 @@ var external = [
|
|
|
32
46
|
"naive-ui",
|
|
33
47
|
"@arco-design/**",
|
|
34
48
|
"@iconify/**",
|
|
35
|
-
"tailwindcss",
|
|
36
|
-
"@tailwindcss/**",
|
|
37
|
-
"unocss",
|
|
38
|
-
"@unocss/**",
|
|
39
|
-
"postcss",
|
|
40
|
-
"@postcss/**",
|
|
41
49
|
"axios",
|
|
42
50
|
"date-fns",
|
|
43
51
|
"dayjs",
|
|
@@ -108,6 +116,8 @@ var internal = [
|
|
|
108
116
|
const customGroups = [];
|
|
109
117
|
const externalGroupNames = [];
|
|
110
118
|
const internalGroupNames = [];
|
|
119
|
+
const parentGroupNames = [];
|
|
120
|
+
const siblingGroupNames = [];
|
|
111
121
|
external.forEach((item, index) => {
|
|
112
122
|
const groupName = `external-${index}`;
|
|
113
123
|
externalGroupNames.push(groupName);
|
|
@@ -116,6 +126,15 @@ external.forEach((item, index) => {
|
|
|
116
126
|
elementNamePattern: [item],
|
|
117
127
|
selector: "external"
|
|
118
128
|
});
|
|
129
|
+
if (item.endsWith("-**")) {
|
|
130
|
+
const _groupName = `external-subpath-${index}`;
|
|
131
|
+
externalGroupNames.push(_groupName);
|
|
132
|
+
customGroups.push({
|
|
133
|
+
groupName: _groupName,
|
|
134
|
+
elementNamePattern: [item.concat("/**")],
|
|
135
|
+
selector: "external"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
119
138
|
});
|
|
120
139
|
internal.forEach((item, index) => {
|
|
121
140
|
const groupName = `internal-${index}`;
|
|
@@ -125,6 +144,20 @@ internal.forEach((item, index) => {
|
|
|
125
144
|
elementNamePattern: [item],
|
|
126
145
|
selector: "internal"
|
|
127
146
|
});
|
|
147
|
+
const parentGroupName = `parent-${index}`;
|
|
148
|
+
parentGroupNames.push(parentGroupName);
|
|
149
|
+
customGroups.push({
|
|
150
|
+
groupName: parentGroupName,
|
|
151
|
+
elementNamePattern: [item.replace("@/", "**/")],
|
|
152
|
+
selector: "parent"
|
|
153
|
+
});
|
|
154
|
+
const siblingGroupName = `sibling-${index}`;
|
|
155
|
+
siblingGroupNames.push(siblingGroupName);
|
|
156
|
+
customGroups.push({
|
|
157
|
+
groupName: siblingGroupName,
|
|
158
|
+
elementNamePattern: [item.replace("@/", "**/")],
|
|
159
|
+
selector: "sibling"
|
|
160
|
+
});
|
|
128
161
|
});
|
|
129
162
|
const fmt = {
|
|
130
163
|
printWidth: 120,
|
|
@@ -145,7 +178,9 @@ const fmt = {
|
|
|
145
178
|
...internalGroupNames,
|
|
146
179
|
"internal",
|
|
147
180
|
"subpath",
|
|
181
|
+
...parentGroupNames,
|
|
148
182
|
"parent",
|
|
183
|
+
...siblingGroupNames,
|
|
149
184
|
"sibling",
|
|
150
185
|
"index",
|
|
151
186
|
"style",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soybeanjs/oxc-config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "SoybeanJS's oxlint and oxfmt config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
44
45
|
"registry": "https://registry.npmjs.org/"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
@@ -65,8 +66,8 @@
|
|
|
65
66
|
"scripts": {
|
|
66
67
|
"build": "tsdown",
|
|
67
68
|
"commit": "soy git-commit",
|
|
68
|
-
"lint": "oxlint --fix",
|
|
69
69
|
"fmt": "oxfmt",
|
|
70
|
+
"lint": "oxlint --fix",
|
|
70
71
|
"publish-pkg": "pnpm publish --access public",
|
|
71
72
|
"release": "soy release",
|
|
72
73
|
"typecheck": "tsc --noEmit --skipLibCheck",
|