Skip to content

Commit 178dda5

Browse files
committedJul 20, 2024
Migrate eslint configuration, Fix formatting-check
1 parent 57f331b commit 178dda5

7 files changed

+81
-30
lines changed
 

‎.eslintrc.json

-24
This file was deleted.

‎Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ check-format: check-explicit-exports check-examples-imports check-whitespace
7979
@purs-tidy check ${ps-sources}
8080
@nixpkgs-fmt --check ${nix-sources}
8181
@prettier --log-level warn -c ${js-sources}
82-
@eslint --quiet ${js-sources} --parser-options 'sourceType: module'
82+
@eslint --quiet ${js-sources}
8383

8484
format:
8585
@purs-tidy format-in-place ${ps-sources}

‎eslint.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
4+
export default [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
globals: {
9+
...globals.browser,
10+
...globals.commonjs,
11+
...globals.es2021,
12+
...globals.node
13+
},
14+
15+
ecmaVersion: "latest",
16+
sourceType: "module"
17+
},
18+
19+
rules: {
20+
"no-var": 2,
21+
"no-case-declarations": 0,
22+
23+
"no-unused-vars": [
24+
"error",
25+
{
26+
argsIgnorePattern: "^_",
27+
caughtErrorsIgnorePattern: "^_",
28+
vars: "local"
29+
}
30+
]
31+
}
32+
}
33+
];

‎flake.nix

+8-3
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@
243243

244244
devShell = project.devShell;
245245

246+
nodeModules = project.nodeModules;
247+
246248
apps = {
247249
# TODO: restore this
248250
# https://github.com/Plutonomicon/cardano-transaction-lib/issues/1578
@@ -364,9 +366,9 @@
364366
checks = perSystem (system:
365367
let
366368
pkgs = nixpkgsFor system;
367-
369+
psProject = psProjectFor pkgs;
368370
in
369-
(psProjectFor pkgs).checks
371+
psProject.checks
370372
// {
371373
formatting-check = pkgs.runCommand "formatting-check"
372374
{
@@ -379,7 +381,10 @@
379381
];
380382
}
381383
''
382-
cd ${self}
384+
cd $TMPDIR
385+
ln -sfn ${psProject.nodeModules}/lib/node_modules node_modules
386+
cp -r ${self}/* .
387+
383388
make check-format
384389
touch $out
385390
'';

‎package-lock.json

+35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@
5050
"xhr2": "0.2.1"
5151
},
5252
"devDependencies": {
53+
"@eslint/js": "^9.7.0",
5354
"blakejs": "1.2.1",
54-
"jssha": "3.2.0",
5555
"buffer": "6.0.3",
5656
"doctoc": "^2.2.1",
5757
"esbuild": "0.18.11",
5858
"esbuild-plugin-polyfill-node": "^0.3.0",
5959
"esbuild-plugin-wasm": "^1.1.0",
60+
"globals": "^15.8.0",
61+
"jssha": "3.2.0",
6062
"node-polyfill-webpack-plugin": "2.0.1",
6163
"webpack": "5.88.1",
6264
"webpack-cli": "5.1.4",

‎scripts/whitespace-check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ files="
66
*.md
77
*.nix
88
*.dhall
9-
.eslintrc.json
9+
eslint.config.js
1010
.mlc_config.json
1111
.tidyrc.json
1212
LICENSE

0 commit comments

Comments
 (0)