How to programmatically lint code?
See original GitHub issueI’m currently working on a tool to quickly generate template code based on user preferences (https://github.com/AlCalzone/create-adapter). As part of this, I want to let the user choose his preferred style of quotes. For JS, this is quite easy using the ESLint API:
export function jsFixQuotes(sourceText: string, quotes: "single" | "double"): string {
const linter = new Linter();
const result = linter.verifyAndFix(sourceText, {
// rules here...
});
return result.output;
}
I’ve been looking for a way to do that for TypeScript, but I can’t seem to find anything similar in the TSLint docs. Your project seems to support this, but I’m not sure how to use it programmatically.
Can you give me a pointer in the right direction?
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Invoking Pylint programmatically - python
Take a look at the pylint/epylint.py file which contains two different ways to start Pylint programmatically. You can also simply call
Read more >What is linting and how can it save you time?
Simply put, a linter is a tool that programmatically scans your code with the goal of finding issues that can lead to bugs...
Read more >Pylint Static Code Analysis | Executing with Command Line vs ...
First make a python file in your project directory at the same level you ran the above script, I will call it simple.py...
Read more >Running Pylint — Pylint 2.13.9 documentation
Run() function in the ; pylint.lint module (assuming Pylint options are stored in a list of strings ; pylint_options ) as:.
Read more >Node.js API - ESLint - Pluggable JavaScript Linter
This class depends on the Node.js fs module and the file system, so you cannot use it in browsers. If you want to...
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
There you have it:
Feel free to use it in any way you want. I don’t claim any copyright on this snippet.
If you have any questions, just ask.
@AlCalzone sure thing. I’m trying to get this ready this evening or tomorrow morning.