From 39142d96c8a0f01ccf3b2bbd14b858a9587c444d Mon Sep 17 00:00:00 2001 From: Geoff Date: Fri, 26 Jul 2024 22:46:56 -0400 Subject: [PATCH] Switch from Prettier and ESLint to BiomeJS --- .eslintrc | 88 ---------------------------------------- .github/workflows/ci.yml | 2 +- .prettierignore | 2 - .prettierrc | 5 --- biome.json | 46 +++++++++++++++++++++ package.json | 17 ++++---- 6 files changed, 54 insertions(+), 106 deletions(-) delete mode 100644 .eslintrc delete mode 100644 .prettierignore delete mode 100644 .prettierrc create mode 100644 biome.json diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 6635d412..00000000 --- a/.eslintrc +++ /dev/null @@ -1,88 +0,0 @@ -{ - "extends": ["prettier"], - "plugins": ["@typescript-eslint", "prettier/recommended"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2020, - "ecmaFeatures": { - "jsx": true - } - }, - "env": { - "browser": true, - "es6": true, - "mocha": true, - "node": true - }, - "rules": { - "@typescript-eslint/no-unused-vars": [ - "error", - { "vars": "all", "args": "none" } - ], - "constructor-super": "error", - "dot-notation": ["error", { "allowKeywords": true }], - "eqeqeq": ["error", "smart"], - "linebreak-style": "error", - "new-parens": "error", - "no-array-constructor": "error", - "no-class-assign": "error", - "no-console": "error", - "no-const-assign": "error", - "no-debugger": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-empty": "error", - "no-empty-character-class": "error", - "no-empty-pattern": "error", - "no-ex-assign": "error", - "no-extend-native": "error", - "no-extra-boolean-cast": "error", - "no-func-assign": "error", - "no-invalid-regexp": "error", - "no-lonely-if": "error", - "no-native-reassign": "error", - "no-negated-in-lhs": "error", - "no-new-object": "error", - "no-new-symbol": "error", - "no-path-concat": "error", - "no-redeclare": "error", - "no-regex-spaces": "error", - "no-sequences": "error", - "no-shadow": "error", - "no-shadow-restricted-names": "error", - "no-tabs": "error", - "no-this-before-super": "error", - "no-throw-literal": "error", - "no-unneeded-ternary": "error", - "no-unreachable": "error", - "no-unsafe-finally": "error", - "no-unsafe-negation": "error", - "no-unused-expressions": "error", - "no-unused-vars": "off", - "no-useless-call": "error", - "no-useless-computed-key": "error", - "no-useless-constructor": "error", - "no-useless-rename": "error", - "no-var": "error", - "no-void": "error", - "no-with": "error", - "object-shorthand": ["error", "always"], - "prefer-arrow-callback": "error", - "prefer-const": [ - "error", - { "destructuring": "all", "ignoreReadBeforeAssign": true } - ], - "prefer-rest-params": "error", - "prefer-spread": "error", - "prefer-template": "error", - "radix": "error", - "spaced-comment": ["error", "always", { "exceptions": ["-"] }], - "use-isnan": "error", - "valid-typeof": "error", - "yield-star-spacing": ["error", "after"], - "yoda": ["error", "never"] - } -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 473cb0c9..8831ac59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,6 @@ jobs: - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - run: npm install && npm test && npm run lint + - run: npm install && npm test && npm run check env: CI: true diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1eae0cf6..00000000 --- a/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -dist/ -node_modules/ diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 0b495108..00000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "singleQuote": true, - "semi": false, - "trailingComma": "es5" -} diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..fb4f3582 --- /dev/null +++ b/biome.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json", + "files": { + "include": ["src/**/*.ts", "test/**/*.ts"] + }, + "organizeImports": { + "enabled": false + }, + "formatter": { + "enabled": true, + "indentStyle": "space" + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "complexity": { + "noUselessTypeConstraint": "off", + "noBannedTypes": "off", + "useArrowFunction": "off" + }, + "suspicious": { + "noAssignInExpressions": "off", + "noExplicitAny": "off", + "noGlobalIsNan": "off", + "noImplicitAnyLet": "off" + }, + "style": { + "noParameterAssign": "off", + "useNumberNamespace": "off", + "noNonNullAssertion": "off", + "noUselessElse": "off", + "useImportType": "off", + "useConst": "off", + "useNodejsImportProtocol": "off" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "single", + "semicolons": "asNeeded", + "trailingCommas": "es5" + } + } +} diff --git a/package.json b/package.json index 5b6afed1..f0dc47fe 100644 --- a/package.json +++ b/package.json @@ -19,18 +19,15 @@ "node": ">=14.0.0" }, "devDependencies": { + "@biomejs/biome": "1.8.3", "@rollup/plugin-typescript": "^11.1.6", "@types/expect": "^24.3.0", "@types/lodash": "^4.14.144", "@types/node": "^18.7.14", "@typescript-eslint/eslint-plugin": "^7.1.1", "@typescript-eslint/parser": "^7.1.1", - "eslint": "^8.57.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-prettier": "^5.1.3", "lodash": "^4.17.15", "np": "^10.0.0", - "prettier": "^3.2.5", "rollup": "^4.12.1", "typescript": "^4.8.3", "vitest": "^1.6.0" @@ -38,12 +35,12 @@ "scripts": { "build": "rm -rf ./{dist} && rollup --config ./rollup.config.js", "clean": "rm -rf ./{dist,node_modules}", - "fix": "npm run fix:eslint && npm run fix:prettier", - "fix:eslint": "npm run lint:eslint --fix", - "fix:prettier": "prettier '**/*.{js,json,ts}' --write", - "lint": "npm run lint:eslint && npm run lint:prettier", - "lint:eslint": "eslint '{src,test}/*.{js,ts}'", - "lint:prettier": "prettier '**/*.{js,json,ts}' --check", + "fix": "npx @biomejs/biome check --write .", + "fix:lint": "npx @biomejs/biome lint --write .", + "fix:format": "npx @biomejs/biome format --write .", + "check": "npx @biomejs/biome check .", + "check:lint": "npx @biomejs/biome lint .", + "check:format": "npx @biomejs/biome format .", "release": "npm run build && npm run lint && np", "test": "npm run build && npm run test:types && npm run test:vitest", "test:types": "tsc --noEmit && tsc --project ./test/tsconfig.json --noEmit",