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

Repo: editor help to find eslint config file #5572

Open
HolgerJeromin opened this issue Jan 29, 2025 · 5 comments
Open

Repo: editor help to find eslint config file #5572

HolgerJeromin opened this issue Jan 29, 2025 · 5 comments

Comments

@HolgerJeromin
Copy link
Contributor

In #5557 I added a visual studio code workspace file in the config folder.
This file can contain settings but also other stuff.

We have different possibilities:

move config/eslint.js to root folder eslint.config.cjs

pro: works with every editor (?) without config
con: pollutes root folder

No editor specific config

con: no eslint (because of the unusual eslint config path)

settings file in .vscode/settings.json

pro: works with vsc without config
con: pollutes root folder with the folder .vscode

workspace file in root folder openstreetmap-website.code-workspace

pro: vsc ask it should open workspace instead of folder
con: pollutes root folder with the file

workspace file in config folder config/openstreetmap-website.code-workspace (as in PR right now)

pro: root folder is not polluted
con: vsc users needs to find the file and open manually

@tomhughes
Copy link
Member

My vote would be for .vscode/settings.json because a hidden file doesn't really pollute the root folder in a meaningful way.

@HolgerJeromin
Copy link
Contributor Author

HolgerJeromin commented Jan 29, 2025

I would like to do a poll which editors are used by the main developers.
😄: Visual Studio Code (or forks like vscodium)
🚀: Visual Studio
🎉: emacs
❤️: vim
🚀: jetbrains
😕: other

cc @gravitystorm @AntonKhorev @kcne @hlfan

I want to use this poll also to know if more jsdoc based magic for intellisense is a help for the main developers.

@Splines
Copy link

Splines commented Jan 29, 2025

Just to add my two cents: it's very common to have a .vscode in your repo if many devs use VSCode. If you don't want to see the folder locally, you can even add this to the .vscode/settings.json:

"files.exclude": {
  ".vscode": true,
}

There are so many great settings you can specify in that file.

Other than that, what I find useful many times is the amazing just command runner that is multi-platform. If you often find yourself executing the same command in the terminal, this might be useful such that everybody can do something like just lint js. And in the respective recipe named js in the lint.justfile, you would then call something like this:

#!/usr/bin/env bash
yarn run eslint --config ./.config/eslint.mjs --max-warnings 0

See all kinds of commands we use at MaMpf for various tasks like docker setup, printing ERD diagrams in Ruby, testing with cypress etc. We use these scripts in package.json such that every dev can easily download and update their just version.

@gravitystorm
Copy link
Collaborator

move config/eslint.js to root folder eslint.config.cjs

pro: works with every editor (?) without config
con: pollutes root folder

This one gets my vote. Having it work by default, for most developers, without making IDE-specific assumptions.

I think that if we need to specify anything in the root level (file, hidden file, folder, hidden folder) they are all just as polluting as each other - most IDEs, and the github UI, will show them hidden or not. So I treat "eslint.config.cjs" and ".vscode/settings.json" equally. And since one of those is IDE-specific, I'd prefer the other.

I would like to do a poll which editors are used by the main developers.

VSCodium

@tomhughes
Copy link
Member

Other than that, what I find useful many times is the amazing just command runner that is multi-platform. If you often find yourself executing the same command in the terminal, this might be useful such that everybody can do something like just lint js. And in the respective recipe named js in the lint.justfile, you would then call something like this:

#!/usr/bin/env bash
yarn run eslint --config ./.config/eslint.mjs --max-warnings 0

The canonical way to do that for a rails project is to create a rails task (really a rake task in disguise) that can be run with the rails command, as we have for eslint:

bundle exec rails eslint

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

No branches or pull requests

4 participants