import { CLIEngine } from 'eslint' ; import { ToolingLog } from '@kbn/dev-utils' ; import { File } from '../file' ; param { ToolingLog } log param { Array < File > } files return { Array < File > } export function pickFilesToLint ( log , files ) { const cli = new CLIEngine ( { } ) ; return files . filter ( ( file ) => { if ( ! file . isJs ( ) && ! file . isTypescript ( ) ) { return ; } const path = file . getRelativePath ( ) ; if ( cli . isPathIgnored ( path ) ) { log . warning ( `[eslint] %j ignored by .eslintignore` , file ) ; return false ; } log . debug ( '[eslint] linting %j' , file ) ; return true ; } ) ; }