Skip to content

Commit

Permalink
chore: migrated to biomejs.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Nov 16, 2023
1 parent f8db646 commit 37e2f1e
Show file tree
Hide file tree
Showing 18 changed files with 389 additions and 1,366 deletions.
21 changes: 0 additions & 21 deletions .eslintignore

This file was deleted.

21 changes: 0 additions & 21 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20.5.0
v20.9.0
14 changes: 0 additions & 14 deletions .prettierignore

This file was deleted.

5 changes: 0 additions & 5 deletions .prettierrc.js

This file was deleted.

27 changes: 23 additions & 4 deletions benchmark/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ const runs = {};
const app = require('express')();

app.get('/:name', ({ params }, res) => {
data[params.name] ? data[params.name]++ : (data[params.name] = 1);
if (data[params.name] === undefined) {
data[params.name] = 1;
} else {
data[params.name]++;
}

return res.json({
computation: Math.random(),
Expand All @@ -40,21 +44,36 @@ Benny.suite(

Benny.add('axios', async () => {
const name = 'axios';
runs[name] ? runs[name]++ : (runs[name] = 1);

if (runs[name] === undefined) {
runs[name] = 1;
} else {
runs[name]++;
}

await AxiosInstance.get(`http://${config.host}:${config.port}/${name}`);
}),

Benny.add('cache-interceptor', async () => {
const name = 'cache-interceptor';
runs[name] ? runs[name]++ : (runs[name] = 1);

if (runs[name] === undefined) {
runs[name] = 1;
} else {
runs[name]++;
}

await InterceptorInstance.get(`http://${config.host}:${config.port}/${name}`);
}),

Benny.add('cache-adapter', async () => {
const name = 'cache-adapter';
runs[name] ? runs[name]++ : (runs[name] = 1);

if (runs[name] === undefined) {
runs[name] = 1;
} else {
runs[name]++;
}

await AdapterInstance.get(`http://${config.host}:${config.port}/${name}`);
}),
Expand Down
40 changes: 40 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://biomejs.dev/schemas/1.3.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "off"
},
"suspicious": {
"noExplicitAny": "off"
}
}
},
"formatter": {
"lineWidth": 100,
"indentStyle": "space"
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingComma": "none"
}
},
"files": {
"ignore": [
"build/**/*",
"dist/**/*",
"dev/**/*",
"coverage/**/*",
"node_modules/**/*",
"pnpm-lock.json",
"docs/.vitepress/cache/**/*"
]
}
}
4 changes: 2 additions & 2 deletions build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const path = require('path');
const TerserWebpackPlugin = require('terser-webpack-plugin');
const { DefinePlugin } = require('webpack');
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment

const { version } = require('../package.json');

const COPYRIGHT = `
Expand Down Expand Up @@ -107,7 +107,7 @@ const config = ({
const assets = comp.assets[filename];

// @ts-expect-error - _value is not a public property
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands

assets._value = COPYRIGHT + '\n' + assets._value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/guide/storages.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const redisStorage = buildStorage({
// Or if the cached value cannot enter in stale state.
(value.state === 'stale' && value.ttl) ||
(value.state === 'cached' && !canStale(value))
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
?
value.createdAt + value.ttl!
: // otherwise, we can't determine when it should expire, so we keep
// it indefinitely.
Expand Down
27 changes: 11 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@
"docs:build": "vitepress build docs",
"docs:dev": "vitepress dev docs --port 1227",
"docs:serve": "vitepress serve docs",
"format": "prettier --write .",
"lint": "eslint . --ext .ts",
"test": "c8 --reporter lcov --reporter text node --trace-warnings -r tsx/cjs -r ./test/setup --enable-source-maps --trace-warnings --test test/**/*.test.ts",
"test:only": "c8 --reporter lcov --reporter text node --trace-warnings -r tsx/cjs -r ./test/setup --enable-source-maps --trace-warnings --test-only",
"version": "auto-changelog -p && cp CHANGELOG.md docs/src/others/changelog.md && git add CHANGELOG.md docs/src/others/changelog.md"
"test": "c8 --reporter lcov --reporter text node --trace-warnings -r @swc-node/register -r ./test/setup --enable-source-maps --trace-warnings --test test/**/*.test.ts",
"test:only": "c8 --reporter lcov --reporter text node --trace-warnings -r @swc-node/register -r ./test/setup --enable-source-maps --trace-warnings --test-only",
"version": "auto-changelog -p && cp CHANGELOG.md docs/src/others/changelog.md && git add CHANGELOG.md docs/src/others/changelog.md",
"format": "biome format --write .",
"lint": "biome check .",
"lint:fix": "biome check --apply-unsafe .",
"lint:ci": "biome ci ."
},
"resolutions": {
"colors": "1.4.0"
Expand All @@ -59,26 +61,19 @@
"object-code": "^1.3.0"
},
"devDependencies": {
"@arthurfiorette/prettier-config": "*",
"@biomejs/biome": "^1.3.3",
"@swc-node/register": "^1.6.8",
"@swc/helpers": "^0.5.3",
"@types/jsdom": "^21.1.2",
"@types/node": "^20.5.0",
"@types/webpack": "^5.28.1",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"auto-changelog": "^2.4.0",
"axios": "^1.4.0",
"c8": "^8.0.1",
"es-check": "^7.1.1",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.2.1",
"jsdom": "^22.1.0",
"prettier": "^2.8.8",
"prettier-plugin-jsdoc": "^0.4.2",
"prettier-plugin-organize-imports": "^3.2.2",
"ts-loader": "^9.4.3",
"tslib": "^2.5.3",
"tsx": "^4.1.2",
"typescript": "^5.1.3",
"vitepress": "1.0.0-rc.25",
"webpack": "^5.86.0",
Expand All @@ -87,7 +82,7 @@
"peerDependencies": {
"axios": "^1"
},
"packageManager": "pnpm@8.7.1",
"packageManager": "pnpm@8.10.2",
"engines": {
"node": ">=12"
},
Expand Down

0 comments on commit 37e2f1e

Please sign in to comment.