Repository navigation
Replies: 4 comments 2 replies
|
I would suggest the similar API as eslint (if possible) :) All of this depends on what's the goal of the linter.
the public API can be something like const config = {
globals: {},
rules: {},
};
const options = {
fix: true/false,
filename: string,
//...
};
kataw.lint(code, config, options);just my 2 cents! :) |
1 reply
|
Kataw are undergoing a mayor refactoring (not released yet) so the linter config and options has now changed. The Each of this The This is Kataw's config file: {
"files": ["**/*.js"],
"module": false,
"typecheck": false,
"linter": {
"enable": true,
"extends": [
"kataw:recommended"
],
"rules": {},
"rulesDirectory": []
},
"minify": {
"enable": false,
"options": {}
},
"prettify": {
"enable": true,
"options": {}
}
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The basic idea for the linter is to add an
autoFixoption to the parser and let the parser fix "fixable" errors during parsing, and eventually report an diagnostic . Some "errors" are an easy fix such as double quote vs single quote - it only require to swap the bitwise masks before the printer print the CST node.Implementing a linter this way eliminates the need for an external walker, and maintain perf.
There are things to consider before implementing this
How should the API look like? It can't be part of the main parser option because it will be too many options.
How could we implement additional rules?
All reactions