-
-
Notifications
You must be signed in to change notification settings - Fork 30
Conversation
Hi @brettz9!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
Hi @brettz9!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
Hi @brettz9!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
Hi @brettz9!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.
Read more about contributing to ESLint here |
Am I still getting commit message errors because I've more than one commit in the PR? |
Yes, when there's more than one commit then it checks the pull request title. I fixed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to update the Node.js testing matrix to match the 12/14/16 that we have in Espree and eslint-visitor-keys
to get everything working.
Thanks again for taking this on!
Updated.
My pleasure. Really like ESM both for it being a universal syntax and conducing to polyglot browser-friendly, build-free code. Also eager to get closer to using ESM for plugins, etc. |
I think this looks good. I'd like to merge #69 first and then rebase this on top of that before merging. |
#69 has been merged, so when you feel up to rebase on top of that, we can look at this again. |
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
Where we are: it seems that the subpaths being used by typescript-eslint and Webpack aren't required going forward, so we don't need to provide any subpath exports for those. |
@nicolo-ribaudo it looks like Babel’s ESLint parser is reaching into eslint-scope to access some undocumented APIs that will no longer be accessible in the next release. Can you help us understand what the code is doing and how removing access to these APIs will affect you? |
That helps. As long Also see our great guide for the exports field: https://webpack.js.org/guides/package-exports/ |
@nzakas on behalf of the babel folks as I'm pretty sure I know what they are doing. They're extending this scope analyser to add support for the additional syntax they support. We at ts-eslint used to do the same thing, until we bit the bullet and forked/rewrote it due to our requirement to support the separate value+type scope analysis. Babel does technically support TS, though the vast, vast majority of users use ts-eslint for that usecase. So instead babel-eslint serves people who are using pure JS with additional features not yet supported by espree / this project. Meaning their extension is usually fairly limited in comparison. If you remove that access then it becomes hard for them to extend this package to add support for additional syntax without maintaining a complete fork of the project. They can correct me if I'm wrong though :) |
Thanks @bradzacher, it's 100% correct. @nzakas If those internal APIs will be made inaccessible from the outside, we will probably fork Btw, in Babel 8 we'll directly import (cc @hzoo who has more experience than me in our ESLint integration) |
Not much else to add to what @bradzacher/@nicolo-ribaudo said, this is some code we've had for a while, (this was the last PR babel/babel-eslint#542) but the general idea has been there since the beginning to monkey patch /updating scopes for new ast features/types/differences in the ast. |
@nicolo-ribaudo @hzoo Hmmm, okay. I don't think this is a great approach (any more than using undocumented APIs is ever a good idea), but we definitely don't want to break you. Long-term I think we need to reimagine how this package works. If everyone keeps using it as a base to extend, then we should really design an API that allows for that in an official way rather than coming across one-off uses that are using private methods. TSC Summary: This PR switches eslint-scope to be an ESM package. We had originally planned on removing access to APIs under TSC Question: How shall we proceed? So I think we have to decide how to move forward, which I see as one of:
|
Good news: in the most recent TSC meeting, we agreed to export the APIs under |
We are currently giving both |
I.e., adding 16 vs. 8 lines for each one of the additional Also, of those files, the exported files might be reduced further if those already being exported in full by |
Hmm, my understanding of option 1 was that |
This is correct. We would like lib/index.JS to export ScopeManager, Scope, Referencer, Definition, etc. (Everything Babel/eslint-parser is using) So we would still end up with one file created by Rollup and you shouldn’t need to update the Rollup script at all. |
Ah, ok, that makes more sense :-) Added a commit with the exports... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for all our your work on this.
}, | ||
"repository": "eslint/eslint-scope", | ||
"bugs": { | ||
"url": "https://github.com/eslint/eslint-scope/issues" | ||
}, | ||
"license": "BSD-2-Clause", | ||
"scripts": { | ||
"prepare": "npm run update-version && npm run build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A problem with this is that our release process doesn't commit lib/version.js
, so after the 6.0.0
release we'll still have const version = "5.1.1";
in lib/version.js
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would then cause the next release (e.g. 6.1.0
) to fail: npm install
will trigger the prepare
script, which will overwrite lib/version.js
with 6.0.0
. Then, npm version will throw error "Git working directory not clean".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll fix this in a separate PR.
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one quick inline suggestion. Thanks for all the work converting another package!
Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM assuming we'll align the scripts with our release process in a separate PR.
Thanks, @brettz9!
Thanks everyone, I'll merge this and start work on the release scripts. Awesome work @brettz9 |
Breaking: Switch to ESM
Fixes #70.