Skip to content

Commit

Permalink
feat: updating library to node 22 (#74)
Browse files Browse the repository at this point in the history
* feat: updating library to node 22

* refactor: fixing sonar issues
  • Loading branch information
Farenheith authored Sep 20, 2024
1 parent a56a9eb commit 92a7bc4
Show file tree
Hide file tree
Showing 85 changed files with 11,808 additions and 5,249 deletions.
129 changes: 126 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,129 @@
module.exports = {
extends: require.resolve('@codibre/confs/.eslintrc.js'),
env: {
browser: true,
es6: true,
node: true,
},
overrides: [{
files: ['test/*.ts', 'test/**/*.ts'],
rules: {
'no-magic-numbers': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
}, ],
ignorePatterns: ['dist/**', 'build/**', 'bin/**', 'templates/**', '*.py', ".eslintrc.js", "babel.config.js", "jest.config.js"],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.json'],
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'unused-imports'],
rules: {
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/no-explicit-any': 'off',
}
}
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
},
],
'@typescript-eslint/semi': ['error', 'always'],
camelcase: 'error',
'comma-dangle': ['error', 'always-multiline'],
complexity: [
'off',
{
max: 11,
},
],
curly: ['error', 'multi-line'],
'default-case': 'error',
'eol-last': 'error',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-blacklist': 'error',
'id-match': 'error',
'linebreak-style': ['error', 'unix'],
'max-classes-per-file': ['off', 1],
'max-lines': ['off', 300],
'new-parens': 'error',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'off',
'no-constant-condition': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-empty': 'error',
'no-eval': 'error',
'no-fallthrough': 'error',
'no-invalid-regexp': 'error',
'no-invalid-this': 'off',
'no-magic-numbers': [
'error',
{
ignore: [0, 1, -1],
},
],
'no-multiple-empty-lines': [
'error',
{
max: 2,
},
],
'no-new-wrappers': 'error',
'no-redeclare': 'off',
"@typescript-eslint/no-redeclare": ["error"],
'no-regex-spaces': 'error',
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
'no-throw-literal': 'error',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports-ts': 'error',
'unused-imports/no-unused-vars-ts': [
'error',
{ 'vars': 'all', 'varsIgnorePattern': '^_', 'args': 'after-used', 'argsIgnorePattern': '^_' }
],
'prefer-const': [
'error',
{
destructuring: 'any',
},
],
'quote-props': ['error', 'as-needed'],
radix: 'error',
'spaced-comment': [
'error',
'always',
{
markers: ['/'],
},
],
'use-isnan': 'error',
},
};
6 changes: 4 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x, 18.x]
node-version: [22.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -20,4 +20,6 @@ jobs:
- name: install
run: npm ci
- name: "Benchmark"
run: npm run test:benchmark
run: |
npm run build
npm run test:benchmark
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x]
node-version: [22.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Use Node.js
with:
node-version: 22
uses: actions/setup-node@v1
- name: install
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: "10.x"
node-version: "22.x"
- run: printf "//`node -p \"require('url').parse('https://registry.npmjs.org').host\"`/:_authToken=${NPM_TOKEN}\n" >> ~/.npmrc
- run: npm ci
- run: npm run build --if-present
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
node-version: [22.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node-version: [16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
4 changes: 0 additions & 4 deletions .mocharc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
22
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ Here a some results we got comparing to another similar options on node 16:

| Library | Ops/sec | Margin | Ran samples |
| ------- | ------- | ----------- | ----------- |
| **fluent** | 293 | ±0.29% | 92 |
| [iterare](https://www.npmjs.com/package/iterare ) | 259 | ±0.18% | 87 |
| [iter-tools](https://www.npmjs.com/package/iter-tools-es ) | 156 | ±0.21% | 88 |
| [rxjs](https://www.npmjs.com/package/rxjs) | 126 | ±0.45% | 80 |
| native generators | 97.98 | ±0.27% | 74 |
| native array operations chain | 42.60 | ±2.30% | 56 |
| **fluent** | 473 | ±0.99% | 91 |
| [iterare](https://www.npmjs.com/package/iterare ) | 438 | ±0.39% | 88 |
| native builtin iterator | 312 | ±0.41% | 93 |
| [iter-tools](https://www.npmjs.com/package/iter-tools-es ) | 242 | ±0.39% | 88 |
| [rxjs](https://www.npmjs.com/package/rxjs) | 197 | ±1.02% | 84 |
| native generators | 156 | ±0.57% | 81 |
| native array operations chain | 68.95 | ±1.69% | 71 |

You can check the benchmark code [here](./test-benchmark/general-benchmark.spec.ts)

Expand Down
26 changes: 26 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
module.exports = {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"testRegex": ".spec.ts$",
transform: {
"^.+.tsx?$": ["ts-jest",{}],
},
preset: 'ts-jest',
"coverageDirectory": "./coverage",
"collectCoverageFrom": [
"./src/**/*.ts"
],
"testEnvironment": "node",
"setupFilesAfterEnv": [
"jest-extended/all",
"./test/jest-setup.ts"
],
"moduleNameMapper": {
"^src/(.*)": "<rootDir>/src/$1",
"^test/(.*)": "<rootDir>/test/$1"
}
}
Loading

0 comments on commit 92a7bc4

Please sign in to comment.