Skip to content

Commit

Permalink
[Tests] test on TS parser v2, v3, and v4
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 23, 2021
1 parent aa8d566 commit 4aff27c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/node-4+.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
- 3
- 2
include:
- node-version: 'lts/*'
eslint: 7
ts-parser: 3
env:
TS_PARSER: 3
- node-version: 'lts/*'
eslint: 7
ts-parser: 2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"devDependencies": {
"@eslint/import-test-order-redirect-scoped": "file:./tests/files/order-redirect-scoped",
"@test-scope/some-module": "file:./tests/files/symlinked-module",
"@typescript-eslint/parser": "^2.23.0 || ^3.3.0",
"@typescript-eslint/parser": "^2.23.0 || ^3.3.0 || ^4.29.3",
"array.prototype.flatmap": "^1.2.4",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
Expand Down
15 changes: 8 additions & 7 deletions tests/dep-time-travel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ export NPM_CONFIG_LEGACY_PEER_DEPS=true

npm install --no-save "eslint@${ESLINT_VERSION}" --ignore-scripts

# completely remove the new TypeScript parser for ESLint < v5
if [[ "$ESLINT_VERSION" -lt "5" ]]; then


if [[ -n "$TS_PARSER" ]]; then # if TS parser is manually set, always use it
echo "Downgrading @typescript-eslint/parser..."
npm i --no-save "@typescript-eslint/parser@${TS_PARSER}"
elif [[ "$ESLINT_VERSION" -lt "5" ]]; then # completely remove the new TypeScript parser for ESLint < v5
echo "Removing @typescript-eslint/parser..."
npm uninstall --no-save @typescript-eslint/parser
elif [[ "$TRAVIS_NODE_VERSION" -lt "10" ]]; then # TS parser 3 requires node 10+
npm i --no-save "@typescript-eslint/parser@3"
fi

# use these alternate TypeScript dependencies for ESLint < v4
Expand All @@ -28,8 +34,3 @@ if [[ "$TRAVIS_NODE_VERSION" -lt "8" ]]; then
echo "Downgrading eslint-import-resolver-typescript..."
npm i --no-save [email protected]
fi

if [[ -n "$TS_PARSER" ]]; then
echo "Downgrading @typescript-eslint/parser..."
npm i --no-save @typescript-eslint/parser@2
fi

0 comments on commit 4aff27c

Please sign in to comment.