• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Shell script to update ESLint in the source tree to the latest release.
4
5# Depends on npm, npx, and node being in $PATH.
6
7# This script must be in the tools directory when it runs because it uses the
8# script source file path to determine directories to work in.
9
10cd "$( dirname "$0" )" || exit
11rm -rf node_modules/eslint node_modules/eslint-plugin-markdown
12(
13    mkdir eslint-tmp
14    cd eslint-tmp || exit
15    npm init --yes
16
17    npm install --global-style --no-bin-links --production --no-package-lock eslint@latest
18    npm install --global-style --no-bin-links --production --no-package-lock eslint-plugin-markdown@latest
19
20    # Use dmn to remove some unneeded files.
21    npx dmn@2.2.2 -f clean
22    # Use removeNPMAbsolutePaths to remove unused data in package.json.
23    # This avoids churn as absolute paths can change from one dev to another.
24    npx removeNPMAbsolutePaths@1.0.4 .
25)
26
27mv eslint-tmp/node_modules/eslint node_modules/eslint
28mv eslint-tmp/node_modules/eslint-plugin-markdown node_modules/eslint-plugin-markdown
29rm -rf eslint-tmp/
30