Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Biome #28

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

7 changes: 0 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ updates:
labels:
- 'skip-release'
groups:
lint:
patterns:
- '@typescript-eslint/*'
- 'eslint'
- 'eslint-*'
- 'prettier'
- 'jest-fail-on-console'
testing:
patterns:
- 'vitest'
Expand Down
15 changes: 15 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["./node_modules/@lokalise/biome-config/configs/biome-base.jsonc"],
"linter": {
"rules": {
"performance": {
"noBarrelFile": "off",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Shouldn't this be "on"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That rule is mostly useful for applications or larger libraries with plenty of optional imports. What would be the benefit of having indirect export structure in a library with just a few exports?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simply aim for consistency, and never use barrel files (no matter the size of the project). Or are there any scenarios where we still want to use them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that if you don't have a barrel file in a library, you can no longer have imports like

import { Client, RequestError, EMPTY_SCHEMA } from 'my-library'

unless they all come from the same file. For me this also brings worse DX, or clutters code structure of the library.

So for libraries where tree-shaking is not important I'd still go with barrel files. maybe we need separate biome preset for them

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. We need to find the right balance with this.

"noReExportAll": "off"
},
"style": {
"noUnusedTemplateLiteral": "off"
}
}
}
}
142 changes: 61 additions & 81 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,83 +1,63 @@
{
"name": "@lokalise/frontend-http-client",
"version": "2.1.0",
"description": "Opinionated HTTP client for the frontend",
"files": [
"dist/**",
"LICENSE",
"README.md"
],
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"author": {
"name": "Lokalise",
"url": "https://lokalise.com/"
},
"homepage": "https://github.com/lokalise/frontend-http-client",
"repository": {
"type": "git",
"url": "git://github.com/lokalise/frontend-http-client.git"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build:dev": "tsc",
"build:release": "tsup",
"clean": "rimraf dist .eslintcache",
"lint": "eslint --cache --max-warnings=0 . && prettier --check src \"**/*.{json,md,ts,tsx}\" && tsc --noEmit",
"lint:fix": "prettier --write src \"**/*.{json,md,ts,tsx}\" --log-level=warn && eslint . --fix",
"test": "vitest run --coverage",
"prepublishOnly": "npm run clean && npm run build:release"
},
"dependencies": {
"fast-querystring": "^1.1.2"
},
"peerDependencies": {
"wretch": "^2.8.0",
"zod": "^3.22.0"
},
"devDependencies": {
"@lokalise/prettier-config": "^1.0.0",
"@types/node": "^20.11.5",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@vitest/coverage-v8": "^2.0.1",
"jest-fail-on-console": "^3.1.2",
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-vitest": "^0.4.0",
"eslint-plugin-import-esm": "^2.0.0",
"mockttp": "^3.10.1",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"tsup": "8.1.0",
"typescript": "~5.5.3",
"vitest": "^2.0.1"
},
"keywords": [
"frontend",
"web",
"browser",
"http",
"client",
"zod",
"validation",
"typesafe"
],
"prettier": "@lokalise/prettier-config"
"name": "@lokalise/frontend-http-client",
"version": "2.1.0",
"description": "Opinionated HTTP client for the frontend",
"files": ["dist/**", "LICENSE", "README.md"],
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"module": "./dist/index.mjs",
"type": "module",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"author": {
"name": "Lokalise",
"url": "https://lokalise.com/"
},
"homepage": "https://github.com/lokalise/frontend-http-client",
"repository": {
"type": "git",
"url": "git://github.com/lokalise/frontend-http-client.git"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build:dev": "tsc",
"build:release": "tsup",
"clean": "rimraf dist",
"lint": "biome check . && tsc --project tsconfig.lint.json --noEmit",
"lint:fix": "biome check --write",
"test": "vitest run --coverage",
"prepublishOnly": "npm run clean && npm run build:release"
},
"dependencies": {
"fast-querystring": "^1.1.2"
},
"peerDependencies": {
"wretch": "^2.8.0",
"zod": "^3.22.0"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@lokalise/biome-config": "^1.0.0",
"@types/node": "^20.11.5",
"@vitest/coverage-v8": "^2.0.1",
"jest-fail-on-console": "^3.1.2",
"mockttp": "^3.13.0",
"rimraf": "^5.0.8",
"tsup": "8.1.0",
"typescript": "~5.5.3",
"vitest": "^2.0.1"
},
"keywords": ["frontend", "web", "browser", "http", "client", "zod", "validation", "typesafe"]
}
Loading
Loading