Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/eslint-plugin-import
Path: blob/main/tests/dep-time-travel.sh
828 views
1
#!/bin/bash
2
3
# expected: ESLINT_VERSION numeric env var
4
5
echo "installing ${ESLINT_VERSION} in node ${TRAVIS_NODE_VERSION} with TS parser ${TS_PARSER:-default}..."
6
7
export NPM_CONFIG_LEGACY_PEER_DEPS=true
8
9
if [[ "$ESLINT_VERSION" -lt "7" ]]; then
10
echo "Removing @angular-eslint/template-parser..."
11
npm uninstall --no-save @angular-eslint/template-parser
12
fi
13
14
npm install --no-save "eslint@${ESLINT_VERSION}" --ignore-scripts
15
16
if [[ -n "$TS_PARSER" ]]; then # if TS parser is manually set, always use it
17
echo "Downgrading @typescript-eslint/parser..."
18
npm i --no-save "@typescript-eslint/parser@${TS_PARSER}"
19
elif [[ "$ESLINT_VERSION" -lt "5" ]]; then # completely remove the new TypeScript parser for ESLint < v5
20
echo "Removing @typescript-eslint/parser..."
21
npm uninstall --no-save @typescript-eslint/parser
22
elif [[ "$TRAVIS_NODE_VERSION" -lt "10" ]]; then # TS parser 3 requires node 10+
23
npm i --no-save "@typescript-eslint/parser@3"
24
fi
25
26
# use these alternate TypeScript dependencies for ESLint < v4
27
if [[ "$ESLINT_VERSION" -lt "4" ]]; then
28
echo "Downgrading babel-eslint..."
29
npm i --no-save babel-eslint@8.0.3
30
31
echo "Downgrading TypeScript dependencies..."
32
npm i --no-save typescript-eslint-parser@15 typescript@2.8.1
33
fi
34
35
# typescript-eslint-parser 1.1.1+ is not compatible with node 6
36
if [[ "$TRAVIS_NODE_VERSION" -lt "8" ]]; then
37
echo "Downgrading eslint-import-resolver-typescript..."
38
npm i --no-save eslint-import-resolver-typescript@1.0.2
39
fi
40
41
if [ "${ESLINT_VERSION}" = '8' ]; then
42
# This is a workaround for the crash in the initial processing of the ESLint class.
43
echo "Installing self"
44
npm i --no-save eslint-plugin-import@'.' -f
45
echo "Build self"
46
npm run build
47
fi
48
49