Skip to content

Commit

Permalink
tools: make update-eslint.sh work with npm@9
Browse files Browse the repository at this point in the history
Make the `update-eslint.sh` script work with `npm@9`.

PR-URL: #46088
Refs: https://github.com/nodejs/node/actions/runs/3814364920/jobs/6488613583#step:3:64
Reviewed-By: Ruy Adorno <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
lpinca authored and juanarbol committed Jan 31, 2023
1 parent d8ce990 commit 609df01
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions tools/update-eslint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,41 @@ rm -rf node_modules/eslint

"$NODE" "$NPM" init --yes

"$NODE" "$NPM" install --global-style --no-bin-links --ignore-scripts eslint
# Uninstall plugins that we want to install so that they are removed from devDependencies.
# Otherwise --production will cause them to be skipped.
(cd node_modules/eslint && "$NODE" "$NPM" uninstall --ignore-scripts eslint-plugin-jsdoc eslint-plugin-markdown @babel/core @babel/eslint-parser @babel/plugin-syntax-import-assertions)
(cd node_modules/eslint && "$NODE" "$NPM" install --no-save --no-bin-links --ignore-scripts --production --omit=peer eslint-plugin-jsdoc eslint-plugin-markdown @babel/core @babel/eslint-parser @babel/plugin-syntax-import-assertions)
"$NODE" "$NPM" install \
--ignore-scripts \
--install-strategy=shallow \
--no-bin-links \
eslint
# Uninstall plugins that we want to install so that they are removed from
# devDependencies. Otherwise --omit=dev will cause them to be skipped.
(
cd node_modules/eslint
"$NODE" "$NPM" uninstall \
--install-links=false \
--ignore-scripts \
eslint-plugin-jsdoc \
eslint-plugin-markdown \
@babel/core \
@babel/eslint-parser \
@babel/plugin-syntax-import-assertions
)
(
cd node_modules/eslint
"$NODE" "$NPM" install \
--ignore-scripts \
--install-links=false \
--no-bin-links \
--no-save \
--omit=dev \
--omit=peer \
eslint-plugin-jsdoc \
eslint-plugin-markdown \
@babel/core \
@babel/eslint-parser \
@babel/plugin-syntax-import-assertions
)
# Use dmn to remove some unneeded files.
"$NODE" "$NPM" exec -- [email protected] -f clean
"$NODE" "$NPM" exec --package=[email protected] --yes -- dmn -f clean
# TODO: Get this into dmn.
find node_modules -name .package-lock.json -exec rm {} \;
find node_modules -name 'README*' -exec rm {} \;
Expand Down

0 comments on commit 609df01

Please sign in to comment.