Skip to content

Commit e0cb182

Browse files
committed
chore: 更新 lint 配置
1 parent 12899c4 commit e0cb182

File tree

4 files changed

+65
-52
lines changed

4 files changed

+65
-52
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# IDE
33
.idea/
44
.vscode/
5+
.cursor/
56

67
# AI
78
.claude/
89

9-
1010
# dependencies
1111
/node_modules/
1212
/jspm_packages/

bun.lock

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

eslint.config.ts

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ import { defineConfig } from 'eslint/config'
1212
import eslintConfigPrettier from 'eslint-config-prettier/flat'
1313
import { importX } from 'eslint-plugin-import-x'
1414
import globals from 'globals'
15-
import tseslint, { ConfigArray } from 'typescript-eslint'
15+
import tseslint, { type ConfigArray } from 'typescript-eslint'
1616

17-
// Configuration
18-
const ENABLE_TYPE_CHECKED = true // Set to enable project-based type checking
19-
const ENABLE_FRONTEND = false // Set to enable Next.js, JSX, React, Hooks, and other frontend features
20-
const ENABLE_STYLESHEET = true // Set to enable CSS, SCSS, SASS and other stylesheet features
21-
const IGNORE_PRETTIER = true // Set to disable all rules that are unnecessary or might conflict with Prettier
17+
const options = {
18+
ENABLE_TYPE_CHECKED: true, // Set to enable project-based type checking
19+
ENABLE_FRONTEND: false, // Set to enable Next.js, JSX, React, Hooks, and other frontend features
20+
ENABLE_STYLESHEET: true, // Set to enable CSS, SCSS, SASS and other stylesheet features
21+
IGNORE_PRETTIER: true, // Set to disable all rules that are unnecessary or might conflict with Prettier
22+
}
23+
24+
const { ENABLE_TYPE_CHECKED, ENABLE_FRONTEND, ENABLE_STYLESHEET, IGNORE_PRETTIER } = options
2225

2326
const __filename = fileURLToPath(import.meta.url)
2427
const __dirname = path.dirname(__filename)
@@ -36,50 +39,50 @@ const tsFile = '*.{cts,ts,tsx,mts,mtsx}'
3639

3740
const tsConfig = ENABLE_TYPE_CHECKED
3841
? [
39-
{
40-
files: [`**/${scriptFile}`],
41-
languageOptions: {
42-
parserOptions: {
43-
projectService: true,
44-
tsconfigRootDir: __dirname,
45-
},
42+
{
43+
files: [`**/${scriptFile}`],
44+
languageOptions: {
45+
parserOptions: {
46+
projectService: true,
47+
tsconfigRootDir: __dirname,
4648
},
4749
},
48-
{
49-
...tseslint.configs.strictTypeChecked[0],
50-
files: [`**/${scriptFile}`],
51-
},
52-
{
53-
...tseslint.configs.strictTypeChecked[1],
54-
files: [`**/${tsFile}`],
55-
},
56-
{
57-
...tseslint.configs.strictTypeChecked[2],
58-
files: [`**/${scriptFile}`],
59-
},
60-
{
61-
...tseslint.configs.stylisticTypeChecked[2],
62-
files: [`**/${scriptFile}`],
63-
},
64-
]
50+
},
51+
{
52+
...tseslint.configs.strictTypeChecked[0],
53+
files: [`**/${scriptFile}`],
54+
},
55+
{
56+
...tseslint.configs.strictTypeChecked[1],
57+
files: [`**/${tsFile}`],
58+
},
59+
{
60+
...tseslint.configs.strictTypeChecked[2],
61+
files: [`**/${scriptFile}`],
62+
},
63+
{
64+
...tseslint.configs.stylisticTypeChecked[2],
65+
files: [`**/${scriptFile}`],
66+
},
67+
]
6568
: [
66-
{
67-
...tseslint.configs.strict[0],
68-
files: [`**/${scriptFile}`],
69-
},
70-
{
71-
...tseslint.configs.strict[1],
72-
files: [`**/${tsFile}`],
73-
},
74-
{
75-
...tseslint.configs.strict[2],
76-
files: [`**/${scriptFile}`],
77-
},
78-
{
79-
...tseslint.configs.stylistic[2],
80-
files: [`**/${scriptFile}`],
81-
},
82-
]
69+
{
70+
...tseslint.configs.strict[0],
71+
files: [`**/${scriptFile}`],
72+
},
73+
{
74+
...tseslint.configs.strict[1],
75+
files: [`**/${tsFile}`],
76+
},
77+
{
78+
...tseslint.configs.strict[2],
79+
files: [`**/${scriptFile}`],
80+
},
81+
{
82+
...tseslint.configs.stylistic[2],
83+
files: [`**/${scriptFile}`],
84+
},
85+
]
8386

8487
const scriptConfig: ConfigArray = tseslint.config([
8588
{
@@ -133,9 +136,7 @@ if (ENABLE_FRONTEND) {
133136
)
134137

135138
for (const nextConfigElement of nextConfig) {
136-
if (!nextConfigElement.files) {
137-
nextConfigElement.files = [`**/${scriptFile}`]
138-
}
139+
nextConfigElement.files ??= [`**/${scriptFile}`]
139140
}
140141
}
141142

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oflow-interface",
3-
"version": "0.14.6",
3+
"version": "0.14.7",
44
"description": "Interface package for O FLOW. You can use this package to build your own plugin that can control anything.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -45,6 +45,8 @@
4545
"@eslint/js": "^9.28.0",
4646
"@eslint/json": "^0.12.0",
4747
"@eslint/markdown": "^6.4.0",
48+
"@types/bun": "^1.2.15",
49+
"@types/node": "^22.15.30",
4850
"@types/react": "^18",
4951
"@types/react-dom": "^18",
5052
"@typescript-eslint/project-service": "^8.33.1",

0 commit comments

Comments
 (0)