question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ESLint 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:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
dannyfritzcommented, Aug 22, 2014

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

0reactions
nzakascommented, Jun 21, 2014

Working on this. I see it as blocking #963 because the current CLI doesn’t give an easy way to see the produced messages.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found