diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 07351e3..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,42 +0,0 @@ -/* eslint-env node */ -module.exports = { - root: true, - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/strict-type-checked", - "plugin:@typescript-eslint/stylistic-type-checked", - // Turns off all rules that are unnecessary or might conflict with Prettier. - "prettier", - ], - plugins: [ - "@typescript-eslint", - "simple-import-sort", - "import", - "unused-imports", - ], - parser: "@typescript-eslint/parser", - parserOptions: { - project: "./tsconfig.json", - }, - ignorePatterns: ["/dist"], - rules: { - /* Sort imports */ - "simple-import-sort/imports": "error", - "simple-import-sort/exports": "error", - "import/first": "error", - "import/newline-after-import": "error", - "import/no-duplicates": "error", - /* Make unused imports fixable */ - "@typescript-eslint/no-unused-vars": "off", - "unused-imports/no-unused-imports": "error", - "unused-imports/no-unused-vars": [ - "error", - { - vars: "all", - varsIgnorePattern: "^_", - args: "after-used", - argsIgnorePattern: "^_", - }, - ], - }, -}; diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 57b1d0c..0dd834e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,6 +13,6 @@ jobs: - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2 - run: bun install --frozen-lockfile - - run: bun check:prettier + - run: bun check:format - run: bun check:lint - - run: bun check:typescript + - run: bun check:ts diff --git a/biome.jsonc b/biome.jsonc new file mode 100644 index 0000000..5bd6957 --- /dev/null +++ b/biome.jsonc @@ -0,0 +1,24 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true, + "defaultBranch": "main" + }, + "files": { + "ignoreUnknown": true + }, + "organizeImports": { + "enabled": true + }, + "formatter": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + } +} diff --git a/bun.lockb b/bun.lockb index dd8124e..c4c90e8 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 45a5457..7fac3a6 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,26 @@ { - "name": "mediathequeroubaix.typescript", - "version": "1.0.0", - "description": "", - "keywords": [], - "author": "Thomas Queste (https://www.tomsquest.com/)", - "license": "MIT", - "type": "module", - "module": "src/index.ts", - "devDependencies": { - "@tsconfig/node22": "^22.0.0", - "@types/bun": "^1.1.13", - "@typescript-eslint/eslint-plugin": "^6.21.0", - "@typescript-eslint/parser": "^6.21.0", - "bun-types": "^1.1.34", - "eslint": "^8.57.1", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.31.0", - "eslint-plugin-simple-import-sort": "^10.0.0", - "eslint-plugin-unused-imports": "^3.2.0", - "husky": "^8.0.3", - "lint-staged": "^14.0.1", - "prettier": "^3.3.3", - "rimraf": "^5.0.10", - "typescript": "^5.6.3" - }, - "lint-staged": { - "*.{md,js,cjs,json}": [ - "prettier --write --cache" - ], - "src/**/*.ts": [ - "eslint --fix --cache --cache-location .cache/", - "prettier --write --cache", - "bun test" - ] - }, - "scripts": { - "prepare": "husky install", - "clean": "rimraf .cache dist", - "fix:prettier": "prettier . --cache --write", - "fix:lint": "bun check:lint -- --fix", - "check:prettier": "prettier . --cache --check", - "check:lint": "eslint . --cache --cache-location .cache/", - "check:typescript": "tsc" - } + "name": "mediathequeroubaix.typescript", + "version": "1.0.0", + "description": "CLI for the library of Roubaix (Médiathèque Roubaix)", + "keywords": [], + "author": "Thomas Queste (https://www.tomsquest.com/)", + "license": "MIT", + "type": "module", + "module": "src/index.ts", + "devDependencies": { + "@biomejs/biome": "1.9.4", + "@tsconfig/node22": "22.0.0", + "@types/bun": "1.1.13", + "bun-types": "1.1.34", + "rimraf": "5.0.10", + "typescript": "5.6.3" + }, + "scripts": { + "clean": "rimraf .cache dist", + "check:format": "biome format", + "check:lint": "biome lint", + "check:ts": "tsc --noEmit", + "lint:format": "biome format --fix", + "lint:check": "biome lint --fix" + } } diff --git a/src/getHelloWorld.test.ts b/src/getHelloWorld.test.ts index 8745491..5ab2f9f 100644 --- a/src/getHelloWorld.test.ts +++ b/src/getHelloWorld.test.ts @@ -3,7 +3,7 @@ import { expect, test } from "bun:test"; import { getHelloWorld } from "./getHelloWorld"; test("ok", () => { - const result = getHelloWorld(); + const result = getHelloWorld(); - expect(result).toEqual("Hello World"); + expect(result).toEqual("Hello World"); }); diff --git a/src/getHelloWorld.ts b/src/getHelloWorld.ts index 98078a0..6ed75b1 100644 --- a/src/getHelloWorld.ts +++ b/src/getHelloWorld.ts @@ -1,3 +1,3 @@ export const getHelloWorld = (): string => { - return "Hello World"; + return "Hello World"; }; diff --git a/src/index.ts b/src/index.ts index 3b38179..5cd1321 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { getHelloWorld } from "./getHelloWorld"; const main = (): void => { - console.log(getHelloWorld()); + console.log(getHelloWorld()); }; main(); diff --git a/tsconfig.json b/tsconfig.json index c0464d4..031f9a3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,32 +1,32 @@ { - "extends": "@tsconfig/node22/tsconfig.json", - "compilerOptions": { - "types": ["bun-types"], + "extends": "@tsconfig/node22/tsconfig.json", + "compilerOptions": { + "types": ["bun-types"], - // Enable latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "ESNext", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, + // Enable latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, - // Strict - "strict": true, - "skipLibCheck": true, - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, - "noImplicitReturns": true, - "noPropertyAccessFromIndexSignature": true, - "noUnusedLocals": true, - "noUnusedParameters": true - } + // Strict + "strict": true, + "skipLibCheck": true, + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, + "noUnusedLocals": true, + "noUnusedParameters": true + } }