Anyone have a successful lint setup for js/ts?

I cant seem to get linting working correctly for me, oddly enough. I’ve tried following the directions in the wiki, ive installed the formatter and everything, but it doesnt seem to work.

i currently have this in my kakrc, but i dont see any gutter signs in projects with a .eslintrc file present. When i run the :lint command, i get an empty lint-buffer even though i know there are errors.

hook global WinSetOption filetype=javascript %{
  set buffer lintcmd 'node_modules/.bin/eslint --config=.eslintrc --format=node_modules/eslint-formatter-kakoune'

I’ve looked into the issues but it doesnt seem like anything offered there works. would love some help here. thanks.

This is my javascript linting configuration. It works without any problem.

hook global WinSetOption filetype=javascript %{
	set buffer lintcmd './node_modules/.bin/eslint --format=node_modules/eslint-formatter-kakoune -c .eslintrc.js'

The only differences I find with yours is than you are using node_modules and I’m using ./node_modules but I don’t think that is relevant.
Try to run the command alone on a terminal with some file as a test. You might get some ideas on what is failing.

1 Like

I hope eslint-formatter-kakoune still works with the latest version of eslint (there’s no reason it shouldn’t anymore, but who knows). If this piece is indeed the guilty one on this issue, don’t hesitate to ping me on to update it.

Why --config .eslintrc.js is specified?

Does it look for .eslintrc.js in the current directory only or also the ancestors?

I added the path to the config file because it seemed necessary from this issue:

but with or without it, i get the same exact outcome. running the following from the command line outputs errors
❯ node_modules/.bin/eslint -f ~/node_modules/eslint-formatter-kakoune/index.js assets/js/**/*.js

i have basically the same thing without the js glob pattern in my kakrc:

6│hook global WinSetOption filetype=javascript %{ 
57│  set window lintcmd 'eslint -f ~/node_modules/eslint-formatter-kakoune/index.js --config=.eslintrc.js' 
58│  lint-enable 

but when i open a file with kakoune, i get no errors, i run :lint and a lint-output buffer is created without any errors. in the status line, it reads 0 errors, 0 warnings…

and yes i even removed the path to the config file, same thing happens.


I guess most kakoune users are not web developers :sweat_smile:

Have you looked in the *debug* buffer for any error messages or warnings from Kakoune that might have occurred when it tries to run eslint?

theres nothing in the debug buffer unfortunately.

How do you trigger the lint command on save?

I am doing web dev stuff, but my lint takes legit 3 minutes to run, so don’t want it on save. :slight_smile:

@jssee did you try with the ./node_modules instead of node_modules?

You can also use npm bin if you don’t want to tweak your path.

set-option window lintcmd "%sh(npm bin)/eslint --format eslint-formatter-kakoune"