Programmatic API
See original GitHub issueESLint should have a programmatic API that let’s you easily use it a normal node module. It should be fully decoupled from the CLI, and the CLI should use the programmatic API underneath.
Having to use the CLI interface directly comes with a lot of assumptions and stdout noise.
I’m not really sure what the API should look like as I’m not aware of all the use-cases, but it should be simple.
Maybe something like this:
var linter = new ESLint({
files: [],
formatter: require('eslint-json')
});
linter.on('warning', function (warning) {
console.log('ESLint:', warning);
});
linter.run(function (err, result) {
console.log(result);
//=> { errors: { ... }, ... }
});
Nothing should be automatically outputted to stdout/stderr when using the programmatic API.
It should allow supplying both paths and file contents as strings, so to support all possible use-cases.
Having a real programmatic API is important to make it easy to integrate ESLint into existing systems.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:14 (12 by maintainers)
Top Results From Across the Web
Programmatic API - Picocli
The programmatic API allows applications to dynamically create command line options on the fly, and also makes it possible to create idiomatic ...
Read more >Programmatic APIs - Oracle Help Center
The Berkeley DB subsystems can be accessed through interfaces from multiple languages. Applications can use Berkeley DB via C, C++ or Java, ...
Read more >Programmatic | Ad Manager API - Google Developers
This guide is a high-level overview of how to use Programmatic Direct features via the API. It describes how to create a Proposal...
Read more >Programmatic APIs - IBM
A set of supported Java APIs are available to customize elements of ContentBox. Note: Only Dashboard Application Services Hub APIs from the com.ibm.isc.api....
Read more >Benefits of Integrating a Programmatic API Into Your Platform
Programmatic APIs mean it's now possible to introduce or build a paid media capability, making adtech part of your platform.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there and example in the docs somewhere on how to use ESLint programatically?
EDIT: This looks like a good example: https://github.com/makepanic/broccoli-eslint/blob/master/lib/index.js
Working on this. I see it as blocking #963 because the current CLI doesn’t give an easy way to see the produced messages.