Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including grunt-standard with all npm packages installed. Try it out:

var gruntStandard = require("grunt-standard")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

grunt-standard v3.2.0

Grunt Plugin for JavaScript Standard Style Linting and Formatting

grunt-standard Travis JavaScript Standard Style npm (scoped) license GitHub issues GitHub followers

Grunt Plugin for JavaScript Standard Style Linting and Formatting

Dependencies up-to-date!

Install

The following shell commands will install grunt-standard to your project's package.json in devDependencies.

npm

npm install grunt-standard --save-dev

Yarn

yarn add grunt-standard --dev

Assumptions

  • You have the latest version of grunt in your project's package.json's devDependencies.
  • You have added the npm task to your project's Gruntfile.js.
  • You are running node >= 4.
grunt.loadNpmTasks('grunt-standard')

Notes

  • If you are running node < 4 use 2.15.0

Configure

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

Default

In this example, the default options are used to lint the specified *.js files in the root, lib/, and tasks/ directories:

grunt.initConfig({
  standard: {
    app: {
      src: [
        '{,lib/,tasks/}*.js'
      ]
    }
  }
})

Custom

options.ignore

options.cwd

  • Type: String
  • Default: ''
  • Action: current working directory (default: process.cwd()) Documentation.

options.fix

  • Type: Boolean
  • Default: false
  • Action: Auto-format source files using standard --fix.

options.globals

  • Type: Array
  • Default: []
  • Action: global variables to declare Documentation.

options.plugins

options.envs

  • Type: Array
  • Default: []
  • Action: eslint environment Valid Values.

options.parser

  • Type: Array
  • Default: ''
  • Action: js parser (e.g. babel-eslint) Documentation.

In this example, the fix option is set to true so the source files will be auto-formatted (and written back to disk) before being linted:

grunt.initConfig({
  standard: {
    options: {
      fix: true
    },
    app: {
      src: [
        '{,lib/,tasks/}*.js'
      ]
    }
  }
})

Contribute

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free