-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: improve how configures are resolved #26
Conversation
src/configs.ts
Outdated
|
||
const configPath = userConfigPath | ||
? resolve(cwd, userConfigPath) | ||
: await findUp(configFilenames, { cwd: userRootPath || cwd }) |
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.
Instead of recreating the same logic from ESLint, could you use ESLint#findConfigFile()
?
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.
Since the flat config is just a JS module, I found it's great that you can just import it directly to get the resolved configs - that's what this project was built upon originally. While I pretty much want to share the code, I don't want it to be coupled with users' ESLint version, or specific API that ESLint made public. Right now, the config searching logic isn't complicated; I guess it's ok not to keep it standalone and portable right now. For sure, I am still open to sharing logic if needed in the future.
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.
Fair enough. My only concern is keeping it in sync if things change, but if we launch from ESLint we can always pass in the specific config file and base path, so maybe not that big of an issue.
*/ | ||
chdir?: boolean | ||
} | ||
|
||
export async function readConfig( |
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.
Can you add some JSDoc for this function so it's easier to understand what exactly is being passed in?
fix #25
find-up
, aligning with ESLint