standard-engine icon indicating copy to clipboard operation
standard-engine copied to clipboard

Ability to skip running lintTextSync for ignored files

Open segrey opened this issue 6 years ago • 0 comments

What version of this package are you using? 14.3.1

What problem do you want to solve?

Standard provides results = standard.lintTextSync(text, [opts]) API. This is a convenient way for tools to interact with the linter, because there is no need to save a file to disk. The problem is that this method doesn't check if the passed opts.filename is ignored. Also there is no dedicated method in API to check if a file is ignored.

For example, ESLint provides both CLIEngine#executeOnText() and CLIEngine#isPathIgnored().

What do you think is the correct solution to this problem?

A possible way is to mimic ESLint API and provide standard.isPathIgnored(filename, [opts]) where opts is the same as for standard.lintFiles(files, [opts], callback), i.e. opts.ignore is supported. Or extend results = standard.lintTextSync(text, [opts]) API to support opts.ignore: no linting if opts.filename is matched by opts.ignore.

segrey avatar Nov 05 '19 21:11 segrey