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

Yet another report of 'missing or incorrect' config file with eslint. #1622

Closed
4 tasks done
yoshikiohshima opened this issue Sep 18, 2019 · 6 comments
Closed
4 tasks done

Comments

@yoshikiohshima
Copy link

This template is for user support. If you are reporting an actual Flycheck bug, please use the relevant issue template instead.

Checklist

  • I have searched existing issues and StackOverflow for solutions.
  • I have read the [Flycheck manual][].
  • I have read the [Troubleshooting Guide][].
  • I have checked my issue has not been reported yet.

Problem description

I get "config file: missing or incorrect" error with flycheck-verify-setup. Besides I'd like to know how to fix the problem, I'd like to know what it actually means. I've read other reports about executable-path, but it is a bit hard to know that that is the issue. When I do M-! (shell-command) and run eslint index.js it property checks the errors and styles in the file. If I run the shell-mode and run stuff like eslint --print-config index.js; echo $?, I get 0 so it is not that an error code is returned. The following is the content in the buffer when I run M-x flycheck-verity-setup. It does find the executable (and the one I want to use), and it is consistent with the one I run from the shell-mode. It's just I cannot say which file is missing or incorrect from this output.

I am on Emacs 26.2 on MacOS. Eslint is installed globally.

Syntax checkers for buffer index.js in js-mode:

javascript-eslint (disabled)
- may enable: Automatically disabled!
- executable: Found at /usr/local/bin/eslint
- config file: missing or incorrect

javascript-jshint (disabled)
- may enable: Automatically disabled!
- executable: Not found
- configuration file: Not found

javascript-standard (disabled)
- may enable: Automatically disabled!
- executable: Not found

Flycheck Mode is enabled. Use C-u C-c ! x to enable disabled
checkers.


Flycheck version: 32snapshot (package: 20181126.1002)
Emacs version: 26.2
System: x86_64-apple-darwin18.7.0
Window system: ns

@fmdkdd
Copy link
Member

fmdkdd commented Sep 21, 2019

If I run the shell-mode and run stuff like eslint --print-config index.js; echo $?, I get 0

Have you tried with eslint --print-config BUFFER-FILE-NAME? This is what the code does.

@yoshikiohshima
Copy link
Author

Have you tried with eslint --print-config BUFFER-FILE-NAME? This is what the code does.

BUFFER-FILE-NAME here is the full path for index.js in my example, right? In this example, it is /Users/ohshima/src/react/my-app/src/index.js, and it also runs fine (it prints out the configuration in JSON format and finishes with error code 0). Or are you suggesting to see the printed result? It does not seem to have any particular problem in the result.

Thank you!

@yoshikiohshima
Copy link
Author

I see that flycheck-eslint-config-exists-p looks like:

(defun flycheck-eslint-config-exists-p ()
"Whether there is a valid eslint config for the current buffer."
(let* ((executable (flycheck-find-checker-executable 'javascript-eslint))
(exitcode (and executable (call-process executable nil nil nil
"--print-config" "."))))
(eq exitcode 0)))

. If I follow this and run "eslint --print-config .", it certainly produces an error with a message:

The '--print-config' CLI option requires a path to a source code file rather than a directory.
See also: https://eslint.org/docs/user-guide/command-line-interface#--print-config

Maybe this is the problem?

@yoshikiohshima
Copy link
Author

FYI, eslint has changed to throw an error when "." is used for --print-config:
eslint/eslint#11874

@cpitclaudel
Copy link
Member

I think your Flycheck is outdated: https://github.com/flycheck/flycheck/blob/master/flycheck.el#L8689

@yoshikiohshima
Copy link
Author

ah, yes. I thought I got a new version when I switched Emacs but then I was using the old one in the end. Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants