From daff6b3a34652f1128d29cb07bc7b56de0934c95 Mon Sep 17 00:00:00 2001 From: Manish Jethani Date: Fri, 13 Aug 2021 16:13:20 +0530 Subject: [PATCH] Add eslint dependency within Node.js package (#3813) --- Makefile | 6 ++---- platform/nodejs/{eslintrc.json => .eslintrc.json} | 0 platform/nodejs/package.json | 4 ++++ tools/make-nodejs.sh | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) rename platform/nodejs/{eslintrc.json => .eslintrc.json} (100%) diff --git a/Makefile b/Makefile index 40dee07e2..1e910700f 100644 --- a/Makefile +++ b/Makefile @@ -28,12 +28,10 @@ dist/build/uBlock0.nodejs: tools/make-nodejs.sh $(sources) $(platform) $(assets) nodejs: dist/build/uBlock0.nodejs lint: nodejs - eslint -c platform/nodejs/eslintrc.json \ - dist/build/uBlock0.nodejs/js \ - dist/build/uBlock0.nodejs/*.js + cd dist/build/uBlock0.nodejs && npm install && npm run lint test: nodejs - cd dist/build/uBlock0.nodejs && npm run test + cd dist/build/uBlock0.nodejs && npm install && npm run test # Update submodules. update-submodules: diff --git a/platform/nodejs/eslintrc.json b/platform/nodejs/.eslintrc.json similarity index 100% rename from platform/nodejs/eslintrc.json rename to platform/nodejs/.eslintrc.json diff --git a/platform/nodejs/package.json b/platform/nodejs/package.json index 15aafac93..fd38151b4 100644 --- a/platform/nodejs/package.json +++ b/platform/nodejs/package.json @@ -6,6 +6,7 @@ "main": "index.js", "scripts": { "build": "node build.js", + "lint": "eslint js/ *.js", "test": "node test.js" }, "repository": { @@ -27,5 +28,8 @@ "engines": { "node": ">=14.0.0", "npm": ">=6.14.4" + }, + "devDependencies": { + "eslint": "^7.32.0" } } diff --git a/tools/make-nodejs.sh b/tools/make-nodejs.sh index b9bd0fb47..85050ab4e 100755 --- a/tools/make-nodejs.sh +++ b/tools/make-nodejs.sh @@ -52,6 +52,7 @@ node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easylist.txt', 'utf8'))" \ node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easyprivacy.txt', 'utf8'))" \ > $DES/data/easyprivacy.json +cp platform/nodejs/.*.json $DES/ cp platform/nodejs/*.js $DES/ cp platform/nodejs/*.json $DES/ cp platform/nodejs/README.md $DES/