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 · 10 comments

Comments

Projects
None yet
8 participants
@NodeGuy

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

This comment has been minimized.

Show comment
Hide comment
@nightwing

nightwing Sep 3, 2012

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

Member

nightwing commented Sep 3, 2012

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

This comment has been minimized.

Show comment
Hide comment
@NodeGuy

NodeGuy Jun 28, 2013

Thank you. How do I use this?

NodeGuy commented Jun 28, 2013

Thank you. How do I use this?

@nightwing

This comment has been minimized.

Show comment
Hide comment
@nightwing

nightwing Jun 28, 2013

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)
Member

nightwing commented Jun 28, 2013

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

This comment has been minimized.

Show comment
Hide comment
@NodeGuy

NodeGuy Jul 21, 2013

Thank you!

NodeGuy commented Jul 21, 2013

Thank you!

@homam

This comment has been minimized.

Show comment
Hide comment
@homam

homam 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 }])

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

This comment has been minimized.

Show comment
Hide comment
@hyusetiawan

hyusetiawan Sep 23, 2015

@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?

hyusetiawan commented Sep 23, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@rocketinventor

rocketinventor Sep 24, 2015

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.

rocketinventor commented Sep 24, 2015

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

This comment has been minimized.

Show comment
Hide comment
@homam

homam 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
      }]);
    }
  }
});

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

This comment has been minimized.

Show comment
Hide comment
@electron0zero

electron0zero 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.

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

This comment has been minimized.

Show comment
Hide comment
@yihchu

yihchu 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

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

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