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

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

Reply via email to