Skip to content

Commit

Permalink
Node 20, iso-bench, bump dev deps
Browse files Browse the repository at this point in the history
  • Loading branch information
KillyMXI committed Dec 24, 2024
1 parent b069d7a commit 633dd49
Show file tree
Hide file tree
Showing 11 changed files with 1,961 additions and 5,088 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
"sourceType": "module",
"ecmaVersion": 2020
},
"rules": {
"indent": ["error", 2]
},
"rules": {},
"overrides": [
{
"files": ["**/*.ts"],
Expand All @@ -30,6 +28,7 @@
"project": ["./tsconfig.eslint.json"]
},
"plugins": [
"@stylistic",
"@typescript-eslint",
"eslint-plugin-tsdoc"
],
Expand All @@ -39,6 +38,7 @@
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@stylistic/indent": ["error", 2],
"tsdoc/syntax": "error"
}
},
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [20.x, 22.x]
os: [ubuntu-latest, windows-latest]
test-set: [ava]

Expand All @@ -31,10 +31,10 @@ jobs:
run: npm run test-cover:${{ matrix.test-set }}

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/lcov.info
files: ./coverage/lcov.info
flags: unit,${{ matrix.test-set }},${{ matrix.os }}
fail_ci_if_error: true
verbose: true
3 changes: 2 additions & 1 deletion .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"default": true,
"first-line-heading": false,
"line-length": false,
"no-duplicate-header": { "allow_different_nesting": true }
"no-duplicate-header": { "allow_different_nesting": true },
"no-emphasis-as-heading": false
},
"globs": [ "**/*.md" ],
"gitignore": true
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This template is aimed for Node.js packages development.

## Node.js

Node 18 is the target version.
Node 20 is the target version.

<https://nodejs.org/en/about/releases/>

Expand Down Expand Up @@ -41,7 +41,7 @@ Alternative TypeScript plugin with some extra features: <https://github.com/ezol

## concurrently

[Concurrently](https://github.com/open-cli-tools/concurrently) is the closest substitute for `npm-run-all` that is not abandoned.
[Concurrently](https://github.com/open-cli-tools/concurrently) is a substitute for `npm-run-all` that is not abandoned.

Sequential run can be achieved with `-m 1` arg.

Expand All @@ -53,7 +53,7 @@ ESlint with TypeScript plugin is currently the preferred way to lint `.ts` files

Only recommended configs are included with the template, with a minimal set of overrides (same applies to all linting tools).

Rules: <https://eslint.org/docs/rules/>
Rules: <https://eslint.org/docs/rules/> and <https://eslint.style/rules>

Various plugins can conflict with each other so it's a good idea to usee `overrides` in `.eslintrc.json` to keep configuration for different file types separate.

Expand Down Expand Up @@ -111,6 +111,10 @@ More notes on TypeScript support: <https://github.com/avajs/ava/blob/master/docs

A common observation about type testing: it is not well compatible with unit testing. The best approach I see is to keep it separate and just run `tsc --noEmit` over it.

## iso-bench

<https://github.com/Llorx/iso-bench> seems to be a benchmarking library that is most alive and reliable. Benny is simply dead by now and has unresolved issues.

## onchange

Many tools come with their own watchers, others don't. <https://github.com/Qard/onchange> seems to be the most straightforward solution to add this feature where it is missing.
Expand Down
13 changes: 13 additions & 0 deletions benchmarks/benchmark.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { IsoBench } from 'iso-bench';
import { add } from '../lib/index.mjs';

const bench = new IsoBench('My bench');
bench
.add('add by function', () => {
add(1, 2);
})
.add('add by operator', () => {
1 + 2;
})
.consoleLog()
.run();
14 changes: 14 additions & 0 deletions benchmarks/benchmark.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { IsoBench } from 'iso-bench';
import { add } from '../src/index.ts';

const bench = new IsoBench('My bench');
await bench
.add('add by function', () => {
add(1, 2);
})
.add('add by operator', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
1 + 2;
})
.consoleLog()
.run();
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
**yet-another-typescript-package-template****Docs**
**yet-another-typescript-package-template**

***

Expand All @@ -17,7 +17,7 @@ Add two numbers.
#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| ------ | ------ | ------ |
| `a` | `number` | first number. |
| `b` | `number` | second number. |

Expand Down
Loading

0 comments on commit 633dd49

Please sign in to comment.