gea

gulp-eslint-auto-fix

Makes a Gulp task that watches JavaScript files for changes and uses ESLint to fix their formatting.

Showing:

Popularity

Downloads/wk

45

GitHub Stars

2

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

95.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Gulp ESLint Auto-Fix

Makes a Gulp task that watches your files for changes, runs them through ESLint's fix function, then overwrites them if they have been fixed.

It's good for productivity, helping your team conform to whatever JS style guide you choose without worrying about text editor plugins or additional setup. Heck, you could have different projects using totally different style guides, and your developers won't care whether they have to write semicolons or not.

Usage

In your gulpfile.js, create a task by giving it a name, and an array of file globs to watch like so:

const autoFixTask = require('gulp-eslint-auto-fix')

autoFixTask('fix-js', [
  'app/**/*.js',
  'test/**/*.js'
])

Then you can run that gulp task in your terminal:

$ gulp fix-js

Next time you save a file with code like this:

function qux (foo,bar){
return foo+bar}

It will be automatically converted into code that adheres to your style guide, so it could become this:

function qux(foo, bar) {
  return foo + bar;
}

Defaults

If you don't provide the task's name, it will be called "eslint-auto-fix".

If you don't provide the file globs to watch, it will watch all files ending in '.js' that are not inside node_modules nor bower_components.

Dependencies

This module has peer dependencies on Gulp and ESLint. If you don't already have those installed in your project, add them to your "devDependencies" in package.json. If anything weird is going on, check the version requirements and let me know.

Configuration

None. This will honor whatever configuration you have already set up for ESLint.

Limitations

What can be fixed is limited by what ESLint can fix. See their rules page for all the fixable rules.

Known Issues

ESLint parse errors will prevent the task from starting. If your code is really busted, the auto-fixer will not save you! However once you get the task running, but then create a parse error in what was previously good, runnable code, then the auto-fixer will send the error to your console.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial