Skip to content

Commit

Permalink
chore: update dependencies and migrate o vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Aug 21, 2024
1 parent 979c64c commit 7c9e22d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.yml

This file was deleted.

11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import cheminfo from 'eslint-config-cheminfo';

export default [
...cheminfo,
{
languageOptions: {
},
rules: {
}
}
]
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"compile": "rollup -c",
"eslint": "eslint src",
"eslint-fix": "npm run eslint -- --fix",
"prepack": "npm run compile",
"prepack": "npm run compile",
"prettier": "prettier --check src",
"prettier-write": "prettier --write src",
"test": "npm run test-only && npm run eslint && npm run prettier",
"test-only": "jest --coverage"
"test-only": "vitest run --coverage"
},
"repository": {
"type": "git",
Expand All @@ -33,11 +33,12 @@
"ml-hash-table": "^1.0.0"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@vitest/coverage-v8": "^2.0.5",
"eslint": "^8.10.0",
"eslint-config-cheminfo": "^7.2.2",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"rollup": "^2.69.0"
"eslint-config-cheminfo": "^11.1.1",
"prettier": "^3.3.3",
"rollup": "^4.21.0",
"vitest": "^2.0.5"
}
}
1 change: 1 addition & 0 deletions src/__tests__/test.js → src/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SparseMatrix } from '..';

Check warning on line 1 in src/__tests__/index.test.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

There should be at least one empty line between import groups
import { describe, it, expect } from 'vitest';

Check warning on line 2 in src/__tests__/index.test.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

`vitest` import should occur before import of `..`

describe('Sparse Matrix', () => {
it('mmul', () => {
Expand Down
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class SparseMatrix {

/**
* Search for the wither band in the main diagonals
* @return {number}
* @returns {number}

Check warning on line 89 in src/index.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @returns description
*/
bandWidth() {
let min = this.columns;
Expand All @@ -103,7 +103,7 @@ export class SparseMatrix {
/**
* Test if a matrix is consider banded using a threshold
* @param {number} width

Check warning on line 105 in src/index.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "width" description
* @return {boolean}
* @returns {boolean}

Check warning on line 106 in src/index.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @returns description
*/
isBanded(width) {
let bandWidth = this.bandWidth();
Expand Down Expand Up @@ -220,7 +220,7 @@ export class SparseMatrix {
}

/**

Check warning on line 222 in src/index.js

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc block description
* @return {SparseMatrix} - New transposed sparse matrix
* @returns {SparseMatrix} - New transposed sparse matrix
*/
transpose() {
let trans = new SparseMatrix(this.columns, this.rows, {
Expand Down Expand Up @@ -337,7 +337,7 @@ for (const operator of operators) {

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

[
for (const mathMethod of [
'abs',
'acos',
'acosh',
Expand Down Expand Up @@ -366,9 +366,9 @@ let methods = [['~', 'not']];
'tan',
'tanh',
'trunc',
].forEach((mathMethod) => {
]) {
methods.push([`Math.${mathMethod}`, mathMethod]);
});
}

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

function fillTemplateFunction(template, values) {
for (const i in values) {
template = template.replace(new RegExp(`%${i}%`, 'g'), values[i]);
template = template.replaceAll(new RegExp(`%${i}%`, 'g'), values[i]);
}
return template;
}

0 comments on commit 7c9e22d

Please sign in to comment.