Skip to content

Commit

Permalink
feat: use biome replace eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Oct 22, 2024
1 parent 12f3bed commit e97f3c3
Show file tree
Hide file tree
Showing 336 changed files with 9,231 additions and 10,097 deletions.
14 changes: 0 additions & 14 deletions .eslintignore

This file was deleted.

27 changes: 0 additions & 27 deletions .eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public-hoist-pattern[]=typescript
public-hoist-pattern[]=*@babel/runtime*
public-hoist-pattern[]=*tsconfig-paths*
public-hoist-pattern[]=*ts-node*
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*babel*
public-hoist-pattern[]=*@types/express*
public-hoist-pattern[]=*vue-template-compiler*
Expand Down
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript",
"javascriptreact",
]
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
}
}
100 changes: 100 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
"files": {
"ignoreUnknown": false,
"ignore": ["**/*.d.ts", "**/mock", "biome.json"],
"include": ["example/**/*.vue", "example/**/*.ts", "packages/**/*.ts"]
},
"formatter": { "enabled": true, "indentStyle": "tab", "lineWidth": 320, "attributePosition": "auto" },
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessConstructor": "error",
"noUselessLoneBlockStatements": "error",
"noUselessRename": "error",
"noUselessTernary": "error",
"noUselessUndefinedInitialization": "error",
"noVoid": "error",
"noWith": "error",
"useLiteralKeys": "off"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noInvalidUseBeforeDeclaration": "error",
"noNewSymbol": "error",
"noSelfAssign": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnusedVariables": "warn",
"useArrayLiterals": "error",
"useExhaustiveDependencies": "warn",
"useHookAtTopLevel": "off",
"useIsNan": "error"
},
"security": { "noGlobalEval": "error" },
"style": {
"noCommaOperator": "error",
"noNamespace": "error",
"noNonNullAssertion": "off",
"noYodaExpression": "error",
"useBlockStatements": "error",
"useConsistentBuiltinInstantiation": "error",
"useConst": "error",
"useSingleVarDeclarator": "error"
},
"suspicious": {
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noMisleadingCharacterClass": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noSelfCompare": "error",
"noShadowRestrictedNames": "error",
"noSparseArray": "error",
"noUnsafeNegation": "error",
"useValidTypeof": "error"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded",
"trailingCommas": "none",
"lineWidth": 320,
"attributePosition": "auto"
},
"parser": {
"unsafeParameterDecoratorsEnabled": true
},
"globals": ["cy", "expect", "it", "context", "beforeEach", "afterEach", "describe", "Cypress", "navigator", "window", "document", "__isBrowser__", "JSX", "Vue", "React", "__non_webpack_require__"]
}
}
5 changes: 0 additions & 5 deletions docs/.eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions docs/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@vitejs/plugin-vue": "^1.2.1",
"cross-env": "^7.0.3",
"darkmode-js": "^1.5.7",
"eslint-config-standard-vue-ts": "^1.0.12",
"raw-loader": "^4.0.2",
"ssr": "^6.0.0",
"ssr-plugin-midway": "^6.0.0",
Expand Down
3 changes: 0 additions & 3 deletions example/midway-react-ssr/.eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions example/midway-react-ssr/.eslintrc.js

This file was deleted.

4 changes: 1 addition & 3 deletions example/midway-react-ssr/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { UserConfig } from 'ssr-types'

const userConfig: UserConfig = {

}
const userConfig: UserConfig = {}

export { userConfig }
6 changes: 3 additions & 3 deletions example/midway-react-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"valtio": "^1.11.2"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@midwayjs/mock": "^3.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.3",
"eslint-config-standard-react-ts": "^1.0.18",
"ssr": "^6.0.0",
"ssr-plugin-midway": "^6.0.0",
"ssr-plugin-react": "^6.0.0",
Expand All @@ -40,7 +40,7 @@
"build:o": "ssr build --optimize",
"build:vite": "ssr build --vite",
"deploy": "ssr build && ssr deploy",
"lint": "eslint . --ext .js,.tsx,.ts --cache",
"lint:fix": "eslint . --ext .js,.tsx,.ts --cache --fix"
"lint": "biome format --diagnostic-level error",
"lint:fix": "biome format --diagnostic-level error --write"
}
}
5 changes: 2 additions & 3 deletions example/midway-react-ssr/src/config/config.default.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { MidwayConfig } from '@midwayjs/core'

export default {
// use for cookie sign key, should change to your own and keep security
keys: '1650192482948_2252'

// use for cookie sign key, should change to your own and keep security
keys: '1650192482948_2252'
} as MidwayConfig
28 changes: 13 additions & 15 deletions example/midway-react-ssr/src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import { Configuration, App } from '@midwayjs/decorator'
import * as koa from '@midwayjs/koa'
import { join } from 'path'
import { initialSSRDevProxy, getCwd } from 'ssr-common-utils'
import { App, Configuration } from '@midwayjs/decorator'
import * as koa from '@midwayjs/koa'
import { getCwd, initialSSRDevProxy } from 'ssr-common-utils'

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

@Configuration({
imports: [
koa
],
importConfigs: [join(__dirname, './config')]
imports: [koa],
importConfigs: [join(__dirname, './config')]
})
export class ContainerLifeCycle {
@App()
app: koa.Application
@App()
app: koa.Application

async onReady () {
this.app.use(koaStatic(join(cwd, './build'), { maxAge: 864000 }))
this.app.use(koaStatic(join(cwd, './public'), { maxAge: 864000 }))
this.app.use(koaStatic(join(cwd, './build/client'), { maxAge: 864000 }))
async onReady() {
this.app.use(koaStatic(join(cwd, './build'), { maxAge: 864000 }))
this.app.use(koaStatic(join(cwd, './public'), { maxAge: 864000 }))
this.app.use(koaStatic(join(cwd, './build/client'), { maxAge: 864000 }))

await initialSSRDevProxy(this.app)
}
await initialSSRDevProxy(this.app)
}
}
40 changes: 20 additions & 20 deletions example/midway-react-ssr/src/controller/api.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { Inject, Controller, Provide, Get } from '@midwayjs/decorator'
import { Controller, Get, Inject, Provide } from '@midwayjs/decorator'
import { Context } from '@midwayjs/koa'
import { IApiService, IApiDetailService } from '../interface'
import { IApiDetailService, IApiService } from '../interface'

@Provide()
@Controller('/api')
export class Api {
@Inject()
ctx: Context
@Inject()
ctx: Context

@Inject('ApiService')
service: IApiService
@Inject('ApiService')
service: IApiService

@Inject('ApiDetailService')
detailService: IApiDetailService
@Inject('ApiDetailService')
detailService: IApiDetailService

@Get('/index')
async getIndexData () {
const data = await this.service.index()
return data
}
@Get('/index')
async getIndexData() {
const data = await this.service.index()
return data
}

@Get('/detail/:id')
async getDetailData () {
const { ctx, detailService } = this
const id = ctx.params.id
const data = await detailService.index(id)
return data
}
@Get('/detail/:id')
async getDetailData() {
const { ctx, detailService } = this
const id = ctx.params.id
const data = await detailService.index(id)
return data
}
}
Loading

0 comments on commit e97f3c3

Please sign in to comment.