Skip to content

Commit

Permalink
Lint를 위한 신규 툴 추가 (Biome) (1673beta#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Oct 6, 2024
1 parent 86ab74e commit 1a4cee0
Show file tree
Hide file tree
Showing 18 changed files with 818 additions and 13 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"watch": "pnpm dev",
"dev": "node scripts/dev.mjs",
"lint": "pnpm -r lint",
"biome-lint": "pnpm -r biome-lint",
"cy:open": "pnpm cypress open --browser --e2e --config-file=cypress.config.ts",
"cy:run": "pnpm cypress run",
"e2e": "pnpm start-server-and-test start:test http://localhost:61812 cy:run",
Expand Down Expand Up @@ -68,6 +69,7 @@
"glob": "11.0.0"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@misskey-dev/eslint-plugin": "2.0.3",
"@types/node": "20.14.12",
"@typescript-eslint/eslint-plugin": "7.17.0",
Expand Down
127 changes: 127 additions & 0 deletions packages/backend/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noBannedTypes": "error",
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessTypeConstraint": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "warn",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "warn",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "off",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": {
"noDefaultExport": "warn",
"noInferrableTypes": "warn",
"noNamespace": "error",
"noNonNullAssertion": "warn",
"noParameterAssign": "warn",
"noRestrictedGlobals": {
"level": "error",
"options": { "deniedGlobals": ["__dirname", "__filename"] }
},
"noVar": "error",
"useAsConstAssertion": "error"
},
"suspicious": {
"noAsyncPromiseExecutor": "off",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "warn",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "off",
"noExplicitAny": "warn",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
},
"ignore": [
"**/node_modules",
"built",
"@types/**/*",
"migration"
]
},
"overrides": [
{
"include": ["*.ts", "*.tsx", "*.mts", "*.cts"],
"linter": {
"rules": {
"correctness": {
"noConstAssign": "off",
"noGlobalObjectCalls": "off",
"noInvalidConstructorSuper": "off",
"noInvalidNewBuiltin": "off",
"noNewSymbol": "off",
"noSetterReturn": "off",
"noUndeclaredVariables": "off",
"noUnreachable": "off",
"noUnreachableSuper": "off"
},
"style": {
"noArguments": "error",
"noVar": "error",
"useConst": "error"
},
"suspicious": {
"noDuplicateClassMembers": "off",
"noDuplicateObjectKeys": "off",
"noDuplicateParameters": "off",
"noFunctionAssign": "off",
"noImportAssign": "off",
"noRedeclare": "off",
"noUnsafeNegation": "off",
"useGetterReturn": "off"
}
}
}
}
]
}
4 changes: 4 additions & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"typecheck": "tsc --noEmit",
"eslint": "eslint --quiet \"src/**/*.ts\"",
"lint": "pnpm typecheck && pnpm eslint",
"biome-lint": "pnpm typecheck && pnpm biome lint",
"format": "pnpm biome format",
"format:write": "pnpm biome format --write",
"jest": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --config jest.config.unit.cjs",
"jest:e2e": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --config jest.config.e2e.cjs",
"jest-and-coverage": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --forceExit --config jest.config.unit.cjs",
Expand Down Expand Up @@ -192,6 +195,7 @@
"xev": "3.0.2"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@jest/globals": "29.7.0",
"@nestjs/platform-express": "10.4.3",
"@simplewebauthn/types": "10.0.0",
Expand Down
126 changes: 126 additions & 0 deletions packages/cherrypick-js/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noBannedTypes": "error",
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessTypeConstraint": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "warn",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "warn",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "off",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": {
"noDefaultExport": "warn",
"noInferrableTypes": "warn",
"noNamespace": "error",
"noNonNullAssertion": "warn",
"noParameterAssign": "warn",
"noVar": "error",
"useAsConstAssertion": "error"
},
"suspicious": {
"noAsyncPromiseExecutor": "off",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "warn",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "off",
"noExplicitAny": "warn",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
},
"ignore": [
"**/node_modules",
"built",
"coverage",
"jest.config.ts",
"test",
"test-d",
"generator"
]
},
"overrides": [
{
"include": ["*.ts", "*.tsx"],
"linter": {
"rules": {
"correctness": {
"noConstAssign": "off",
"noGlobalObjectCalls": "off",
"noInvalidConstructorSuper": "off",
"noInvalidNewBuiltin": "off",
"noNewSymbol": "off",
"noSetterReturn": "off",
"noUndeclaredVariables": "off",
"noUnreachable": "off",
"noUnreachableSuper": "off"
},
"style": {
"noArguments": "error",
"noVar": "error",
"useConst": "error"
},
"suspicious": {
"noDuplicateClassMembers": "off",
"noDuplicateObjectKeys": "off",
"noDuplicateParameters": "off",
"noFunctionAssign": "off",
"noImportAssign": "off",
"noRedeclare": "off",
"noUnsafeNegation": "off",
"useGetterReturn": "off"
}
}
}
}
]
}
4 changes: 4 additions & 0 deletions packages/cherrypick-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"eslint": "eslint './**/*.{js,jsx,ts,tsx}'",
"typecheck": "tsc --noEmit",
"lint": "pnpm typecheck && pnpm eslint",
"biome-lint": "pnpm typecheck && pnpm biome lint",
"format": "pnpm biome format",
"format:write": "pnpm biome format --write",
"jest": "jest --coverage --detectOpenHandles",
"test": "pnpm jest && pnpm tsd",
"update-autogen-code": "pnpm --filter cherrypick-js-type-generator generate && ncp generator/built/autogen src/autogen"
Expand All @@ -36,6 +39,7 @@
"directory": "packages/cherrypick-js"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@microsoft/api-extractor": "7.47.9",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.13",
Expand Down
12 changes: 12 additions & 0 deletions packages/frontend-embed/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
6 changes: 5 additions & 1 deletion packages/frontend-embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"build": "vite build",
"typecheck": "vue-tsc --noEmit",
"eslint": "eslint --quiet \"src/**/*.{ts,vue}\"",
"lint": "pnpm typecheck && pnpm eslint"
"lint": "pnpm typecheck && pnpm eslint",
"biome-lint": "pnpm typecheck && pnpm biome lint",
"format": "pnpm biome format",
"format:write": "pnpm biome format --write"
},
"dependencies": {
"@discordapp/twemoji": "15.1.0",
Expand Down Expand Up @@ -39,6 +42,7 @@
"vue": "3.5.10"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@misskey-dev/summaly": "5.1.0",
"@testing-library/vue": "8.1.0",
"@types/estree": "1.0.6",
Expand Down
12 changes: 12 additions & 0 deletions packages/frontend-shared/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
6 changes: 5 additions & 1 deletion packages/frontend-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
"watch": "nodemon -w package.json -e json --exec \"node ./build.js --watch\"",
"eslint": "eslint './**/*.{js,jsx,ts,tsx}'",
"typecheck": "tsc --noEmit",
"lint": "pnpm typecheck && pnpm eslint"
"lint": "pnpm typecheck && pnpm eslint",
"biome-lint": "pnpm typecheck && pnpm biome lint",
"format": "pnpm biome format",
"format:write": "pnpm biome format --write"
},
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@types/node": "20.14.12",
"@typescript-eslint/eslint-plugin": "7.17.0",
"@typescript-eslint/parser": "7.17.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/frontend/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
Loading

0 comments on commit 1a4cee0

Please sign in to comment.