@putout/quick-lint
Version:
quick-lint-js as library
65 lines (52 loc) • 1.67 kB
Markdown
[]: https://img.shields.io/npm/v/@putout/quick-lint.svg?style=flat
[]: https://github.com/putoutjs/quick-lint/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[]: https://github.com/putoutjs/quick-lint/workflows/Node%20CI/badge.svg
[]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[]: https://npmjs.org/package/@putout/quick-lint "npm"
[]: https://tldrlegal.com/license/mit-license "MIT License"
[]: https://coveralls.io/github/putoutjs/quick-lint?branch=master
[]: https://coveralls.io/repos/putoutjs/quick-lint/badge.svg?branch=master&service=github
[](https://quick-lint-js.com/) as library.
`npm i @putout/quick-lint --save`
```ts
interface Options {
isJSX: boolean;
isTS: boolean;
startLine: number;
}
```
```js
const quickLint = require('@putout/quick-lint');
const option = `
function x() {
await m();
}
`;
quickLint(source, {
isJSX: true,
isTS: false,
startLine: 0, // default
});
// returns
[{
rule: 'parser (quick-lint-js)',
message: '\'await\' is only allowed in async functions',
position: {
line: 2,
column: 8,
},
}, {
rule: 'parser (quick-lint-js)',
message: 'use of undeclared variable: m',
position: {
line: 2,
column: 14,
},
}];
```
MIT