How to use the xo.lintText function in xo

To help you get started, we’ve selected a few xo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xojs / gulp-xo / index.js View on Github external
return through.obj(function (file, encoding, callback) {
		if (file.isNull()) {
			callback(null, file);
			return;
		}

		if (file.isStream()) {
			callback(new PluginError('gulp-xo', 'Streaming not supported'));
			return;
		}

		let report;
		try {
			report = xo.lintText(file.contents.toString(), {
				cwd: file.cwd,
				filename: file.path,
				fix: options.fix
			});
		} catch (error) {
			this.emit('error', new PluginError('gulp-xo', error, {fileName: file.path}));
		}

		let result = report.results;

		if (result.length === 0) {
			callback(null, file);
			return;
		}

		if (options.quiet) {

xo

JavaScript/TypeScript linter (ESLint wrapper) with great defaults

MIT
Latest version published 4 months ago

Package Health Score

77 / 100
Full package analysis