Skip to content

teppeis/grunt-fixclosure

Repository files navigation

grunt-fixclosure

Grunt plugin for fixclosure.

NPM version Node.js version support Build Status MIT License

Getting Started

This plugin requires Grunt >=0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install -D grunt-fixclosure fixclosure

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks("grunt-fixclosure");

The "fixclosure" task

Overview

In your project's Gruntfile, add a section named fixclosure to the data object passed into grunt.initConfig().

grunt.initConfig({
  fixclosure: {
    options: {
      fixInPlace: true,
    },
    all: {
      src: ["path/to/**/*.js"],
    },
  },
});

Options

options.fixInPlace

Type: Boolean Default value: false

Enable --fix-in-place option of fixclosure. If true, fixclosure fixes invalid files in place.

Usage Examples

Lint

By default, grunt-fixclosure just lint JS files. If invalid files found, grunt fixclosrue exits with non-zero error code. It's useful for CI task.

grunt.initConfig({
  fixclosure: {
    lint: {
      src: ["path/to/**/*.js"],
    },
  },
});

Fix

With fixInPlace option, grunt fixclosure finds invalid files and fixes them.

grunt.initConfig({
  fixclosure: {
    fix: {
      fixInPlace: true,
      src: ["path/to/**/*.js"],
    },
  },
});

Also you can specify it with command-line option --fixclosure-fix-in-place.

$ grunt fixclosure --fixclosure-fix-in-place

Release History

License

Copyright (c) 2016 Teppei Sato <[email protected]>. Licensed under the MIT license.