Skip to content

Files

Latest commit

 

History

History

weslint

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

weslint npm

Worker Threads + ESlint.

⚠️ Node.js v10 needs an --experimental-worker flag.

Install

$ yarn add weslint

API

type TWeslintOptions = {
  files: string[],
  maxThreadCount?: number,
  formatter?: string,
  eslint?: CLIEngine.Options,
}

type TWeslintResult = {
  hasErrors: boolean,
  hasWarnings: boolean,
  formattedReport: string,
}

const weslint: (options: TWeslintOptions) => Promise<TWeslintResult>

Usage

import { weslint } from 'weslint'

const result = await weslint({
  files: ['./file1.ts', './file2.ts']
})

if (result.hasErrors || result.hasWarnings) {
  console.log(result.formattedReport)
}

if (result.hasErrors) {
  throw new Error('oops')
}