How to use xo - 7 common examples

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 t2t2 / obs-tablet-remote / .eslintrc.js View on Github external
const path = require('path') // eslint-disable-line import/no-extraneous-dependencies
const {buildConfig, preprocess} = require('xo/lib/options-manager')

const xoConfig = buildConfig(preprocess({
	semicolon: false,
	extends: [
		'plugin:vue/recommended'
	],
	rules: {
		// 'object-curly-spacing': ['error', 'always'],
		'valid-jsdoc': 0,
		'vue/html-indent': ['error', 'tab']
	},
	settings: {
		'import/resolver': {
			webpack: {
				config: path.resolve('./node_modules/@vue/cli-service/webpack.config.js')
			}
		}
	}
github xojs / gulp-xo / index.js View on Github external
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) {
			result = xo.getErrorResults(result);
		}

		file.eslint = result[0];

		if (file.eslint.output) {
			file.contents = Buffer.from(file.eslint.output);
			file.eslint.fixed = true;
		}

		callback(null, file);
	});
};
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) {
github clippedjs / clipped / plugins / eslint / clipped.config.js View on Github external
api.hook('lint').add('xo', async api => {
          const xo = require('xo')

          const report = await xo.lintFiles([], {
            ...api.config.eslint.toConfig(),
            extensions,
            fix
          })
          if (fix) {
            xo.outputFixes(report)
          }
          const formatter = xo.getFormatter(format)

          if (report.errorCount || report.warningCount) {
            api.print(formatter(report.results))
          } else {
            api.print(
              report.results.some(f => f.output)
                ? '🎉  All lint errors auto-fixed'
                : '🎉  No lint errors found'
            )
          }
        })
      }
github xojs / gulp-xo / index.js View on Github external
module.exports[fn] = (formatter, writable) => (
		eslint[fn](formatter ? xo.getFormatter(formatter) : formatterPretty, writable)
	);
}
github clippedjs / clipped / plugins / eslint / clipped.config.js View on Github external
api.hook('lint').add('xo', async api => {
          const xo = require('xo')

          const report = await xo.lintFiles([], {
            ...api.config.eslint.toConfig(),
            extensions,
            fix
          })
          if (fix) {
            xo.outputFixes(report)
          }
          const formatter = xo.getFormatter(format)

          if (report.errorCount || report.warningCount) {
            api.print(formatter(report.results))
          } else {
            api.print(
              report.results.some(f => f.output)
                ? '🎉  All lint errors auto-fixed'
                : '🎉  No lint errors found'
github clippedjs / clipped / plugins / eslint / clipped.config.js View on Github external
api.hook('lint').add('xo', async api => {
          const xo = require('xo')

          const report = await xo.lintFiles([], {
            ...api.config.eslint.toConfig(),
            extensions,
            fix
          })
          if (fix) {
            xo.outputFixes(report)
          }
          const formatter = xo.getFormatter(format)

          if (report.errorCount || report.warningCount) {
            api.print(formatter(report.results))
          } else {
            api.print(
              report.results.some(f => f.output)
                ? '🎉  All lint errors auto-fixed'
                : '🎉  No lint errors found'
            )
          }
        })
      }

xo

JavaScript/TypeScript linter (ESLint wrapper) with great defaults

MIT
Latest version published 4 months ago

Package Health Score

77 / 100
Full package analysis