Comments (2)
I was able to cirvumvent the problem by customising the checker to use source
instead of source-original
:command ("eslint" ;; ...
"--stdin" "--stdin-filename" source)
My complete customisation looks as follows. For some reason I ended up hard-coding the find-working-directory routine
, which may not be necessary.
(defun bvr-flycheck-eslint--find-working-directory (_checker)
"Look for a working directory to run ESLint CHECKER in.
This will be the directory that contains the `node_modules'
directory. If no such directory is found in the directory
hierarchy, it looks first for `.eslintignore' and then for
`.eslintrc' files to detect the project root."
(let* ((file (or (buffer-file-name) default-directory)))
(when file
(or (locate-dominating-file file "node_modules")
(locate-dominating-file file ".eslintignore")
(locate-dominating-file file ".eslintrc")
(locate-dominating-file file ".eslintrc.js")
(locate-dominating-file file ".eslintrc.json")
(locate-dominating-file file ".eslintrc.yaml")
(locate-dominating-file file ".eslintrc.yml")))))
(flycheck-define-checker bvr-javascript-eslint
"A Javascript syntax and style checker using eslint.
See URL `https://eslint.org/'."
:command ("eslint" "--format=json"
(option-list "--rulesdir" flycheck-eslint-rules-directories)
(eval flycheck-eslint-args)
"--stdin" "--stdin-filename" source)
:standard-input t
:error-parser flycheck-parse-eslint
:enabled (lambda () (flycheck-eslint-config-exists-p))
:modes (js-mode js-jsx-mode js2-mode js2-jsx-mode js3-mode rjsx-mode
typescript-mode js-ts-mode typescript-ts-mode tsx-ts-mode)
:working-directory bvr-flycheck-eslint--find-working-directory
:verify
(lambda (_)
(let* ((default-directory
(flycheck-compute-working-directory 'bvr-javascript-eslint))
(have-config (flycheck-eslint-config-exists-p)))
(list
(flycheck-verification-result-new
:label "config file"
:message (if have-config "found" "missing or incorrect")
:face (if have-config 'success '(bold error))))))
:error-explainer
(lambda (err)
(let ((error-code (flycheck-error-id err))
(url "https://eslint.org/docs/rules/%s"))
(and error-code
;; skip non-builtin rules
(not ;; `seq-contains-p' is only in seq >= 2.21
(with-no-warnings (seq-contains error-code ?/)))
`(url . ,(format url error-code))))))
(add-to-list 'flycheck-checkers 'bvr-javascript-eslint)
from flycheck.
For posterity, I have created this simple workaround el
.
https://github.com/bvraghav/dotelisp/blob/master/bvr-flycheck-eslint.el
And I leave it to the good judgement of maintainers to close this issue.
from flycheck.
Related Issues (20)
- reveal_locals() does not (any more?) show mypy information by default HOT 2
- Warnings are shown only if there are no errors:
- please update the flymake comparison HOT 1
- Terraform-tflint command line arguments have changed HOT 1
- flycheck wrong type argument HOT 2
- Flycheck clears the selection mark when selecting text with errors HOT 2
- Running `global-flycheck-mode` errors if no "Tools" menu on startup HOT 3
- PHP - Warning about A file should declare new symbols... HOT 1
- test failure: flycheck-define-checker/awk-gawk/syntax-error HOT 1
- Flycheck's Emacs Lisp checker is unable to identify functions defined in nested block
- flycheck in buffers with no file name
- *compilation* buffer takes precedence when it exists
- Is CLA assistant working ? HOT 4
- Rust: couldn't create a temp dir: Operation not permitted HOT 1
- Need a version of flycheck-define-checker and flycheck-define-command-checker that doesn't have to have the checker executable be hard-coded to a string but rather looked up dynamically HOT 1
- Problems setting up PHP_CodeSniffer in Emacs HOT 1
- Support oxlint please HOT 2
- Discrepancy between flycheck-compile output and Flycheck errors buffer using slim-lint checker HOT 2
- Consider downgrading seq dep version HOT 7
- Error when loading: Eager macro-expansion skipped due to cycle HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flycheck.