-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
nzakas
left a comment
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.
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?
| 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. |
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.
basePath can also be absolute. Do we want to mention that here?
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.
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.
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.
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.
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.
Updated in c06d579
Maybe we should wait to see if there will be any problems with this, and then update the flag in the next release? |
|
I've updated the flag in the last commit. https://deploy-preview-19879--docs-eslint.netlify.app/flags/#active-flags |
fasttime
left a comment
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! Leaving open for @nzakas to verify the last changes.
Co-authored-by: Francesco Trotta <github@fasttime.org>
nzakas
left a comment
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!
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_fileflag withv10_config_lookup_from_fileflag. Theunstable_config_lookup_from_fileflag still works: it automatically enables thev10_config_lookup_from_fileflag, but emits a warning.What changes did you make? (Give an overview)
@eslint/config-arrayand@eslint/config-helpersdependencies to allow for specifyingbasePathin config objects.--ignore--paterns(ignorePatternsAPI option) to create a global ignores object withbasePathset tocwdinstead of adjusting patterns. This fixes Bug:--ignore-patterndoesn't work well with--flag unstable_config_lookup_from_file#18948.unstable_config_lookup_from_fileflag withv10_config_lookup_from_fileflag.Is there anything you'd like reviewers to focus on?