Skip to content

putoutjs/quick-lint

Repository files navigation

Quick Lint License NPM version Build Status Coverage Status

quick-lint-js as library.

Install

npm i @putout/quick-lint --save

API

quickLint(source: string, options: Options)

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,
    },
}];

License

MIT