仓库指标
- Star
- (383 star)
- PR 合并指标
- (PR 指标待抓取)
描述
The current API docs: https://github.com/saadq/lynt#api
There should be an example that shows how project works with the TypeScript flag. By default, if no project flag is passed and the files argument is an empty array, lynt will assume that project is in the current working directory . and will look for a tsconfig.json there.
import lynt from 'lynt'
const options = {
typescript: true
}
const results = lynt([], options) // Will look for `./tsconfig.json` and use that to know which files to lint in the project.
A project option can be explicitly passed if tsconfig.json isn't in the current directory (like in ./config/tsconfig.json):
import lynt from 'lynt'
const options = {
typescript: true,
project: './config'
}
const results = lynt([], options) // Will look for `./config/tsconfig.json` and use that to know which files to lint in the project.
If files are given, a project flag should not be passed in (because it will just ignore the files and just use the tsconfig in the project to know which files to lint). However, passing files when using the typescript option will make you opt-out of some lint rules that require type information from the whole project, so passing in files is not recommended.
// Not recommended
import lynt from 'lynt'
const files = ['./foo.ts', './bar.ts']
const options = {
typescript: true
}
const results = lynt(files, options)