quick-lint-js as library.
npm i @putout/quick-lint --save
interface Options {
isJSX: boolean;
isTS: boolean;
startLine: number;
}
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