Anyone have a successful lint setup for js/ts?


#1

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'
  lint-enable
  lint
}

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


NewCommer: how to work with StandardJS?
#2

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'
	lint-enable
}

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.


#3

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 https://github.com/Delapouite/eslint-formatter-kakoune to update it.


#4

Why --config .eslintrc.js is specified?

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


#5

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 
59│}

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.


#6

Bump?

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


#7

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?


#8

theres nothing in the debug buffer unfortunately.