Re: [openstreetmap/openstreetmap-website] Add eslint-plugin-erb to provide linting of .js.erb files (PR #5559)

2025-02-05 Thread Splines via rails-dev
Nice, flattered that you use my plugin now at openstreetmap ;) If anything is 
not working, just [open an 
issue](https://github.com/Splines/eslint-plugin-erb). And feel free to leave a 
GitHub star should you like it 😊

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5559#issuecomment-2637647091
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Repo: editor help to find eslint config file (Issue #5572)

2025-01-29 Thread Splines via rails-dev
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`:

```ts
"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](https://github.com/casey/just) 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:

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

See all [kinds of 
commands](https://github.com/MaMpf-HD/mampf/tree/main/.config/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`](https://github.com/MaMpf-HD/mampf/blob/23aae01471c4361b85e86df06e349cd8acfb735c/package.json#L27-L31)
 such that every dev can easily download and update their `just` version.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5572#issuecomment-2621255610
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add linting for .js.erb files (Issue #5523)

2025-01-24 Thread Splines via rails-dev
If you introduce linting here you might also be interested in:

- How we use ESLint on GitHub Actions via [this 
file](https://github.com/MaMpf-HD/mampf/blob/23aae01471c4361b85e86df06e349cd8acfb735c/.github/workflows/linter.yml#L39-L75)
 to lint only the changes inside changed `.js` and `.js.erb` files in a PR (see 
[this custom 
action](https://github.com/MaMpf-HD/mampf/blob/main/.github/actions/changed_files/action.yml)).
- A currently open [PR](https://github.com/MaMpf-HD/mampf/pull/730) where I try 
to set up linting of HTML files via [`html-eslint`](https://html-eslint.org/). 
Note that you can use my eslint-erb-plugin to also lint the HTML part of 
`.html.erb` files. Additionally, I set up Shopify's 
[`erb_lint`](https://github.com/Shopify/erb_lint) to also lint the Ruby part of 
`.html.erb` files.
- I haven't yet found a way to lint the Ruby part of `.js.erb` files. In the 
best case, it would work just like `erb_lint`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5523#issuecomment-2612111999
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Move deprecated eslint rules to stylistic plugin (PR #5557)

2025-01-28 Thread Splines via rails-dev
> Up until now, whenever I was writing JavaScript, I struggled to get ESLint to 
> work as seamlessly as Prettier

@kcne Feel free to use a configuration like the one [I use 
here](https://github.com/Manim-Notebook/manim-notebook/blob/68874a7e30489d8774ffc53ddfd96cbc7d885ba6/.vscode/settings.json#L1-L25)
 for VSCode. This works perfectly fine with the ESLint VSCode extension. It 
shows problems in real time in the code and whenever I save the file, it 
autofixes it, e.g. replaces `'` by `"` (dependent on your configuration).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5557#issuecomment-2619138614
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev


Re: [openstreetmap/openstreetmap-website] Add linting for .js.erb files (Issue #5523)

2025-01-25 Thread Splines via rails-dev
> Most stylistic rules are now removed from eslint because most use a formatter 
> like prettier.io

@HolgerJeromin Formatting rules have indeed been 
[deprecated](https://github.com/eslint/eslint/issues/17522) in the _core_ of 
ESLint. But mainly because of ongoing maintenance cost. Luckily, antfu was 
willing [to set up a community-driven ESLint Stylistic 
repo](https://github.com/eslint-stylistic/eslint-stylistic) to continue 
maintaining those rules with a great community. Look at [their 
website](https://eslint.style/), it works really fine for us, even for our 
large [MaMpf 
codebase](https://github.com/MaMpf-HD/mampf/blob/23aae01471c4361b85e86df06e349cd8acfb735c/.config/eslint.mjs#L130-L138).
 See also their [Why?](https://eslint.style/guide/why), which talks about 
Prettier as well.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5523#issuecomment-2614094287
You are receiving this because you are subscribed to this thread.

Message ID: 
___
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev