Skip to content

Commit

Permalink
feat: switch to biome for linting, added bun testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lmammino committed Feb 28, 2024
1 parent 96d9e04 commit b5d4bec
Show file tree
Hide file tree
Showing 19 changed files with 8,152 additions and 7,109 deletions.
16 changes: 6 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@ module.exports = {
env: {
es2020: true,
node: true,
jest: true
jest: true,
},
extends: [
'standard'
],
extends: ['standard'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 11,
sourceType: 'module'
sourceType: 'module',
},
plugins: [
'@typescript-eslint'
],
plugins: ['@typescript-eslint'],
ignorePatterns: ['dist/**.js'],
rules: {
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error'
}
'@typescript-eslint/no-unused-vars': 'error',
},
}
46 changes: 29 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,41 @@ jobs:
- name: Begin CI...
uses: actions/checkout@v4

- name: Use Node 20
- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Use Deno 1.x
uses: denolib/setup-deno@v2
with:
deno-version: v1.x

- name: Use cached node_modules
uses: actions/cache@v1
- uses: oven-sh/setup-bun@v1
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
nodeModules-
bun-version: latest

- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint (Biome)
run: pnpm run lint:biome
env:
CI: true

- name: Lint
run: yarn lint
- name: Lint (TypeScript)
run: pnpm run lint:ts
env:
CI: true

- name: Test
run: yarn test --ci --coverage --maxWorkers=2
- name: Test (Node.js)
run: pnpm run test:node
env:
CI: true

Expand All @@ -48,15 +53,22 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info

- name: test with Deno
run: deno test test/deno.ts
- name: Test (Deno)
run: pnpm run test:deno
env:
CI: true

- name: Test (Bun)
run: pnpm run test:bun
env:
CI: true

- name: Build
run: yarn build
run: pnpm run build:ts
env:
CI: true

- name: Build (docs)
run: yarn run build:docs
run: pnpm run build:docs
env:
CI: true
24 changes: 10 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,27 @@ jobs:
- name: Begin CI...
uses: actions/checkout@v4

- name: Use Node 20
uses: actions/setup-node@v4
- uses: pnpm/action-setup@v2
with:
node-version: 20.x
version: 8

- name: Use cached node_modules
uses: actions/cache@v1
- name: Use Node 20.x
uses: actions/setup-node@v4
with:
path: node_modules
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
nodeModules-
node-version: 20.x
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install dependencies
run: yarn install --frozen-lockfile
env:
CI: true
run: pnpm install --frozen-lockfile

- name: Build (docs)
run: yarn run build:docs
run: pnpm run build:docs
env:
CI: true

- name: Publish on NPM
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc && npm publish
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc && pnpm publish

- name: Publish on JSR
run: npx jsr publish
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ node_modules/
dist/
docs/
coverage/
.npmrc
.npmrc
src/*.js
test/*.js
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false
}
49 changes: 49 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"nursery": {
"all": true,
"noNodejsModules": "off",
"noUnusedImports": "warn"
},
"correctness": {
"all": true
}
},
"ignore": [
"coverage/",
"dist/",
"node_modules/"
]
},
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"ignore": [
"coverage/",
"dist/",
"node_modules/"
]
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single"
}
"globals": [
"Deno",
"describe",
"test",
"expect"
]
}
}
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
52 changes: 52 additions & 0 deletions deno.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": "3",
"redirects": {
"https://deno.land/std/assert/mod.ts": "https://deno.land/std@0.217.0/assert/mod.ts",
"https://deno.land/std/testing/asserts.ts": "https://deno.land/std@0.217.0/testing/asserts.ts"
},
"remote": {
"https://deno.land/std@0.217.0/assert/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975",
"https://deno.land/std@0.217.0/assert/_diff.ts": "dcc63d94ca289aec80644030cf88ccbf7acaa6fbd7b0f22add93616b36593840",
"https://deno.land/std@0.217.0/assert/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4",
"https://deno.land/std@0.217.0/assert/assert.ts": "bec068b2fccdd434c138a555b19a2c2393b71dfaada02b7d568a01541e67cdc5",
"https://deno.land/std@0.217.0/assert/assert_almost_equals.ts": "8b96b7385cc117668b0720115eb6ee73d04c9bcb2f5d2344d674918c9113688f",
"https://deno.land/std@0.217.0/assert/assert_array_includes.ts": "1688d76317fd45b7e93ef9e2765f112fdf2b7c9821016cdfb380b9445374aed1",
"https://deno.land/std@0.217.0/assert/assert_equals.ts": "4497c56fe7d2993b0d447926702802fc0becb44e319079e8eca39b482ee01b4e",
"https://deno.land/std@0.217.0/assert/assert_exists.ts": "24a7bf965e634f909242cd09fbaf38bde6b791128ece08e33ab08586a7cc55c9",
"https://deno.land/std@0.217.0/assert/assert_false.ts": "6f382568e5128c0f855e5f7dbda8624c1ed9af4fcc33ef4a9afeeedcdce99769",
"https://deno.land/std@0.217.0/assert/assert_greater.ts": "4945cf5729f1a38874d7e589e0fe5cc5cd5abe5573ca2ddca9d3791aa891856c",
"https://deno.land/std@0.217.0/assert/assert_greater_or_equal.ts": "573ed8823283b8d94b7443eb69a849a3c369a8eb9666b2d1db50c33763a5d219",
"https://deno.land/std@0.217.0/assert/assert_instance_of.ts": "72dc1faff1e248692d873c89382fa1579dd7b53b56d52f37f9874a75b11ba444",
"https://deno.land/std@0.217.0/assert/assert_is_error.ts": "6596f2b5ba89ba2fe9b074f75e9318cda97a2381e59d476812e30077fbdb6ed2",
"https://deno.land/std@0.217.0/assert/assert_less.ts": "2b4b3fe7910f65f7be52212f19c3977ecb8ba5b2d6d0a296c83cde42920bb005",
"https://deno.land/std@0.217.0/assert/assert_less_or_equal.ts": "b93d212fe669fbde959e35b3437ac9a4468f2e6b77377e7b6ea2cfdd825d38a0",
"https://deno.land/std@0.217.0/assert/assert_match.ts": "ec2d9680ed3e7b9746ec57ec923a17eef6d476202f339ad91d22277d7f1d16e1",
"https://deno.land/std@0.217.0/assert/assert_not_equals.ts": "ac86413ab70ffb14fdfc41740ba579a983fe355ba0ce4a9ab685e6b8e7f6a250",
"https://deno.land/std@0.217.0/assert/assert_not_instance_of.ts": "8f720d92d83775c40b2542a8d76c60c2d4aeddaf8713c8d11df8984af2604931",
"https://deno.land/std@0.217.0/assert/assert_not_match.ts": "b4b7c77f146963e2b673c1ce4846473703409eb93f5ab0eb60f6e6f8aeffe39f",
"https://deno.land/std@0.217.0/assert/assert_not_strict_equals.ts": "da0b8ab60a45d5a9371088378e5313f624799470c3b54c76e8b8abeec40a77be",
"https://deno.land/std@0.217.0/assert/assert_object_match.ts": "e85e5eef62a56ce364c3afdd27978ccab979288a3e772e6855c270a7b118fa49",
"https://deno.land/std@0.217.0/assert/assert_rejects.ts": "e9e0c8d9c3e164c7ac962c37b3be50577c5a2010db107ed272c4c1afb1269f54",
"https://deno.land/std@0.217.0/assert/assert_strict_equals.ts": "0425a98f70badccb151644c902384c12771a93e65f8ff610244b8147b03a2366",
"https://deno.land/std@0.217.0/assert/assert_string_includes.ts": "dfb072a890167146f8e5bdd6fde887ce4657098e9f71f12716ef37f35fb6f4a7",
"https://deno.land/std@0.217.0/assert/assert_throws.ts": "edddd86b39606c342164b49ad88dd39a26e72a26655e07545d172f164b617fa7",
"https://deno.land/std@0.217.0/assert/assertion_error.ts": "9f689a101ee586c4ce92f52fa7ddd362e86434ffdf1f848e45987dc7689976b8",
"https://deno.land/std@0.217.0/assert/equal.ts": "fae5e8a52a11d3ac694bbe1a53e13a7969e3f60791262312e91a3e741ae519e2",
"https://deno.land/std@0.217.0/assert/fail.ts": "f310e51992bac8e54f5fd8e44d098638434b2edb802383690e0d7a9be1979f1c",
"https://deno.land/std@0.217.0/assert/mod.ts": "325df8c0683ad83a873b9691aa66b812d6275fc9fec0b2d180ac68a2c5efed3b",
"https://deno.land/std@0.217.0/assert/unimplemented.ts": "47ca67d1c6dc53abd0bd729b71a31e0825fc452dbcd4fde4ca06789d5644e7fd",
"https://deno.land/std@0.217.0/assert/unreachable.ts": "38cfecb95d8b06906022d2f9474794fca4161a994f83354fd079cac9032b5145",
"https://deno.land/std@0.217.0/fmt/colors.ts": "d239d84620b921ea520125d778947881f62c50e78deef2657073840b8af9559a",
"https://deno.land/std@0.217.0/testing/asserts.ts": "0cb9c745d9b157bed062a4aa8647168d2221f6456c385a548b0ca24de9e0f3ca"
},
"workspace": {
"packageJson": {
"dependencies": [
"npm:@biomejs/biome@^1.5.3",
"npm:dts-cli@^2.0.4",
"npm:typedoc@^0.25.9",
"npm:typescript@^5.3.3"
]
}
}
}
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"name": "@lmammino/financial",
"version": "0.1.3",
"exports": "./src/index.ts"
}
}
40 changes: 13 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,27 @@
"typings": "dist/index.d.ts",
"module": "dist/financial.esm.js",
"engines": {
"node": ">=12"
"node": ">=18"
},
"files": [
"dist",
"src"
],
"scripts": {
"start": "tsdx watch",
"build": "tsdx build",
"build:ts": "dts build",
"build:docs": "typedoc --out docs/ src/",
"test": "tsdx test --coverage",
"test:watch": "tsdx test --watch",
"lint": "tsdx lint",
"prepare": "tsdx build"
},
"peerDependencies": {},
"husky": {
"hooks": {
"pre-commit": "tsdx lint"
}
"lint:biome": "biome lint . && biome format .",
"lint:ts": "tsc --noEmit src/index.ts",
"test:node": "dts test",
"test:deno": "deno test test/deno.ts",
"test:bun": "bun test test/bun.test.ts"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"eslint": "^7.3.1",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^4.2.5",
"tsdx": "^0.13.2",
"tslib": "^2.0.0",
"typedoc": "^0.17.7",
"typescript": "^3.9.5"
"@biomejs/biome": "^1.5.3",
"@types/jest": "^29.5.12",
"dts-cli": "^2.0.4",
"typedoc": "^0.25.9",
"typescript": "^5.3.3"
},
"keywords": [
"financial",
Expand All @@ -68,4 +54,4 @@
"npv",
"mirr"
]
}
}
Loading

0 comments on commit b5d4bec

Please sign in to comment.