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

expose JSHint's options as a configurable setting #895

Closed
NodeGuy opened this issue Aug 26, 2012 · 11 comments
Closed

expose JSHint's options as a configurable setting #895

NodeGuy opened this issue Aug 26, 2012 · 11 comments
Labels

Comments

@NodeGuy
Copy link

NodeGuy commented Aug 26, 2012

Currently the options sent to JSHint are hardwired within javascript_worker.js:

lint(value, {undef: false, onevar: false, passfail: false});

Please make them available via the public API as a configurable setting.

@nightwing
Copy link
Member

i've started doing this in the worker branch
https://github.com/ajaxorg/ace/blob/2aae3e253f47d7422596d2908efcc7915728c064/lib/ace/mode/javascript_worker.js#L83-108

it's not very convenient to use now

ace.session.$worker.send("setOptions",[options])

and i'll probably add a way for setting default options for new workers
or make one worker for all sessions? need to think some more about this

@NodeGuy
Copy link
Author

NodeGuy commented Jun 28, 2013

Thank you. How do I use this?

@nightwing
Copy link
Member

something like this

function configureWorker(e, session) {
    if (session.getMode().id == "ace/mode/javascript")
    if (session.$worker) {
       session.$worker.send("changeOptions",[ {undef: true}])
       // or
       session.$worker.send("setOptions",[ {onevar: false, asi:true}])
    }
}
// after changing the session
session.on("changeMode", configureWorker)

@NodeGuy
Copy link
Author

NodeGuy commented Jul 21, 2013

Thank you!

@homam
Copy link

homam commented Aug 12, 2015

I hope it helps saving time: if you like to suppress specific error / warning codes use:

session.$worker.send("setOptions", [ { "-W095": false, "-W025": false }])

@hyusetiawan
Copy link

@homam tried using that line, but it's not working, it complains that $worker is undefined, any other way to expose the jshint options? or disable the linting process altogether?

@rocketinventor
Copy link

There should be a settings file.
The sublime version lets you edit the lint settings with a master settings file, as well as per-project setting file.

@homam
Copy link

homam commented Sep 24, 2015

@hyusetiawan this is what I'm using:

editor.session.on('changeMode', function(e, session){
  if ("ace/mode/javascript" === session.getMode().$id) {
    if (!!session.$worker) {
      session.$worker.send("setOptions", [{
        "-W095": false,
        "-W025": false
      }]);
    }
  }
});

@electron0zero
Copy link

electron0zero commented Jul 14, 2016

i had to silence <something> is not defined warning so is modified @homam 's code like this

editor.session.on('changeMode', function(e, session){
      if ("ace/mode/javascript" === session.getMode().$id) {
          if (!!session.$worker) {
              session.$worker.send("setOptions", [{
                  "-W117": false
              }]);
          }
       }
    }); 

here W117 is warning code of <something> is not defined warning which i looked up in worker-javascript.js file.

@yihchu
Copy link

yihchu commented Feb 10, 2018

hei, if i just want to ignore some keyword in ' is not defined', e.g, i just want to ignore 'dog' and 'cat', how can i do

@quinton-ashley
Copy link

For anyone wondering how to change esversion in the linter scroll to the end of this issue: #3160

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

No branches or pull requests

9 participants