npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

gulp-canonical

1.0.0

@gajus

npmHomeRepoSnykSocket
Downloads:0
$ npm install gulp-canonical
DailyWeeklyMonthlyYearly

Canonical

Using Canonical does not require a special gulp package. Canonical has a programmatic interface to access all its features. You can use it in combination with a glob package, such as globby to lint multiple files, e.g.

import gulp from 'gulp';
import glob from 'globby';

import {
    lintText,
    lintFiles,
    getFormatter
} from 'canonical';

gulp.task('lint-javascript', () => {
    return glob(['./**/*.js'])
        .then((paths) => {
            let formatter,
                report;

            formatter = getFormatter();
            report = lintFiles(paths);

            if (report.errorCount || report.warningCount) {
                console.log(formatter(report.results));
            }
        });
});

Note that this file example is written using ES6 syntax. If you want your gulpfile.js to use ES6 syntax, you have to execute it using Babel or an equivalent code-to-code compiler (ES6 to ES6), e.g.

babel-node ./node_modules/.bin/gulp lint-javascript