@doamatto/gulp-eslint

    6.2.8 • Public • Published

    gulp-eslint FOSSA Status

    A gulp plugin for ESLint based off Adametry's gulp-eslint package

    Installation

    yarn add -D @doamatto/gulp-eslint
    
    npm install --dev @doamatto/gulp-eslint

    Usage

    const {src, task} = require('gulp');
    const eslint = require('gulp-eslint');
    
    task('default', () => {
        return src(['scripts/*.js'])
            // eslint() attaches the lint output to the "eslint" property
            // of the file object so it can be used by other modules.
            .pipe(eslint())
            // eslint.format() outputs the lint results to the console.
            // Alternatively use eslint.formatEach() (see Docs).
            .pipe(eslint.format())
            // To have the process exit with an error code (1) on
            // lint error, return the stream and pipe to failAfterError last.
            .pipe(eslint.failAfterError());
    });

    Or use the plugin API to do things like:

    gulp.src(['**/*.js','!node_modules/**'])
    	.pipe(eslint({
    		rules: {
    			'my-custom-rule': 1,
    			'strict': 2
    		},
    		globals: [
    			'jQuery',
    			'$'
    		],
    		envs: [
    			'browser'
    		]
    	}))
    	.pipe(eslint.formatEach('compact', process.stderr));

    For additional examples, look through the example directory.

    API

    You can read this plugin's documentation here, which should answer all your questions you might have. If you still have some, see if an issue hasn't already been made and (if it isn't a duplicate) create an issue. We'll try to help out ASAP.

    Configuration

    ESLint may be configured explicity by using any of the following plugin options: config, rules, globals, or env. If the useEslintrc option is not set to false, ESLint will attempt to resolve a file by the name of .eslintrc within the same directory as the file to be linted. If not found there, parent directories will be searched until .eslintrc is found or the directory root is reached.

    Ignore Files

    ESLint will ignore files that do not have a .js file extension at the point of linting (some plugins may change file extensions mid-stream). This avoids unintentional linting of non-JavaScript files.

    ESLint will also detect an .eslintignore file at the cwd or a parent directory. See the ESLint docs to learn how to construct this file.

    Extensions

    ESLint results are attached as an "eslint" property to the vinyl files that pass through a Gulp.js stream pipeline. This is available to streams that follow the initial eslint stream. The eslint.result and eslint.results methods are made available to support extensions and custom handling of ESLint results.

    Gulp ESLint Extensions:

    License

    FOSSA Status

    Install

    npm i @doamatto/gulp-eslint

    DownloadsWeekly Downloads

    15

    Version

    6.2.8

    License

    MIT

    Unpacked Size

    28 kB

    Total Files

    6

    Last publish

    Collaborators

    • doamatto