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

Run eslint from project root #30

Merged
merged 1 commit into from
Sep 28, 2023

Conversation

hochata
Copy link
Contributor

@hochata hochata commented Sep 24, 2023

The current proposed solution for #19 works fine, but I think there are a couple issues:

  • First, I think it would be better if it worked out of the box. At least for me, it took me by surprise and at first I thought it was a configuration problem with the project rather than the package.
  • It is another iteration of "Finding the root of a project". Emacs already has a builtin solution for this in the form of the project package

So this MR tries to run eslint from the project root found by project and fall-backs to the default directory if not inside a project.

Fallback to the current directory if not inside a project
@orzechowskid orzechowskid merged commit 879344b into orzechowskid:master Sep 28, 2023
@orzechowskid
Copy link
Owner

oh this is great, thank you!

@orzechowskid
Copy link
Owner

hm actually I don't believe this works correctly for monorepos. project-current returns the vc repository root which is not guaranteed to be the same as the directory containing the eslint config file. I've opened #32 , on branch bugfix/default-directory-with-project - would you be able to have a look and see if that change satisfies your use-case?

@hochata
Copy link
Contributor Author

hochata commented Oct 13, 2023

I actually added that option to fix a problem I had in a monorepo. My general point was that project can be tweaked to find the correct root instead of having a custom solution.

In this case, project-vc has a project-vc-extra-root-markerts variable that allows to define extra roots for a project. By adding "eslintrc.json" to it I can get it to pick the correct root.

Regardless, I just saw that this caused an issue with older Emacs version... my bad.

The solution you proposed would work fine for me. And it looks less likely to break things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants