question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[lint addon / javascript] Produces extraneous messages when option is specified

See original GitHub issue

For example, for the supplied demo, if I modify the lint config to use lint option onUpdateListing:

  var editor = CodeMirror.fromTextArea(document.getElementById("code-js"), {
    lineNumbers: true,
    mode: "javascript",
    gutters: ["CodeMirror-lint-markers"],
    lint: { onUpdateLinting:  function onUpdateLinting(annotationsNotSorted, annotations, cm) {
      console.log(annotationsNotSorted);
    } }
  });

The annotationsNotSorted returned will have an extraneous annotation "Bad option: onUpdateLinting" that does not match the editor.

The underlying JSHINT is returning the annotation because CodeMirror addon javascript-hint is passing on non-JSHINT option to JSHINT. See startLinting() in lint.js .

Would there be any interest to accept a patch for this?

I am working on a fix, filtering out lint addon’s own option before passing to mode-specific helper.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
JulianPinzarucommented, Dec 10, 2020

Yes, that’s to preserve backwards-compatible behavior. Add an options property to work around it.

Thank you! It helped me dealing with the following console warning: Cannot display JSHint error (invalid line 0) {id: "(error)", raw: "Bad {a}option: '{b}'.", code: "E001", evidence: "", line: 0, …} Leaving it here for anyone else who might encounter the same problem. So what I did I passed an empty object to options in the lint object, like that:

//… other codemirror settings above ‘lint’: { onUpdateLinting: function onUpdateLinting(annotationsNotSorted, annotations, cm) {
console.log(annotationsNotSorted);
}, options: { }
},
//… other codemirror settings below

0reactions
peter100ucommented, Dec 30, 2021

I used jshint js , javascriput-hint. js,lint. JS, resulting in my JavaScript hint JS can’t be used. It can’t complete the automatic prompt function. Have you encountered it? If so, please tell me how to deal with it

Read more comments on GitHub >

github_iconTop Results From Across the Web

[lint addon / javascript] Produces extraneous messages when ...
The annotationsNotSorted returned will have an extraneous annotation "Bad option: onUpdateLinting" that does not match the editor.
Read more >
How To Enable Linting on Save with Visual Studio Code and ...
Learn how to lint your code on every file save using ESLint rules and VS Code settings.
Read more >
"parserOptions.project" has been set for @typescript-eslint ...
This setting is required if you want to use rules which require type information. (...) Note that if this setting is specified and ......
Read more >
Android Lint Checks - Android Studio Project Site
In Gradle projects you can specify a resource prefix that all resources in the. project must conform to. This makes it easier to...
Read more >
Provide a common API for displaying JavaScript messages
Blocked by: [#2853509] Problem/Motivation Provide a consistent method for displaying messages in JavaScript. Currently the Settings tray module needs to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found