diff --git a/bun-types.d.ts b/bun-types.d.ts new file mode 100644 index 0000000..abc8244 --- /dev/null +++ b/bun-types.d.ts @@ -0,0 +1,3 @@ +/// +/// +/// diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..90d13d4 --- /dev/null +++ b/bunfig.toml @@ -0,0 +1,2 @@ +[alias] +"@lib" = "./src/lib" diff --git a/eslint.config.js b/eslint.config.js index 5b8cab6..f3c0f35 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,55 +1,78 @@ -import js from '@eslint/js'; -import ts from 'typescript-eslint'; +import js from "@eslint/js"; +import ts from "typescript-eslint"; export default [ - js.configs.recommended, - ...ts.configs.recommended, - { - languageOptions: { - ecmaVersion: 'latest', - }, - rules: { - 'arrow-spacing': ['warn', { before: true, after: true }], - 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }], - 'comma-dangle': ['error', 'always-multiline'], - 'comma-spacing': 'error', - 'comma-style': 'error', - curly: ['error', 'multi-line', 'consistent'], - 'dot-location': ['error', 'property'], - 'handle-callback-err': 'off', - indent: ['error', 'tab'], - 'keyword-spacing': 'error', - 'max-nested-callbacks': ['error', { max: 4 }], - 'max-statements-per-line': ['error', { max: 2 }], - 'no-console': 'off', - 'no-empty-function': 'error', - 'no-floating-decimal': 'error', - 'no-inline-comments': 'error', - 'no-lonely-if': 'error', - 'no-multi-spaces': 'error', - 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }], - 'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }], - 'no-trailing-spaces': ['error'], - 'no-var': 'error', - 'no-undef': 'off', - 'object-curly-spacing': ['error', 'always'], - 'prefer-const': 'error', - quotes: ['error', 'single'], - semi: ['error', 'always'], - 'space-before-blocks': 'error', - 'space-before-function-paren': [ - 'error', - { - anonymous: 'never', - named: 'never', - asyncArrow: 'always', - }, - ], - 'space-in-parens': 'error', - 'space-infix-ops': 'error', - 'space-unary-ops': 'error', - 'spaced-comment': 'error', - yoda: 'error', - }, - }, + js.configs.recommended, + ...ts.configs.recommended, + { + languageOptions: { + ecmaVersion: "latest", + parserOptions: { + project: "./tsconfig.json", + tsconfigRootDir: import.meta.dirname, + }, + }, + ignores: [ + '**/dist/**', + '**/node_modules/**', + 'bun-types.d.ts', + 'eslint.config.js', + 'package.json', + 'tsconfig.json', + 'bunfig.toml', + ], + rules: { + "arrow-spacing": ["warn", { before: true, after: true }], + "brace-style": ["error", "stroustrup", { allowSingleLine: true }], + "comma-dangle": ["error", "always-multiline"], + "comma-spacing": "error", + "comma-style": "error", + curly: ["error", "multi-line", "consistent"], + "dot-location": ["error", "property"], + "handle-callback-err": "off", + indent: ["error", "tab"], + "keyword-spacing": "error", + "max-nested-callbacks": ["error", { max: 4 }], + "max-statements-per-line": ["error", { max: 2 }], + "no-console": "off", + "no-empty-function": "error", + "no-floating-decimal": "error", + "no-inline-comments": "error", + "no-lonely-if": "error", + "no-multi-spaces": "error", + "no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1, maxBOF: 0 }], + "no-shadow": ["error", { allow: ["err", "resolve", "reject"] }], + "no-trailing-spaces": ["error"], + "no-var": "error", + "no-undef": "off", + "object-curly-spacing": ["error", "always"], + "prefer-const": "error", + quotes: ["error", "single"], + semi: ["error", "always"], + "space-before-blocks": "error", + "space-before-function-paren": [ + "error", + { + anonymous: "never", + named: "never", + asyncArrow: "always", + }, + ], + "space-in-parens": "error", + "space-infix-ops": "error", + "space-unary-ops": "error", + "spaced-comment": "error", + yoda: "error", + + // TypeScript rules - less strict for better DX + "@typescript-eslint/no-unsafe-*": "off", + "@typescript-eslint/restrict-template-expressions": "warn", + "@typescript-eslint/no-deprecated": "warn", + "@typescript-eslint/no-misused-promises": "warn", + "@typescript-eslint/no-floating-promises": "warn", + "@typescript-eslint/no-unnecessary-condition": "warn", + "@typescript-eslint/no-unused-vars": "warn", + "@typescript-eslint/no-explicit-any": "warn", + }, + }, ]; diff --git a/package.json b/package.json index 94c51b0..420c713 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "type": "module", "scripts": { "dev": "bun --watch src/index.ts", - "build": "bun build src/index.ts --outdir dist --target bun", + "debug": "bun --watch src/index.ts --debug", + "lint": "bunx eslint src --ext .ts,.js --fix || watch -n 0.5 bunx eslint src --ext .ts,.js", + "lint:fix": "bunx eslint src --ext .ts,.js --fix", + "type-check": "bunx tsc --noEmit", "prepare": "husky" }, "private": true, @@ -14,23 +17,27 @@ ] }, "devDependencies": { - "@types/bun": "latest", - "eslint": "^9.36.0", + "@types/bun": "^1.3.0", + "@types/node": "^24.7.2", + "eslint": "^9.37.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-prettier": "^5.5.4", "husky": "^9.1.7", - "lint-staged": "^16.2.3", + "lint-staged": "^16.2.4", "prettier": "^3.6.2", - "prisma": "^6.16.3", - "typescript-eslint": "^8.45.0" + "prisma": "^6.17.1", + "typescript-eslint": "^8.46.1" }, "peerDependencies": { - "typescript": "^5.9.2" + "typescript": "^5.9.3" }, "dependencies": { - "@prisma/client": "^6.16.3", - "discord.js": "^14.22.1", + "@discordjs/builders": "^1.12.2", + "@prisma/client": "^6.17.1", + "chalk": "^5.6.2", + "discord.js": "^15.0.0-dev.1760227315-180dd60c6", "dotenv": "^17.2.3", - "mariadb": "^3.4.5" + "mariadb": "^3.4.5", + "module-alias": "^2.2.3" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..12ce6cb --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist", + "baseUrl": "./src", + "paths": { + "@lib/*": ["lib/*"] + }, + "sourceMap": true, + "removeComments": false, + "preserveConstEnums": true, + + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "types": ["node", "discord.js", "bun-types"], + + "strict": true, + "noImplicitAny": false, + "strictNullChecks": true, + "strictBindCallApply": true, + "alwaysStrict": true, + + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "resolveJsonModule": true, + "allowJs": true, + "isolatedModules": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + + "pretty": true, + "newLine": "lf", + "useDefineForClassFields": true + }, + + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +}