From 1e378c0b1582e35b53a3e786698b74eeb6780179 Mon Sep 17 00:00:00 2001 From: RedYetiDev <38299977+RedYetiDev@users.noreply.github.com> Date: Tue, 6 Aug 2024 14:07:35 -0400 Subject: [PATCH] (review changes) --- .github/dependabot.yml | 8 +++++ .github/workflows/tools.yml | 9 ------ .gitignore | 1 + LICENSE | 23 -------------- Makefile | 16 +++++----- tools/dep_updaters/update-eslint.sh | 49 ----------------------------- tools/license-builder.sh | 2 -- vcbuild.bat | 10 +++++- 8 files changed, 25 insertions(+), 93 deletions(-) delete mode 100755 tools/dep_updaters/update-eslint.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7a47cbcadc9d26..976330649e1f31 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,11 @@ updates: commit-message: prefix: meta open-pull-requests-limit: 10 + + - package-ecosystem: npm + directory: /tools/eslint + schedule: + interval: monthly + commit-message: + prefix: tools + open-pull-requests-limit: 10 diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index 8ac8cd6be6b5c0..a10c4afb3f638d 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -22,7 +22,6 @@ on: - cjs-module-lexer - corepack - doc - - eslint - github_reporter - googletest - gyp-next @@ -137,14 +136,6 @@ jobs: npm install --ignore-scripts $NEW_VERSION npm install --ignore-scripts fi - - id: eslint - subsystem: tools - label: tools - run: | - ./tools/dep_updaters/update-eslint.sh > temp-output - cat temp-output - tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true - rm temp-output - id: github_reporter subsystem: tools label: tools diff --git a/.gitignore b/.gitignore index fad2496b978066..08a9e6e24e7e85 100644 --- a/.gitignore +++ b/.gitignore @@ -112,6 +112,7 @@ tools/*/*.i.tmp /node_modules /tools/doc/node_modules /tools/clang-format/node_modules +/tools/eslint/node_modules # === Rules for test artifacts === /*.tap diff --git a/LICENSE b/LICENSE index 1daa041f0cf188..fa6a5451e82f04 100644 --- a/LICENSE +++ b/LICENSE @@ -2028,29 +2028,6 @@ The externally maintained libraries used by Node.js are: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ -- ESLint, located at tools/eslint/node_modules/eslint, is licensed as follows: - """ - Copyright OpenJS Foundation and other contributors, - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - """ - - gtest, located at deps/googletest, is licensed as follows: """ Copyright 2008, Google Inc. diff --git a/Makefile b/Makefile index 79fccce98f5040..e6a4f523144908 100644 --- a/Makefile +++ b/Makefile @@ -1384,8 +1384,11 @@ run-lint-js = tools/eslint/node_modules/eslint/bin/eslint.js --cache \ --max-warnings=0 --report-unused-disable-directives $(LINT_JS_TARGETS) run-lint-js-fix = $(run-lint-js) --fix +tools/.jslintstamp: + cd tools/eslint && $(call available-node,$(run-npm-ci)) + .PHONY: lint-js-fix -lint-js-fix: +lint-js-fix: tools/.jslintstamp @$(call available-node,$(run-lint-js-fix)) .PHONY: lint-js @@ -1393,7 +1396,7 @@ lint-js-fix: # Note that on the CI `lint-js-ci` is run instead. # Lints the JavaScript code with eslint. lint-js-doc: LINT_JS_TARGETS=doc -lint-js lint-js-doc: +lint-js lint-js-doc: tools/.jslintstamp @if [ "$(shell $(node_use_openssl))" != "true" ]; then \ echo "Skipping $@ (no crypto)"; \ else \ @@ -1410,7 +1413,7 @@ run-lint-js-ci = tools/eslint/node_modules/eslint/bin/eslint.js \ .PHONY: lint-js-ci # On the CI the output is emitted in the TAP format. -lint-js-ci: +lint-js-ci: tools/.jslintstamp $(info Running JS linter...) @$(call available-node,$(run-lint-js-ci)) @@ -1564,7 +1567,6 @@ lint-yaml: .PHONY: lint .PHONY: lint-ci -ifneq ("","$(wildcard tools/eslint/node_modules/eslint/)") lint: ## Run JS, C++, MD and doc linters. @EXIT_STATUS=0 ; \ $(MAKE) lint-js || EXIT_STATUS=$$? ; \ @@ -1585,16 +1587,12 @@ lint-ci: lint-js-ci lint-cpp lint-py lint-md lint-addon-docs lint-yaml-build lin echo "Conflict marker detected in one or more files. Please fix them first." >&2 ; \ exit 1 ; \ fi -else -lint lint-ci: - $(info Linting is not available through the source tarball.) - $(info Use the git repo instead: $$ git clone https://github.com/nodejs/node.git) -endif .PHONY: lint-clean lint-clean: $(RM) tools/.*lintstamp $(RM) .eslintcache + $(RM) -r tools/eslint/node_modules HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0) diff --git a/tools/dep_updaters/update-eslint.sh b/tools/dep_updaters/update-eslint.sh deleted file mode 100755 index 755aea3bbaef9e..00000000000000 --- a/tools/dep_updaters/update-eslint.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# Shell script to update ESLint in the source tree to the latest release. - -# This script must be in the tools directory when it runs because it uses the -# script source file path to determine directories to work in. - -set -ex - -ROOT=$(cd "$(dirname "$0")/../.." && pwd) - -[ -z "$NODE" ] && NODE="$ROOT/out/Release/node" -[ -x "$NODE" ] || NODE=$(command -v node) -NPM="$ROOT/deps/npm/bin/npm-cli.js" - -# shellcheck disable=SC1091 -. "$ROOT/tools/dep_updaters/utils.sh" - -NEW_VERSION=$("$NODE" "$NPM" view eslint dist-tags.latest) -CURRENT_VERSION=$("$NODE" -p "require('./tools/eslint/node_modules/eslint/package.json').version") - -# This function exit with 0 if new version and current version are the same -compare_dependency_version "eslint" "$NEW_VERSION" "$CURRENT_VERSION" - -cd "$( dirname "$0" )" || exit -rm -rf ../eslint/node_modules ../eslint/package-lock.json - -cd ../eslint -"$NODE" "$NPM" install \ - --ignore-scripts \ - --no-bin-links \ - "eslint@$NEW_VERSION" \ - eslint-formatter-tap \ - eslint-plugin-jsdoc \ - eslint-plugin-markdown \ - globals \ - @babel/core \ - @babel/eslint-parser \ - @babel/plugin-syntax-import-attributes \ - @stylistic/eslint-plugin-js - -# Use dmn to remove some unneeded files. -"$NODE" "$NPM" exec --package=dmn@3.0.1 --yes -- dmn -f clean -# TODO: Get this into dmn. -find node_modules \( -name .package-lock.json -or -name 'README*' \) -exec rm {} \; - -# The last line of the script should always print the new version, -# as we need to add it to $GITHUB_ENV variable. -echo "NEW_VERSION=$NEW_VERSION" diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 835cf3ce6a5fe5..cf9b7bcf6dec01 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -109,8 +109,6 @@ licenseText="$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' "${rootdir}/tools/cppl addlicense "cpplint.py" "tools/cpplint.py" "$licenseText" licenseText="$(sed -e '/^$/,$d' -e 's/^#$//' -e 's/^# //' "${rootdir}/tools/gypi_to_gn.py" | tail -n +3)" addlicense "gypi_to_gn.py" "tools/gypi_to_gn.py" "$licenseText" -licenseText="$(cat "${rootdir}/tools/eslint/node_modules/eslint/LICENSE")" -addlicense "ESLint" "tools/eslint/node_modules/eslint" "$licenseText" licenseText="$(cat "${rootdir}/deps/googletest/LICENSE")" addlicense "gtest" "deps/googletest" "$licenseText" diff --git a/vcbuild.bat b/vcbuild.bat index 3617bf9073307d..1f73851d6eaab5 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -41,6 +41,7 @@ set msi= set upload= set licensertf= set lint_js= +set lint_js_build= set lint_js_fix= set lint_cpp= set lint_md= @@ -116,6 +117,7 @@ if /i "%1"=="test-v8-benchmarks" set test_v8_benchmarks=1&set custom_v8_test=1&g if /i "%1"=="test-v8-all" set test_v8=1&set test_v8_intl=1&set test_v8_benchmarks=1&set custom_v8_test=1&goto arg-ok if /i "%1"=="lint-cpp" set lint_cpp=1&goto arg-ok if /i "%1"=="lint-js" set lint_js=1&goto arg-ok +if /i "%1"=="lint-js-build" set lint_js_build=1&goto arg-ok if /i "%1"=="lint-js-fix" set lint_js_fix=1&goto arg-ok if /i "%1"=="jslint" set lint_js=1&echo Please use lint-js instead of jslint&goto arg-ok if /i "%1"=="lint-md" set lint_md=1&goto arg-ok @@ -729,7 +731,13 @@ goto lint-js :run-make-lint %NODEJS_MAKE% lint-cpp -goto lint-js +goto lint-js-build + +:lint-js-build +if not defined lint_js_build if not defined lint_js if not defined lint_js_fix goto lint-md-build +cd tools\eslint +%npm_exe% ci +cd ..\.. :lint-js if not defined lint_js goto lint-js-fix