diff --git a/biome.json b/biome.json index 0b8114ee..d6313b39 100644 --- a/biome.json +++ b/biome.json @@ -1,31 +1,6 @@ { "$schema": "https://biomejs.dev/schemas/1.9.0/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", - "trailingCommas": "none" - } - }, + "extends": ["@arthurfiorette/biomejs-config"], "files": { "ignore": [ "build/**/*", diff --git a/package.json b/package.json index 0607a02a..ecbe38b9 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "author": "Arthur Fiorette ", "sideEffects": false, "type": "module", - "source": "./src/index.ts", "exports": { ".": { "require": "./dist/index.cjs", @@ -28,6 +27,7 @@ "jsdelivr": "./dist/index.bundle.js", "unpkg": "./dist/index.bundle.js", "module": "./dist/index.mjs", + "source": "./src/index.ts", "types": "./dist/index.d.ts", "scripts": { "benchmark": "cd benchmark && pnpm start", @@ -35,13 +35,13 @@ "docs:build": "vitepress build docs", "docs:dev": "vitepress dev docs --port 1227", "docs:serve": "vitepress serve docs", - "test": "c8 --reporter lcov --reporter text node --import ./test/setup.js --enable-source-maps --test test/**/*.test.ts", - "test:only": "c8 --reporter lcov --reporter text node --import ./test/setup.js --enable-source-maps --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:ci": "biome ci .", "lint:fix": "biome check --write --unsafe .", - "lint:ci": "biome ci ." + "test": "c8 --reporter lcov --reporter text node --import ./test/setup.js --enable-source-maps --test test/**/*.test.ts", + "test:only": "c8 --reporter lcov --reporter text node --import ./test/setup.js --enable-source-maps --test-only", + "version": "auto-changelog -p && cp CHANGELOG.md docs/src/others/changelog.md && git add CHANGELOG.md docs/src/others/changelog.md" }, "resolutions": { "colors": "1.4.0" @@ -52,6 +52,7 @@ "object-code": "1.3.3" }, "devDependencies": { + "@arthurfiorette/biomejs-config": "1.0.5", "@biomejs/biome": "1.9.4", "@swc-node/register": "1.9.0", "@swc/helpers": "0.5.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6c4f658e..e8b38905 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,6 +21,9 @@ importers: specifier: 1.3.3 version: 1.3.3 devDependencies: + '@arthurfiorette/biomejs-config': + specifier: 1.0.5 + version: 1.0.5 '@biomejs/biome': specifier: 1.9.4 version: 1.9.4 @@ -129,6 +132,9 @@ packages: resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} engines: {node: '>=6.0.0'} + '@arthurfiorette/biomejs-config@1.0.5': + resolution: {integrity: sha512-2+r6+zsme3IuIr3Vuba7oZyif748EYnFOPGm8kahY4AM8q9EzJZRWNfaAveuV0+PTrLaIhZPhUKIkAhg5JLQ5A==} + '@babel/code-frame@7.23.5': resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} @@ -3441,6 +3447,8 @@ snapshots: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.18 + '@arthurfiorette/biomejs-config@1.0.5': {} + '@babel/code-frame@7.23.5': dependencies: '@babel/highlight': 7.23.4 diff --git a/test/interceptors/request.test.ts b/test/interceptors/request.test.ts index 89667027..f456e4f8 100644 --- a/test/interceptors/request.test.ts +++ b/test/interceptors/request.test.ts @@ -2,10 +2,7 @@ import assert from 'node:assert'; import { describe, it, mock } from 'node:test'; import { setTimeout } from 'node:timers/promises'; import type { AxiosAdapter, AxiosResponse } from 'axios'; -import type { - CacheRequestConfig, - InternalCacheRequestConfig -} from '../../src/cache/axios.js'; +import type { CacheRequestConfig, InternalCacheRequestConfig } from '../../src/cache/axios.js'; import { Header } from '../../src/header/headers.js'; import { buildMemoryStorage } from '../../src/index.js'; import type { LoadingStorageValue } from '../../src/storage/types.js'; @@ -113,10 +110,7 @@ describe('Request Interceptor', () => { }); it('Cache expiration', async () => { - const axios = mockAxios( - {}, - { [Header.CacheControl]: 'max-age=1,stale-while-revalidate=10' } - ); + const axios = mockAxios({}, { [Header.CacheControl]: 'max-age=1,stale-while-revalidate=10' }); await axios.get('http://test.com', { cache: { interpretHeader: true } @@ -267,9 +261,7 @@ describe('Request Interceptor', () => { adapter: async (config: InternalCacheRequestConfig) => { await setTimeout(10); - const response = (await (axios.defaults.adapter as AxiosAdapter)( - config - )) as AxiosResponse; + const response = (await (axios.defaults.adapter as AxiosAdapter)(config)) as AxiosResponse; // Changes the response to be different from `true` (default) response.data = 'overridden response'; @@ -424,10 +416,7 @@ describe('Request Interceptor', () => { assert.equal(req1.cached, false); assert.equal(req1.stale, undefined); - const [req2, req3] = await Promise.all([ - axios.get('some-other'), - axios.get('some-other') - ]); + const [req2, req3] = await Promise.all([axios.get('some-other'), axios.get('some-other')]); assert.equal(req2.cached, false); assert.equal(req2.stale, undefined); @@ -449,20 +438,14 @@ describe('Request Interceptor', () => { assert.equal(req1.cached, false); assert.equal(req1.stale, undefined); - const [req2, req3] = await Promise.all([ - axios.get('some-other'), - axios.get('some-other') - ]); + const [req2, req3] = await Promise.all([axios.get('some-other'), axios.get('some-other')]); assert.equal(req2.cached, false); assert.equal(req2.stale, undefined); assert.ok(req3.cached); assert.equal(req3.stale, false); - const [req4, req5] = await Promise.all([ - axios.get('other/url'), - axios.get('other/url') - ]); + const [req4, req5] = await Promise.all([axios.get('other/url'), axios.get('other/url')]); assert.equal(req4.cached, false); assert.equal(req4.stale, undefined);