Skip to content

Commit c48e73d

Browse files
committed
feat: use biome replace eslint
1 parent 12f3bed commit c48e73d

File tree

336 files changed

+9245
-10096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+9245
-10096
lines changed

.eslintignore

-14
This file was deleted.

.eslintrc.js

-27
This file was deleted.

.npmrc

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ public-hoist-pattern[]=typescript
44
public-hoist-pattern[]=*@babel/runtime*
55
public-hoist-pattern[]=*tsconfig-paths*
66
public-hoist-pattern[]=*ts-node*
7-
public-hoist-pattern[]=*eslint*
87
public-hoist-pattern[]=*babel*
98
public-hoist-pattern[]=*@types/express*
109
public-hoist-pattern[]=*vue-template-compiler*

.vscode/settings.json

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
{
2-
"editor.codeActionsOnSave": {
3-
"source.fixAll.eslint": "explicit"
4-
},
5-
"eslint.validate": [
6-
"javascript",
7-
"javascriptreact",
8-
]
2+
"editor.defaultFormatter": "biomejs.biome",
3+
"editor.formatOnSave": true,
4+
"[typescript]": {
5+
"editor.defaultFormatter": "biomejs.biome"
6+
},
7+
"[javascript]": {
8+
"editor.defaultFormatter": "biomejs.biome"
9+
},
10+
"[javascriptreact]": {
11+
"editor.defaultFormatter": "biomejs.biome"
12+
},
13+
"[typescriptreact]": {
14+
"editor.defaultFormatter": "biomejs.biome"
15+
},
16+
"[json]": {
17+
"editor.defaultFormatter": "biomejs.biome"
18+
},
19+
"[jsonc]": {
20+
"editor.defaultFormatter": "biomejs.biome"
21+
},
22+
923
}

biome.json

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4+
"files": {
5+
"ignoreUnknown": false,
6+
"ignore": ["**/*.d.ts", "**/mock", "biome.json"],
7+
"include": ["example/**/*.vue", "example/**/*.ts", "packages/**/*.ts"]
8+
},
9+
"formatter": { "enabled": true, "indentStyle": "tab", "lineWidth": 320, "attributePosition": "auto" },
10+
"organizeImports": { "enabled": true },
11+
"linter": {
12+
"enabled": true,
13+
"rules": {
14+
"recommended": false,
15+
"complexity": {
16+
"noExtraBooleanCast": "error",
17+
"noMultipleSpacesInRegularExpressionLiterals": "error",
18+
"noUselessCatch": "error",
19+
"noUselessConstructor": "error",
20+
"noUselessLoneBlockStatements": "error",
21+
"noUselessRename": "error",
22+
"noUselessTernary": "error",
23+
"noUselessUndefinedInitialization": "error",
24+
"noVoid": "error",
25+
"noWith": "error",
26+
"useLiteralKeys": "off"
27+
},
28+
"correctness": {
29+
"noConstAssign": "error",
30+
"noConstantCondition": "error",
31+
"noEmptyCharacterClassInRegex": "error",
32+
"noEmptyPattern": "error",
33+
"noGlobalObjectCalls": "error",
34+
"noInnerDeclarations": "error",
35+
"noInvalidConstructorSuper": "error",
36+
"noInvalidUseBeforeDeclaration": "error",
37+
"noNewSymbol": "error",
38+
"noSelfAssign": "error",
39+
"noSwitchDeclarations": "error",
40+
"noUndeclaredVariables": "error",
41+
"noUnreachable": "error",
42+
"noUnreachableSuper": "error",
43+
"noUnsafeFinally": "error",
44+
"noUnusedVariables": "warn",
45+
"useArrayLiterals": "error",
46+
"useExhaustiveDependencies": "warn",
47+
"useHookAtTopLevel": "off",
48+
"useIsNan": "error"
49+
},
50+
"security": { "noGlobalEval": "error" },
51+
"style": {
52+
"noCommaOperator": "error",
53+
"noNamespace": "error",
54+
"noNonNullAssertion": "off",
55+
"noYodaExpression": "error",
56+
"useBlockStatements": "error",
57+
"useConsistentBuiltinInstantiation": "error",
58+
"useConst": "error",
59+
"useSingleVarDeclarator": "error"
60+
},
61+
"suspicious": {
62+
"noAsyncPromiseExecutor": "error",
63+
"noCatchAssign": "error",
64+
"noClassAssign": "error",
65+
"noCompareNegZero": "error",
66+
"noControlCharactersInRegex": "error",
67+
"noDebugger": "error",
68+
"noDoubleEquals": "error",
69+
"noDuplicateCase": "error",
70+
"noDuplicateClassMembers": "error",
71+
"noDuplicateObjectKeys": "error",
72+
"noDuplicateParameters": "error",
73+
"noFallthroughSwitchClause": "error",
74+
"noFunctionAssign": "error",
75+
"noGlobalAssign": "error",
76+
"noMisleadingCharacterClass": "error",
77+
"noPrototypeBuiltins": "error",
78+
"noRedeclare": "error",
79+
"noSelfCompare": "error",
80+
"noShadowRestrictedNames": "error",
81+
"noSparseArray": "error",
82+
"noUnsafeNegation": "error",
83+
"useValidTypeof": "error"
84+
}
85+
}
86+
},
87+
"javascript": {
88+
"formatter": {
89+
"quoteStyle": "single",
90+
"semicolons": "asNeeded",
91+
"trailingCommas": "none",
92+
"lineWidth": 320,
93+
"attributePosition": "auto"
94+
},
95+
"parser": {
96+
"unsafeParameterDecoratorsEnabled": true
97+
},
98+
"globals": ["cy", "expect", "it", "context", "beforeEach", "afterEach", "describe", "Cypress", "navigator", "window", "document", "__isBrowser__", "JSX", "Vue", "React", "__non_webpack_require__"]
99+
}
100+
}

docs/.eslintignore

-5
This file was deleted.

docs/.eslintrc.js

-9
This file was deleted.

docs/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"@vitejs/plugin-vue": "^1.2.1",
3232
"cross-env": "^7.0.3",
3333
"darkmode-js": "^1.5.7",
34-
"eslint-config-standard-vue-ts": "^1.0.12",
3534
"raw-loader": "^4.0.2",
3635
"ssr": "^6.0.0",
3736
"ssr-plugin-midway": "^6.0.0",

example/midway-react-ssr/.eslintignore

-3
This file was deleted.

example/midway-react-ssr/.eslintrc.js

-10
This file was deleted.

example/midway-react-ssr/config.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import type { UserConfig } from 'ssr-types'
22

3-
const userConfig: UserConfig = {
4-
5-
}
3+
const userConfig: UserConfig = {}
64

75
export { userConfig }

example/midway-react-ssr/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
"valtio": "^1.11.2"
2020
},
2121
"devDependencies": {
22+
"@biomejs/biome": "^1.9.4",
2223
"@midwayjs/mock": "^3.0.0",
2324
"@types/react": "^17.0.0",
2425
"@types/react-dom": "^17.0.0",
2526
"@types/react-router-dom": "^5.1.3",
26-
"eslint-config-standard-react-ts": "^1.0.18",
2727
"ssr": "^6.0.0",
2828
"ssr-plugin-midway": "^6.0.0",
2929
"ssr-plugin-react": "^6.0.0",
@@ -40,7 +40,7 @@
4040
"build:o": "ssr build --optimize",
4141
"build:vite": "ssr build --vite",
4242
"deploy": "ssr build && ssr deploy",
43-
"lint": "eslint . --ext .js,.tsx,.ts --cache",
44-
"lint:fix": "eslint . --ext .js,.tsx,.ts --cache --fix"
43+
"lint": "biome format --diagnostic-level error",
44+
"lint:fix": "biome format --diagnostic-level error --write"
4545
}
4646
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { MidwayConfig } from '@midwayjs/core'
22

33
export default {
4-
// use for cookie sign key, should change to your own and keep security
5-
keys: '1650192482948_2252'
6-
4+
// use for cookie sign key, should change to your own and keep security
5+
keys: '1650192482948_2252'
76
} as MidwayConfig
+13-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
import { Configuration, App } from '@midwayjs/decorator'
2-
import * as koa from '@midwayjs/koa'
31
import { join } from 'path'
4-
import { initialSSRDevProxy, getCwd } from 'ssr-common-utils'
2+
import { App, Configuration } from '@midwayjs/decorator'
3+
import * as koa from '@midwayjs/koa'
4+
import { getCwd, initialSSRDevProxy } from 'ssr-common-utils'
55

66
const koaStatic = require('koa-static-cache')
77
const cwd = getCwd()
88

99
@Configuration({
10-
imports: [
11-
koa
12-
],
13-
importConfigs: [join(__dirname, './config')]
10+
imports: [koa],
11+
importConfigs: [join(__dirname, './config')]
1412
})
1513
export class ContainerLifeCycle {
16-
@App()
17-
app: koa.Application
14+
@App()
15+
app: koa.Application
1816

19-
async onReady () {
20-
this.app.use(koaStatic(join(cwd, './build'), { maxAge: 864000 }))
21-
this.app.use(koaStatic(join(cwd, './public'), { maxAge: 864000 }))
22-
this.app.use(koaStatic(join(cwd, './build/client'), { maxAge: 864000 }))
17+
async onReady() {
18+
this.app.use(koaStatic(join(cwd, './build'), { maxAge: 864000 }))
19+
this.app.use(koaStatic(join(cwd, './public'), { maxAge: 864000 }))
20+
this.app.use(koaStatic(join(cwd, './build/client'), { maxAge: 864000 }))
2321

24-
await initialSSRDevProxy(this.app)
25-
}
22+
await initialSSRDevProxy(this.app)
23+
}
2624
}
+20-20
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
import { Inject, Controller, Provide, Get } from '@midwayjs/decorator'
1+
import { Controller, Get, Inject, Provide } from '@midwayjs/decorator'
22
import { Context } from '@midwayjs/koa'
3-
import { IApiService, IApiDetailService } from '../interface'
3+
import { IApiDetailService, IApiService } from '../interface'
44

55
@Provide()
66
@Controller('/api')
77
export class Api {
8-
@Inject()
9-
ctx: Context
8+
@Inject()
9+
ctx: Context
1010

11-
@Inject('ApiService')
12-
service: IApiService
11+
@Inject('ApiService')
12+
service: IApiService
1313

14-
@Inject('ApiDetailService')
15-
detailService: IApiDetailService
14+
@Inject('ApiDetailService')
15+
detailService: IApiDetailService
1616

17-
@Get('/index')
18-
async getIndexData () {
19-
const data = await this.service.index()
20-
return data
21-
}
17+
@Get('/index')
18+
async getIndexData() {
19+
const data = await this.service.index()
20+
return data
21+
}
2222

23-
@Get('/detail/:id')
24-
async getDetailData () {
25-
const { ctx, detailService } = this
26-
const id = ctx.params.id
27-
const data = await detailService.index(id)
28-
return data
29-
}
23+
@Get('/detail/:id')
24+
async getDetailData() {
25+
const { ctx, detailService } = this
26+
const id = ctx.params.id
27+
const data = await detailService.index(id)
28+
return data
29+
}
3030
}

0 commit comments

Comments
 (0)