feat(bun): adding the configuration for better developpement
This commit is contained in:
parent
6e154a8e60
commit
ac1abbabc7
5 changed files with 137 additions and 62 deletions
3
bun-types.d.ts
vendored
Normal file
3
bun-types.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
/// <reference types="bun-types" />
|
||||||
|
/// <reference types="discord.js" />
|
||||||
|
/// <reference types="node" />
|
||||||
2
bunfig.toml
Normal file
2
bunfig.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[alias]
|
||||||
|
"@lib" = "./src/lib"
|
||||||
127
eslint.config.js
127
eslint.config.js
|
|
@ -1,55 +1,78 @@
|
||||||
import js from '@eslint/js';
|
import js from "@eslint/js";
|
||||||
import ts from 'typescript-eslint';
|
import ts from "typescript-eslint";
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
...ts.configs.recommended,
|
...ts.configs.recommended,
|
||||||
{
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
ecmaVersion: 'latest',
|
ecmaVersion: "latest",
|
||||||
},
|
parserOptions: {
|
||||||
rules: {
|
project: "./tsconfig.json",
|
||||||
'arrow-spacing': ['warn', { before: true, after: true }],
|
tsconfigRootDir: import.meta.dirname,
|
||||||
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
|
},
|
||||||
'comma-dangle': ['error', 'always-multiline'],
|
},
|
||||||
'comma-spacing': 'error',
|
ignores: [
|
||||||
'comma-style': 'error',
|
'**/dist/**',
|
||||||
curly: ['error', 'multi-line', 'consistent'],
|
'**/node_modules/**',
|
||||||
'dot-location': ['error', 'property'],
|
'bun-types.d.ts',
|
||||||
'handle-callback-err': 'off',
|
'eslint.config.js',
|
||||||
indent: ['error', 'tab'],
|
'package.json',
|
||||||
'keyword-spacing': 'error',
|
'tsconfig.json',
|
||||||
'max-nested-callbacks': ['error', { max: 4 }],
|
'bunfig.toml',
|
||||||
'max-statements-per-line': ['error', { max: 2 }],
|
],
|
||||||
'no-console': 'off',
|
rules: {
|
||||||
'no-empty-function': 'error',
|
"arrow-spacing": ["warn", { before: true, after: true }],
|
||||||
'no-floating-decimal': 'error',
|
"brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
||||||
'no-inline-comments': 'error',
|
"comma-dangle": ["error", "always-multiline"],
|
||||||
'no-lonely-if': 'error',
|
"comma-spacing": "error",
|
||||||
'no-multi-spaces': 'error',
|
"comma-style": "error",
|
||||||
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
|
curly: ["error", "multi-line", "consistent"],
|
||||||
'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }],
|
"dot-location": ["error", "property"],
|
||||||
'no-trailing-spaces': ['error'],
|
"handle-callback-err": "off",
|
||||||
'no-var': 'error',
|
indent: ["error", "tab"],
|
||||||
'no-undef': 'off',
|
"keyword-spacing": "error",
|
||||||
'object-curly-spacing': ['error', 'always'],
|
"max-nested-callbacks": ["error", { max: 4 }],
|
||||||
'prefer-const': 'error',
|
"max-statements-per-line": ["error", { max: 2 }],
|
||||||
quotes: ['error', 'single'],
|
"no-console": "off",
|
||||||
semi: ['error', 'always'],
|
"no-empty-function": "error",
|
||||||
'space-before-blocks': 'error',
|
"no-floating-decimal": "error",
|
||||||
'space-before-function-paren': [
|
"no-inline-comments": "error",
|
||||||
'error',
|
"no-lonely-if": "error",
|
||||||
{
|
"no-multi-spaces": "error",
|
||||||
anonymous: 'never',
|
"no-multiple-empty-lines": ["error", { max: 2, maxEOF: 1, maxBOF: 0 }],
|
||||||
named: 'never',
|
"no-shadow": ["error", { allow: ["err", "resolve", "reject"] }],
|
||||||
asyncArrow: 'always',
|
"no-trailing-spaces": ["error"],
|
||||||
},
|
"no-var": "error",
|
||||||
],
|
"no-undef": "off",
|
||||||
'space-in-parens': 'error',
|
"object-curly-spacing": ["error", "always"],
|
||||||
'space-infix-ops': 'error',
|
"prefer-const": "error",
|
||||||
'space-unary-ops': 'error',
|
quotes: ["error", "single"],
|
||||||
'spaced-comment': 'error',
|
semi: ["error", "always"],
|
||||||
yoda: 'error',
|
"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",
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
27
package.json
27
package.json
|
|
@ -4,7 +4,10 @@
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun --watch src/index.ts",
|
"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"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
@ -14,23 +17,27 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bun": "latest",
|
"@types/bun": "^1.3.0",
|
||||||
"eslint": "^9.36.0",
|
"@types/node": "^24.7.2",
|
||||||
|
"eslint": "^9.37.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
"eslint-plugin-prettier": "^5.5.4",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
"lint-staged": "^16.2.3",
|
"lint-staged": "^16.2.4",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.6.2",
|
||||||
"prisma": "^6.16.3",
|
"prisma": "^6.17.1",
|
||||||
"typescript-eslint": "^8.45.0"
|
"typescript-eslint": "^8.46.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.9.2"
|
"typescript": "^5.9.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^6.16.3",
|
"@discordjs/builders": "^1.12.2",
|
||||||
"discord.js": "^14.22.1",
|
"@prisma/client": "^6.17.1",
|
||||||
|
"chalk": "^5.6.2",
|
||||||
|
"discord.js": "^15.0.0-dev.1760227315-180dd60c6",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"mariadb": "^3.4.5"
|
"mariadb": "^3.4.5",
|
||||||
|
"module-alias": "^2.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
40
tsconfig.json
Normal file
40
tsconfig.json
Normal file
|
|
@ -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"]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue