Skip to content

Commit 7c9e22d

Browse files
committed
chore: update dependencies and migrate o vitest
1 parent 979c64c commit 7c9e22d

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

.eslintrc.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import cheminfo from 'eslint-config-cheminfo';
2+
3+
export default [
4+
...cheminfo,
5+
{
6+
languageOptions: {
7+
},
8+
rules: {
9+
}
10+
}
11+
]

package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"compile": "rollup -c",
1313
"eslint": "eslint src",
1414
"eslint-fix": "npm run eslint -- --fix",
15-
"prepack": "npm run compile",
15+
"prepack": "npm run compile",
1616
"prettier": "prettier --check src",
1717
"prettier-write": "prettier --write src",
1818
"test": "npm run test-only && npm run eslint && npm run prettier",
19-
"test-only": "jest --coverage"
19+
"test-only": "vitest run --coverage"
2020
},
2121
"repository": {
2222
"type": "git",
@@ -33,11 +33,12 @@
3333
"ml-hash-table": "^1.0.0"
3434
},
3535
"devDependencies": {
36-
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
36+
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
37+
"@vitest/coverage-v8": "^2.0.5",
3738
"eslint": "^8.10.0",
38-
"eslint-config-cheminfo": "^7.2.2",
39-
"jest": "^27.5.1",
40-
"prettier": "^2.5.1",
41-
"rollup": "^2.69.0"
39+
"eslint-config-cheminfo": "^11.1.1",
40+
"prettier": "^3.3.3",
41+
"rollup": "^4.21.0",
42+
"vitest": "^2.0.5"
4243
}
4344
}

src/__tests__/test.js renamed to src/__tests__/index.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { SparseMatrix } from '..';
2+
import { describe, it, expect } from 'vitest';
23

34
describe('Sparse Matrix', () => {
45
it('mmul', () => {

src/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class SparseMatrix {
8686

8787
/**
8888
* Search for the wither band in the main diagonals
89-
* @return {number}
89+
* @returns {number}
9090
*/
9191
bandWidth() {
9292
let min = this.columns;
@@ -103,7 +103,7 @@ export class SparseMatrix {
103103
/**
104104
* Test if a matrix is consider banded using a threshold
105105
* @param {number} width
106-
* @return {boolean}
106+
* @returns {boolean}
107107
*/
108108
isBanded(width) {
109109
let bandWidth = this.bandWidth();
@@ -220,7 +220,7 @@ export class SparseMatrix {
220220
}
221221

222222
/**
223-
* @return {SparseMatrix} - New transposed sparse matrix
223+
* @returns {SparseMatrix} - New transposed sparse matrix
224224
*/
225225
transpose() {
226226
let trans = new SparseMatrix(this.columns, this.rows, {
@@ -337,7 +337,7 @@ for (const operator of operators) {
337337

338338
let methods = [['~', 'not']];
339339

340-
[
340+
for (const mathMethod of [
341341
'abs',
342342
'acos',
343343
'acosh',
@@ -366,9 +366,9 @@ let methods = [['~', 'not']];
366366
'tan',
367367
'tanh',
368368
'trunc',
369-
].forEach((mathMethod) => {
369+
]) {
370370
methods.push([`Math.${mathMethod}`, mathMethod]);
371-
});
371+
}
372372

373373
for (const method of methods) {
374374
for (let i = 1; i < method.length; i++) {
@@ -386,7 +386,7 @@ for (const method of methods) {
386386

387387
function fillTemplateFunction(template, values) {
388388
for (const i in values) {
389-
template = template.replace(new RegExp(`%${i}%`, 'g'), values[i]);
389+
template = template.replaceAll(new RegExp(`%${i}%`, 'g'), values[i]);
390390
}
391391
return template;
392392
}

0 commit comments

Comments
 (0)