Skip to content

Commit

Permalink
Use-biome (#302)
Browse files Browse the repository at this point in the history
* Use biome formatter

* Start migration to biome linter

* Fix intentional empty interfaces

* Apply automatic changes

* Fix remaining biome items

* Use biome check instead of lint

* Respect .gitignore

* Remove prettier and eslint

* Fix remaining issues

* Fix biome not ignoring files

* Fix preamble

* Do not use * in biome paths
  • Loading branch information
sz-piotr authored Apr 21, 2024
1 parent ae95d7e commit 1bd7407
Show file tree
Hide file tree
Showing 135 changed files with 728 additions and 1,703 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

77 changes: 0 additions & 77 deletions .eslintrc.json

This file was deleted.

11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
node_modules
dist
**/tsconfig.tsbuildinfo
**/tsconfig.prod.tsbuildinfo
.vercel
packages/website/.vitepress
packages/website/generators/test-examples/output/examples.test.ts
.vscode

# Instead of packages/website we use ** because biome has some weird bug
# where it incorrectly uses the .gitignore file
**/docs/.vitepress/cache
**/docs/.vitepress/dist
**/docs/api/api-reference.md
**/generators/test-examples/output/examples.test.ts
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pnpm test

### Introducing changes

We use prettier, and static analysis extensively but don't you worry! We have a
magic script to run all checks locally and automatically fix all the
We use a formatter and static analysis extensively but don't you worry! We have
a magic script to run all checks locally and automatically fix all the
auto-fixable problems:

```
Expand Down
28 changes: 28 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.0/schema.json",
"organizeImports": {
"enabled": true
},
"vcs": {
"enabled": true,
"clientKind": "git",
"defaultBranch": "main",
"useIgnoreFile": true
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded"
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
3 changes: 0 additions & 3 deletions examples/example-mocha/.eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions examples/example-mocha/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions examples/example-mocha/.prettierrc

This file was deleted.

8 changes: 4 additions & 4 deletions examples/example-mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "1.0.0",
"scripts": {
"start": "ts-node -T ./src/index.ts",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint --ext .ts --max-warnings 0 src",
"lint:fix": "pnpm lint --fix",
"format": "biome format .",
"format:fix": "biome format --write .",
"lint": "biome check ./src",
"lint:fix": "biome check --apply ./src",
"typecheck": "tsc --noEmit",
"test": "mocha",
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm test && pnpm typecheck"
Expand Down
3 changes: 0 additions & 3 deletions examples/example-plugin/.eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions examples/example-plugin/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions examples/example-plugin/.prettierrc

This file was deleted.

8 changes: 4 additions & 4 deletions examples/example-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"types": "./types.d.ts",
"scripts": {
"start": "ts-node -T ./src/index.ts",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint --ext .ts --max-warnings 0 src",
"lint:fix": "pnpm lint --fix",
"format": "biome format .",
"format:fix": "biome format --write .",
"lint": "biome check ./src",
"lint:fix": "biome check --apply ./src",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist tsconfig.tsbuildinfo",
"build": "pnpm clean && tsc --build",
Expand Down
3 changes: 1 addition & 2 deletions examples/example-plugin/src/toBeEven.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Control, formatCompact, registerValidator } from 'earl'
import { type Control, formatCompact, registerValidator } from 'earl'

declare module 'earl' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Validators<T> {
toBeEven(this: Validators<number>): void
}
Expand Down
3 changes: 0 additions & 3 deletions examples/example-uvu/.eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions examples/example-uvu/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions examples/example-uvu/.prettierrc

This file was deleted.

8 changes: 4 additions & 4 deletions examples/example-uvu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "1.0.0",
"scripts": {
"start": "ts-node -T ./src/index.ts",
"format": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint --ext .ts --max-warnings 0 src",
"lint:fix": "pnpm lint --fix",
"format": "biome format .",
"format:fix": "biome format --write .",
"lint": "biome check ./src",
"lint:fix": "biome check --apply ./src",
"typecheck": "tsc --noEmit",
"test": "uvu -r ts-node/register src",
"test:fix": "pnpm lint:fix && pnpm format:fix && pnpm test && pnpm typecheck"
Expand Down
2 changes: 0 additions & 2 deletions examples/getting-started/.gitignore

This file was deleted.

12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,19 @@
},
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@krzkaczor/prettier-plugin-jsdoc": "0.4.3",
"@types/chai": "^4.3.4",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "5.57.0",
"@typescript-eslint/parser": "5.57.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"conditional-type-checks": "^1.0.6",
"eslint": "^8.37.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"mocha": "10.2.0",
"prettier": "^2.8.7",
"rimraf": "^4.4.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.3"
},
"dependencies": {
"@biomejs/biome": "^1.7.0"
}
}
3 changes: 0 additions & 3 deletions packages/e2e/.eslintrc.js

This file was deleted.

3 changes: 0 additions & 3 deletions packages/e2e/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions packages/e2e/.prettierrc

This file was deleted.

8 changes: 4 additions & 4 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "1.0.0",
"private": true,
"scripts": {
"format": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint --ext .ts,.js --max-warnings 0 test-esbuild test-node test-ts-node",
"lint:fix": "pnpm lint --fix",
"format": "biome format .",
"format:fix": "biome format --write .",
"lint": "biome check .",
"lint:fix": "biome check --apply .",
"typecheck": "tsc --noEmit",
"test": "pnpm test:babel && pnpm test:esbuild && pnpm test:mjs && pnpm test:node && pnpm test:ts-node",
"test:babel": "mocha --config test-babel/.mocharc.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/test-esbuild/stack-traces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function captureErrorAsync(fn: () => Promise<void>) {

function getStack(error: Error) {
const stack = utils.stackTraceFilter()(error.stack ?? '')
return Parser.parse({ stack } as any).map((x) => ({
return Parser.parse({ stack } as Error).map((x) => ({
at: x.functionName,
file: x.fileName,
}))
Expand Down
1 change: 0 additions & 1 deletion packages/e2e/test-node/stack-traces.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { expect } = require('earl')
const { utils } = require('mocha')
const Parser = require('error-stack-parser')
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/test-ts-node/stack-traces.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function captureErrorAsync(fn: () => Promise<void>) {

function getStack(error: Error) {
const stack = utils.stackTraceFilter()(error.stack ?? '')
return Parser.parse({ stack } as any).map((x) => ({
return Parser.parse({ stack } as Error).map((x) => ({
at: x.functionName,
file: x.fileName,
}))
Expand Down
9 changes: 0 additions & 9 deletions packages/e2e/tsconfig.prod.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/earl/.eslintrc.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions packages/earl/.prettierignore

This file was deleted.

11 changes: 0 additions & 11 deletions packages/earl/.prettierrc

This file was deleted.

8 changes: 4 additions & 4 deletions packages/earl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"!src/test"
],
"scripts": {
"format": "prettier --check .",
"format:fix": "prettier --write .",
"lint": "eslint --ext .ts --max-warnings 0 src",
"lint:fix": "pnpm lint --fix",
"format": "biome format .",
"format:fix": "biome format --write .",
"lint": "biome check ./src",
"lint:fix": "biome check --apply ./src",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist",
"build": "pnpm run clean && pnpm run build:esm && pnpm run build:cjs",
Expand Down
4 changes: 2 additions & 2 deletions packages/earl/src/Control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class Control {
? result.negatedReason
: result.negatedReason()
: typeof result.reason === 'string'
? result.reason
: result.reason(),
? result.reason
: result.reason(),
stack: this._location.stack(),
...formatActualAndExpected(result),
})
Expand Down
Loading

0 comments on commit 1bd7407

Please sign in to comment.