Commit f7ef8ae2 authored by Sebastian Wiesner's avatar Sebastian Wiesner

Require json-mode for JSON checking

parent 3b855f22
......@@ -15,6 +15,8 @@ now for questions and discussions about development. [GH-820]
* Remove `flycheck-perlcritic-verbosity`, obsolete since Flycheck 0.22
* Replace `flycheck-completion-system` with
`flycheck-completing-read-function` [GH-870]
* JSON syntax checkers now require `json-mode` and do not check in Javascript
Mode anymore
* New syntax checkers:
......
......@@ -26,6 +26,7 @@
(depends-on "jade-mode")
(depends-on "js2-mode")
(depends-on "js3-mode")
(depends-on "json-mode")
(depends-on "less-css-mode")
(depends-on "lua-mode")
(depends-on "mmm-mode")
......
......@@ -7180,12 +7180,7 @@ See URL `https://github.com/zaach/jsonlint'."
:error-filter
(lambda (errors)
(flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
:predicate
(lambda ()
(or
(eq major-mode 'json-mode)
(and (buffer-file-name)
(string= (file-name-extension (buffer-file-name)) "json")))))
:modes json-mode)
(flycheck-define-checker json-python-json
"A JSON syntax checker using Python json.tool module.
......@@ -7200,12 +7195,7 @@ See URL `https://docs.python.org/3.5/library/json.html#command-line-interface'."
;; Ignore the rest of the line which shows the char position.
(one-or-more not-newline)
line-end))
:predicate
(lambda ()
(or
(eq major-mode 'json-mode)
(and (buffer-file-name)
(string= (file-name-extension (buffer-file-name)) "json")))))
:modes json-mode)
(flycheck-define-checker less
"A LESS syntax checker using lessc.
......
......@@ -3773,13 +3773,13 @@ Why not:
(flycheck-ert-def-checker-test json-jsonlint json nil
(flycheck-ert-should-syntax-check
"language/json.json" 'text-mode
"language/json.json" 'json-mode
'(1 44 error "found: ',' - expected: 'EOF'." :checker json-jsonlint)))
(flycheck-ert-def-checker-test json-python-json json nil
(let ((flycheck-disabled-checkers '(json-jsonlint)))
(flycheck-ert-should-syntax-check
"language/json.json" 'text-mode
"language/json.json" 'json-mode
'(1 44 error "Extra data" :checker json-python-json))))
(flycheck-ert-def-checker-test less less file-error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment