Skip to content

Commit

Permalink
style: use biome for formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadim147c committed Aug 22, 2024
1 parent 17369d1 commit f314d30
Show file tree
Hide file tree
Showing 49 changed files with 278 additions and 246 deletions.
9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

119 changes: 119 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "double",
"trailingCommas": "es5"
}
},
"organizeImports": {
"enabled": true
},
"json": {
"formatter": {
"enabled": true,
"lineWidth": 100,
"lineEnding": "lf",
"indentWidth": 4,
"indentStyle": "space"
}
},
"formatter": {
"enabled": true,
"lineWidth": 100,
"lineEnding": "lf",
"indentWidth": 4,
"indentStyle": "space",
"formatWithErrors": true
},
"linter": {
"ignore": ["dist", "**/dist", "eslint.config.mjs", "commitlint.config.js", "pre-commit.js"],
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessTypeConstraint": "error",
"noStaticOnlyClass": "off",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInvalidConstructorSuper": "error",
"noInvalidNewBuiltin": "error",
"noNewSymbol": "off",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"security": {
"noGlobalEval": "error"
},
"style": {
"noArguments": "error",
"noCommaOperator": "error",
"noNamespace": "error",
"noNegationElse": "error",
"noVar": "error",
"useAsConstAssertion": "error",
"useBlockStatements": "off",
"useCollapsedElseIf": "error",
"useExportType": "error",
"useConst": "error"
},
"suspicious": {
"noConsoleLog": "info",
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "error",
"noExplicitAny": "error",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useAwait": "error",
"useGetterReturn": "error",
"useNamespaceKeyword": "error",
"useValidTypeof": "error"
}
}
}
}
Binary file modified bun.lockb
Binary file not shown.
83 changes: 0 additions & 83 deletions eslint.config.mjs

This file was deleted.

26 changes: 11 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,32 @@
"start": "bun run dist/index.js",
"build:start": "bun exec tsc && bun run dist/.",
"nodemon": "nodemon dist/.",
"lint": "eslint .",
"dev": "bun run --watch src/index.ts",
"build": "tsc",
"watch": "tsc -w",
"prepare": "bunx husky"
"prepare": "bunx husky",
"lint": "biome lint",
"lint:fix": "biome lint --fix",
"format": "biome check --write --no-errors-on-unmatched --linter-enabled=false --formatter-enabled=true --organize-imports-enabled=true",
"ci": "biome ci --no-errors-on-unmatched --formatter-enabled=true --linter-enabled=true --organize-imports-enabled=true ."
},
"lint-staged": {
"*.{ts,cts,mts,js,cjs,mjs}": "eslint --fix",
"*": "prettier --ignore-unknown --write"
"*.{ts,cts,mts,js,cjs,mjs}": "biome lint --fix",
"*": "biome check --write --no-errors-on-unmatched --linter-enabled=false --formatter-enabled=true --organize-imports-enabled=true"
},
"author": "3n123",
"license": "MIT",
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.0",
"@biomejs/biome": "^1.8.3",
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"@types/glob": "^8.1.0",
"@types/node": "^22.5.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"concurrently": "^8.2.2",
"eslint": "^9.9.0",
"eslint-config-prettier": "^8.10.0",
"nodemon": "^2.0.22",
"commitlint": "^19.4.0",
"typescript": "^5.5.4"
},
"dependencies": {
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"chalk": "^4.1.2",
"commitlint": "^19.4.0",
"discord.js": "^14.15.3",
"dotenv": "^16.4.5",
"glob": "^11.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/Information/user/avatar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApplicationCommandOptionType, ButtonStyle } from "discord.js"
import Command from "../../../structures/Command.js"
import { createButton, createRow } from "../../../functions/discord/components.js"
import Command from "../../../structures/Command.js"

// An example of a complete command
export default new Command({
Expand Down
6 changes: 3 additions & 3 deletions src/commands/Miscellaneous/help/commands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { codeBlock, EmbedBuilder, EmbedField } from "discord.js"
import { EmbedBuilder, type EmbedField, codeBlock } from "discord.js"
import Command from "../../../structures/Command.js"
import { CommandType } from "../../../typings/Commands.js"
import type { CommandType } from "../../../typings/Commands.js"

// A sub commands of help
export default new Command({
Expand All @@ -20,7 +20,7 @@ export default new Command({
commands
.filter(([, v]) => v.category === cate)
.map(map)
.join("\n"),
.join("\n")
) as string
const name = cate as string
return { value, name, inline: false }
Expand Down
Loading

0 comments on commit f314d30

Please sign in to comment.