Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Support for ESLint v8 #2191

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/node-4+.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
matrix:
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
eslint:
- 8
- 7
- 6
- 5
Expand All @@ -44,24 +45,44 @@ jobs:
env:
TS_PARSER: 2
exclude:
- node-version: 15
eslint: 8
- node-version: 13
eslint: 8
- node-version: 11
eslint: 8
- node-version: 10
eslint: 8
- node-version: 9
eslint: 8
- node-version: 9
eslint: 7
- node-version: 8
eslint: 8
- node-version: 8
eslint: 7
- node-version: 7
eslint: 8
- node-version: 7
eslint: 7
- node-version: 7
eslint: 6
- node-version: 6
eslint: 8
- node-version: 6
eslint: 7
- node-version: 6
eslint: 6
- node-version: 5
eslint: 8
- node-version: 5
eslint: 7
- node-version: 5
eslint: 6
- node-version: 5
eslint: 5
- node-version: 4
eslint: 8
- node-version: 4
eslint: 7
- node-version: 4
Expand Down
3 changes: 2 additions & 1 deletion .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"tests",
"resolvers/*/test",
"scripts",
"memo-parser"
"memo-parser",
"lib"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary because it takes a long time to load eslint-plugin-import.

#2191 (comment)

]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
## [Unreleased]

### Added
- Support `eslint` v8 ([#2191], thanks [@ota-meshi])
- [`no-unresolved`]: add `caseSensitiveStrict` option ([#1262], thanks [@sergei-startsev])
- [`no-unused-modules`]: add eslint v8 support ([#2194], thanks [@coderaiser])
- [`no-restricted-paths`]: add/restore glob pattern support ([#2219], thanks [@stropho])
Expand Down Expand Up @@ -924,6 +925,7 @@ for info on changes for earlier releases.
[#2212]: https://github.com/import-js/eslint-plugin-import/pull/2212
[#2196]: https://github.com/import-js/eslint-plugin-import/pull/2196
[#2194]: https://github.com/import-js/eslint-plugin-import/pull/2194
[#2191]: https://github.com/import-js/eslint-plugin-import/pull/2191
[#2184]: https://github.com/import-js/eslint-plugin-import/pull/2184
[#2179]: https://github.com/import-js/eslint-plugin-import/pull/2179
[#2160]: https://github.com/import-js/eslint-plugin-import/pull/2160
Expand Down Expand Up @@ -1517,6 +1519,7 @@ for info on changes for earlier releases.
[@noelebrun]: https://github.com/noelebrun
[@ntdb]: https://github.com/ntdb
[@nwalters512]: https://github.com/nwalters512
[@ota-meshi]: https://github.com/ota-meshi
[@panrafal]: https://github.com/panrafal
[@paztis]: https://github.com/paztis
[@pcorpet]: https://github.com/pcorpet
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"babylon": "^6.18.0",
"chai": "^4.3.4",
"cross-env": "^4.0.0",
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0",
"escope": "^3.6.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is a workaround to prevent the babel-eslint patch from crashing.

https://github.com/babel/babel-eslint/blob/v8.2.6/lib/patch-eslint-scope.js#L31

"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8",
"eslint-import-resolver-node": "file:./resolvers/node",
"eslint-import-resolver-typescript": "^1.0.2 || ^1.1.1",
"eslint-import-resolver-webpack": "file:./resolvers/webpack",
Expand All @@ -95,7 +96,7 @@
"typescript-eslint-parser": "^15 || ^22.0.0"
},
"peerDependencies": {
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0"
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the release of the stable version of eslint v8, I added eslint v8 to peerDeps.

},
"dependencies": {
"array-includes": "^3.1.3",
Expand Down
8 changes: 8 additions & 0 deletions tests/dep-time-travel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ if [[ "$TRAVIS_NODE_VERSION" -lt "8" ]]; then
echo "Downgrading eslint-import-resolver-typescript..."
npm i --no-save eslint-import-resolver-typescript@1.0.2
fi

if [ "${ESLINT_VERSION}" = '8' ]; then
# This is a workaround for the crash in the initial processing of the ESLint class.
echo "Installing self"
npm i --no-save eslint-plugin-import@'.' -f
echo "Build self"
npm run build
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it link as a workaround to get the test to work which fails due to eslint-plugin-import in node_modules.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this is published, will this workaround no longer be needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect that the workaround will be unnecessary if we release eslint-plugin-import and change it to use it.
I think that we can also undo .nycrc change.
https://github.com/import-js/eslint-plugin-import/pull/2191/files#r690041296

2 changes: 1 addition & 1 deletion tests/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('CLI regression tests', function () {
},
],
errorCount: 1,
...(semver.satisfies(eslintPkg.version, '>= 7.32 || ^8.0.0-0') && {
...(semver.satisfies(eslintPkg.version, '>= 7.32 || ^8.0.0') && {
fatalErrorCount: 0,
}),
warningCount: 0,
Expand Down