Skip to content

Commit 31f1094

Browse files
committed
chore: update dependencies and improve testing
1 parent deb36ca commit 31f1094

File tree

7 files changed

+36
-27
lines changed

7 files changed

+36
-27
lines changed

.github/workflows/nodejs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
name: Node.js CI
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
nodejs:
12+
# Documentation: https://github.com/zakodium/workflows#nodejs-ci
13+
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1

.ncurc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"dep": "prod,dev"
2+
"dep": "prod,dev",
3+
"reject": ["eslint"]
34
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import react from './index.js';
2+
3+
export default [...react];

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import cheminfoBase from 'eslint-config-cheminfo/base';
2+
23
import react from './base.js';
34

45
export default [...cheminfoBase, ...react];

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
"noRestrictedGlobals.js"
1414
],
1515
"scripts": {
16-
"test": "node test/test.js"
16+
"eslint": "eslint *.js test/test.js",
17+
"eslint-fix": "npm run eslint -- --fix",
18+
"prettier": "prettier --check .",
19+
"prettier-write": "prettier --write .",
20+
"test": "npm run test-only && npm run eslint && npm run prettier",
21+
"test-only": "node test/test.js"
1722
},
1823
"repository": {
1924
"type": "git",
@@ -27,18 +32,18 @@
2732
},
2833
"homepage": "https://github.com/cheminfo/eslint-config-cheminfo-react#readme",
2934
"dependencies": {
30-
"eslint-config-cheminfo": "^11.0.2",
31-
"eslint-plugin-react": "^7.34.3",
35+
"eslint-config-cheminfo": "^11.0.4",
36+
"eslint-plugin-react": "^7.35.0",
3237
"eslint-plugin-react-hooks": "^4.6.2",
33-
"eslint-plugin-react-refresh": "^0.4.7",
38+
"eslint-plugin-react-refresh": "^0.4.8",
3439
"globals": "^15.8.0"
3540
},
3641
"peerDependencies": {
3742
"eslint": "^8.57.0"
3843
},
3944
"devDependencies": {
4045
"eslint": "8.57.0",
41-
"prettier": "^3.3.2",
46+
"prettier": "^3.3.3",
4247
"react": "^18.3.1"
4348
}
4449
}

test/test.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
import assert from 'node:assert';
2-
import fs from 'node:fs';
3-
import util from 'node:util';
42

5-
import { Linter } from 'eslint';
3+
import { loadESLint } from 'eslint';
64

7-
import config from '../index.js';
5+
const ESLint = await loadESLint({ useFlatConfig: true });
6+
/** @type {import('eslint').ESLint} */
7+
const eslint = new ESLint();
88

9-
const linter = new Linter({ configType: 'flat' });
9+
const [okResult] = await eslint.lintFiles(['test/ok.jsx']);
1010

11-
function readTestFile(filename) {
12-
return fs.readFileSync(new URL(`./${filename}`, import.meta.url), 'utf8');
13-
}
14-
15-
function verifyTestFile(filename) {
16-
return linter.verify(readTestFile(filename), config, {
17-
filename: `test/${filename}`,
18-
});
19-
}
20-
21-
const okResult = verifyTestFile('ok.jsx');
22-
assert.strictEqual(
23-
okResult.length,
24-
0,
25-
`ok.jsx should have no error: ${util.inspect(okResult)}`,
26-
);
11+
assert.strictEqual(okResult.errorCount, 0, 'ok.jsx should have no error');

0 commit comments

Comments
 (0)