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

Breaking: Strict package exports (refs #13654) #14706

Merged
merged 6 commits into from Aug 5, 2021
Merged

Breaking: Strict package exports (refs #13654) #14706

merged 6 commits into from Aug 5, 2021

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Jun 14, 2021

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

This implements the strict package exports RFC by updating api.js and implementing unsupported-api.js.

This does not implement ESLint#getRulesMetaForReport() method. I'll do a separate PR for that piece.

Is there anything you'd like reviewers to focus on?

Please check that this matches the RFC. Also, how do we want to document the use-at-your-own-risk entrypoint? Should that be on the Node.js API page, or should we just omit it and trust that people who want it will find it?

@nzakas nzakas added core Relates to ESLint's core APIs and features accepted There is consensus among the team that this change meets the criteria for inclusion breaking This change is backwards-incompatible labels Jun 14, 2021
@nzakas
Copy link
Member Author

nzakas commented Jun 14, 2021

Hmmm, there's a ton of linting errors on the master branch right now.

@btmills
Copy link
Member

btmills commented Jun 14, 2021

I'm not able to repro any failures on master locally, and the last commit to master passed checks: https://github.com/eslint/eslint/runs/2809970160. Your first commit changed a bunch of rule tests, which I wasn't expecting. Were those changes intentional?

@mdjermanovic
Copy link
Member

You probably have an old version of eslint-plugin-eslint-plugin locally installed.

@nzakas
Copy link
Member Author

nzakas commented Jun 15, 2021

Ah ok, weird. I definitely didn’t intend to change all of those files it must have happened when I ran auto fix. I’ll try updating the plugin

@nzakas
Copy link
Member Author

nzakas commented Jun 15, 2021

Thanks @mdjermanovic that did the trick!

@nzakas
Copy link
Member Author

nzakas commented Jun 15, 2021

Forgot to mention: the more I think about it, the more I feel like the use-at-your-own-risk entrypoint should not be documented. People were already digging around the eslint package and finding APIs to use that weren't documented before. I don't want to implicitly "bless" stuff in use-at-your-own-risk by documenting it, but would like to hear other thoughts.

@ljharb
Copy link
Sponsor Contributor

ljharb commented Jun 15, 2021

By documented, you mean in prose? as long as it's in package.json "exports" that seems fine.

@nzakas
Copy link
Member Author

nzakas commented Jun 15, 2021

@ljharb yes, in prose. Forgot people could just look in package.json 🤦

@mdjermanovic
Copy link
Member

Forgot to mention: the more I think about it, the more I feel like the use-at-your-own-risk entrypoint should not be documented. People were already digging around the eslint package and finding APIs to use that weren't documented before. I don't want to implicitly "bless" stuff in use-at-your-own-risk by documenting it, but would like to hear other thoughts.

I agree that we shouldn't document the use-at-your-own-risk entrypoint, as we don't want to encourage its use.

btw it seems that exports in package.json doesn't restrict require(<absolute path>), so all internal modules still can be loaded from other packages, like this:

const accessorPairs = require(
  path.resolve(path.dirname(require.resolve("eslint")), "rules", "accessor-pairs")
);

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM aside from two small documentation suggestions I left.

nzakas and others added 2 commits June 16, 2021 17:27
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
@nzakas
Copy link
Member Author

nzakas commented Jun 17, 2021

Thanks for catching those docs issues.

@nzakas nzakas linked an issue Jun 17, 2021 that may be closed by this pull request
@nzakas nzakas merged commit 24c9f2a into master Aug 5, 2021
@nzakas nzakas deleted the issue13654 branch August 5, 2021 20:31
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Feb 2, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking: define an exports field for our public API
6 participants