aaronjensen / eslintd-fix

Emacs minor-mode to automatically fix javascript with eslint_d.
64 stars 8 forks source link

Incompatible with eslint_d v14 #23

Open DamienCassou opened 1 month ago

DamienCassou commented 1 month ago

@mantoni released eslint_d v14 recently which breaks backward compatibility and consequently eslintd-fix: eslint_d now saves the portfile in node_modules/eslint/.eslintd instead of XDG_RUNTIME_DIR or the home directory.

A workaround is to use reformatter instead of eslintd-fix. Here is an example configuration:

(use-package reformatter
  :demand t
  :config
  (progn
    (reformatter-define eslintd-fix
      :program (executable-find "eslint_d")
      :args (list "--fix-to-stdout" "--stdin" "--stdin-filename" (buffer-file-name))
      :input-file (reformatter-temp-file-in-current-directory "js")
      :exit-code-success-p (lambda (code) (or (eq code 1) (eq code 0))))))

With this in place, you have to call eslintd-fix-on-save-mode to enable the minor-mode.

aaronjensen commented 1 month ago

@DamienCassou is reformatter comparable to eslintd-fix? i.e., should I discontinue eslintd-fix or should I address this issue?

If you'd like to submit a PR to https://github.com/aaronjensen/eslintd-fix I'd appreciate it. I don't currently use it.

DamienCassou commented 1 month ago

is reformatter comparable to eslintd-fix?

I think reformatter brings the same features as eslintd-fix and can be used with more tools than just eslint_d. The only downside is that reformatter requires a little more configuration.

My suggestion would be to deprecate eslintd-fix with a message in the README explaining how to configure reformatter for eslint_d. If you want that, I can open a PR.

aaronjensen commented 1 month ago

This package was designed to be as fast as possible, which is why it uses a persistent socket connection, rather than the eslint_d executable for each invocation. If this is not a noticeable difference now on modern machines, then it would be worth considering deprecation of this package. If it's still a difference of some note, even if only to the most discerning individual, then I'd be inclined to fix it.

DamienCassou commented 1 month ago

To me eslint_d is fast enough on my 4-year-old laptop.