Skip to content

feat: Support basePath property in config objects #19879

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

Merged
merged 9 commits into from
Jun 27, 2025
Merged

feat: Support basePath property in config objects #19879

merged 9 commits into from
Jun 27, 2025

Conversation

mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Jun 22, 2025

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 autofix to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

Implements RFC131: https://github.com/eslint/rfcs/tree/main/designs/2025-base-path-in-config-objects

Also replaces the unstable_config_lookup_from_file flag with v10_config_lookup_from_file flag. The unstable_config_lookup_from_file flag still works: it automatically enables the v10_config_lookup_from_file flag, but emits a warning.

What changes did you make? (Give an overview)

  • Updated @eslint/config-array and @eslint/config-helpers dependencies to allow for specifying basePath in config objects.
  • Changed handling of --ignore--paterns (ignorePatterns API option) to create a global ignores object with basePath set to cwd instead of adjusting patterns. This fixes Bug: --ignore-pattern doesn't work well with --flag unstable_config_lookup_from_file #18948.
  • Replaced the unstable_config_lookup_from_file flag with v10_config_lookup_from_file flag.
  • Updated types.
  • Updated docs.
  • Added tests.

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

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Jun 22, 2025
Copy link

netlify bot commented Jun 22, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit a8604e5
🔍 Latest deploy log https://app.netlify.com/projects/docs-eslint/deploys/685e9e503a924c0008aa458f

@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Jun 22, 2025
@github-actions github-actions bot added the core Relates to ESLint's core APIs and features label Jun 22, 2025
@nzakas nzakas moved this from Needs Triage to Implementing in Triage Jun 24, 2025
@mdjermanovic mdjermanovic mentioned this pull request Jun 25, 2025
1 task
@mdjermanovic mdjermanovic marked this pull request as ready for review June 25, 2025 14:46
@mdjermanovic mdjermanovic requested a review from a team as a code owner June 25, 2025 14:46
@mdjermanovic mdjermanovic added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jun 25, 2025
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

The changes LGTM. I left a question about how we want to document basePath (the docs mention it can be a relative path but it can also be an absolute path).

Also, because this was the last thing holding up unstable_config_lookup_from_file, do we want to update that flag to be v10_config_lookup_from_file?

@@ -66,6 +66,7 @@ module.exports = defineConfig([
Each configuration object contains all of the information ESLint needs to execute on a set of files. Each configuration object is made up of these properties:

- `name` - A name for the configuration object. This is used in error messages and [config inspector](https://github.com/eslint/config-inspector) to help identify which configuration object is being used. ([Naming Convention](#configuration-naming-conventions))
- `basePath` - A string specifying the relative path to a subdirectory to which the configuration object should apply to.
Copy link
Member

Choose a reason for hiding this comment

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

basePath can also be absolute. Do we want to mention that here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, I think not, absolute paths are intended for internal use (to be set by ESLint when needed). End users should use relative paths for portability reasons.

Copy link
Member Author

Choose a reason for hiding this comment

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

On second thought, absolute paths, if not hard-coded but calculated in the config file relative to the location of the config file, might be useful for some use cases when --config is used, as they wouldn't depend on cwd. I'll update the docs to mention that absolute paths are also allowed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in c06d579

@mdjermanovic
Copy link
Member Author

Also, because this was the last thing holding up unstable_config_lookup_from_file, do we want to update that flag to be v10_config_lookup_from_file?

Maybe we should wait to see if there will be any problems with this, and then update the flag in the next release?

@github-actions github-actions bot added the cli Relates to ESLint's command-line interface label Jun 26, 2025
@mdjermanovic
Copy link
Member Author

I've updated the flag in the last commit.

https://deploy-preview-19879--docs-eslint.netlify.app/flags/#active-flags

fasttime
fasttime previously approved these changes Jun 27, 2025
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Leaving open for @nzakas to verify the last changes.

@fasttime fasttime moved this from Implementing to Second Review Needed in Triage Jun 27, 2025
Co-authored-by: Francesco Trotta <github@fasttime.org>
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@nzakas nzakas merged commit 52a5fca into main Jun 27, 2025
31 checks passed
@nzakas nzakas deleted the rfc131 branch June 27, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Bug: --ignore-pattern doesn't work well with --flag unstable_config_lookup_from_file
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy