I want to try to restate what you (Michael) are saying in this post to see if I understand correctly:
1. You have a desire to have two different linters running within the same program with different configurations. 2. You would much rather instantiate a linter than have a singleton. 3. It seems like you're a bit confused about the rule of the context object in rules (I'm not quite sure what your last sentence means). 4. You would like the ability to run ESLint asynchronously (I'm assuming based on the callack to lint()). Did I get those right? On Wed, Nov 20, 2013 at 8:53 AM, Nicholas Zakas <[email protected]>wrote: > Pasting from Michael Ficarra's message in the GitHub issue: > > >> > > I was referring to basically what I covered in > #205<https://github.com/nzakas/eslint/issues/205>. > The eslint interface is quite frankly unusable. I can't pass two > preconfigured linters to two separate functions for them to run on two > separate programs. I can't configure a linter and then run it on a program > in a continuation because I can't guarantee some other event in the loop > hasn't either run it on a different program or reset it. This would be a > much better interface: > > var eslint = require('eslint'); > // generate a linter that has no rules enabled > var linter = new eslint.Linter; > // enable the default rules with the default options > linter.useDefaultRules(); > // enable another rule > linter.use(eslint.rules[someRuleName], {severity: eslint.WARN}); > // a custom rule > linter.use(function(context){ /* rule generator, just like today */ }, /* > options */); > // run it! > linter.lint(esprima.parse(js), function(lintingError, listOfViolations, > listOfWarnings) { > // as long as there was no lintingError, do something with the > listOfViolations and listOfWarnings > }); > // other instances have nothing to do with the first one > var anotherLinter = new eslint.Linter; > > Also, the rules themselves have to get passed an actual context object > instead of a reference to the module itself, which is constantly mutating. > > -- > > ______________________________ > Nicholas C. Zakas > @slicknet > > Author, Professional JavaScript for Web Developers > Buy it at Amazon.com: > http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_3 > -- ______________________________ Nicholas C. Zakas @slicknet Author, Professional JavaScript for Web Developers Buy it at Amazon.com: http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_3 -- You received this message because you are subscribed to the Google Groups "ESLint" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
