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

Add options.ignoreUnconfigured #64

Merged
merged 3 commits into from
Apr 3, 2022
Merged

Add options.ignoreUnconfigured #64

merged 3 commits into from
Apr 3, 2022

Conversation

wooorm
Copy link
Member

@wooorm wooorm commented Apr 2, 2022

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

When turning this option on, files will only be used if they have an
associated detected configuration file.
Other files will be ignored.

Given that configuration actually happens much later than finding files,
how it works is more similar to how a fatal error or so prevents a file
from being processed, instead of actual files being ignored.

/cc @remcohaszing

@wooorm wooorm added 🦋 type/enhancement This is great to have 🧒 semver/minor This is backwards-compatible change 🗄 area/interface This affects the public interface 👍 phase/yes Post is accepted and can be worked on labels Apr 2, 2022
@wooorm wooorm requested a review from remcohaszing April 2, 2022 18:00
@wooorm wooorm changed the title Update dev-dependencies Add options.ignoreUnconfigured Apr 2, 2022
@github-actions

This comment has been minimized.

When turning this option on, files will only be used if they have an
associated detected configuration file.
Other files will be ignored.

Given that configuration actually happens much later than finding files,
how it works is more similar to how a fatal error or so prevents a file
from being processed, instead of actual files being ignored.

Related-to: unifiedjs/unified-language-server#30.
Copy link
Member

@remcohaszing remcohaszing left a comment

Choose a reason for hiding this comment

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

Just found a couple of nits, but nothing blocking.

Thanks for adding this option! <3

done
)

function done(error) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: The following might give a better id of what’s available in the callback:

Suggested change
function done(error) {
function done(error, code, context) {

Copy link
Member Author

Choose a reason for hiding this comment

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

They’re unused. The code style strips those away. None of the others do this either. So definitely 👎 for doing it in this case in this PR, but open to discussing changing it (here, everywhere?), although I’m personally 👎

Copy link
Member

Choose a reason for hiding this comment

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

It was just a suggestion. I have no strong feelings on this.

// If there was no explicit corresponding config file found
if (!configuration.filePath && context.settings.ignoreUnconfigured) {
debug('Ignoring file w/o corresponding config file')
file.data.unifiedEngineIgnored = true
Copy link
Member

Choose a reason for hiding this comment

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

Oh cool! So this property is available now after processing too. We don’t need it in unified-language-server now, but it might come in handy some day. Should it be documented?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is more a new, another way, to ignore files.
Each step that handles a file now does nothing when this field is set.
I am not particularly fond of documenting it, and neither are the two other existing namespaced fields, because they’re not really meant to be “used” by folks, although documenting them might at least help serve folks that google them because they’re on their files for some reason.

lib/file-pipeline/read.js Outdated Show resolved Hide resolved
Co-authored-by: Remco Haszing <remcohaszing@gmail.com>
@codecov-commenter

This comment was marked as resolved.

@wooorm wooorm merged commit 7f91757 into main Apr 3, 2022
@wooorm wooorm deleted the ignore-unconfigured branch April 3, 2022 14:00
@wooorm wooorm added the 💪 phase/solved Post is done label Apr 3, 2022
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the 👍 phase/yes Post is accepted and can be worked on label Apr 3, 2022
wooorm added a commit that referenced this pull request Jun 25, 2022
This fixes a bug, where deep `package.json`s without config,
which were previously ignored and higher `package.json`s used,
were instead seen as an unconfigured project.

This bug was introduced in 9.1.0.

Related-to: GH-64.
Related-to: 7f91757.
wooorm added a commit that referenced this pull request Jun 25, 2022
This fixes a bug, where deep `package.json`s without config,
which were previously ignored and higher `package.json`s used,
were instead seen as an unconfigured project.

This bug was introduced in 9.1.0.

Related-to: GH-64.
Related-to: 7f91757.
Backports: 1c11663.
wooorm added a commit that referenced this pull request Jun 25, 2022
This fixes a bug, where deep `package.json`s without config,
which were previously ignored and higher `package.json`s used,
were instead seen as an unconfigured project.

This bug was introduced in 9.1.0.

Related-to: GH-64.
Related-to: 7f91757.
Backports: 1c11663.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🧒 semver/minor This is backwards-compatible change 🦋 type/enhancement This is great to have
Development

Successfully merging this pull request may close these issues.

4 participants