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

Can't figure out how to lint #2003

ervasive opened this Issue Apr 15, 2018 · 2 comments


None yet
2 participants
Copy link

commented Apr 15, 2018

Hi everyone, sorry if it's a stupid question (and I'm sorry to post it in the issue tracker, I didn't find any other place to get help), but I'm trying to enable linting in kakoune and sadly can't quite figure it out.

In my case, I'm trying to lint a JavaScript/React project. For example, this is the steps I follow:

  1. Initialize project
    npx create-react-app kakoune-lint-example && cd kakoune-lint-example
  2. Install formatter
    npm install --save-dev eslint-formatter-kakoune
  3. Create eslint config
    echo "{\n\t\"extends\": \"react-app\"\n}" > .eslintrc
  4. Introduce lint error
    echo error >> src/index.js

When I run the linter from the terminal with the following command:

./node_modules/.bin/eslint --format=node_modules/eslint-formatter-kakoune src/index.js

It seems that it works as intended. Here's the output I get:

/home/ruslik/Playground/kakoune-lint-example/src/index.js:9:1: Warning: Expected an assignment or function call and instead saw an expression. (no-unused-expressions)
/home/ruslik/Playground/kakoune-lint-example/src/index.js:9:1: Error: 'error' is not defined. (no-undef)
2 problems

Then I open the file in Kakoune:

kak src/index.js

and set the lintcmd command:

set-option buffer lintcmd 'node_modules/.bin/eslint --format=node_modules/eslint-formatter-kakoune'

I also tried to provide the absolute path:

set-option buffer lintcmd '/home/ruslik/Playground/kakoune-lint-example/node_modules/.bin/eslint --format=node_modules/eslint-formatter-kakoune'

but when i run lint I have no output neither in *lint-output* nor *debug* buffers.

Can someone please point me in the right direction with this, thanks.

kakoune version: AUR installed 2018.04.13-1


This comment has been minimized.

Copy link

commented Apr 15, 2018

Before calling lint, enable debug flags to see what's executed:

set global debug shell

You can also have a look at the syntastic script.


This comment has been minimized.

Copy link

commented Apr 15, 2018

Thank you for the tip.

OK, I found the issue. Basically, every time the linting is happening, it runs against the temporary created file in /tmp/kak-lint.XXXXXXXX/buf and the context of that directory, so eslint can't find the configuration file (eg. .eslintrc) there.

To fix the issue in addition to this:

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

the path to configuration file needs to be specified:

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

that fixed the problem for me.

@ervasive ervasive closed this Apr 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.