Grunt Plugin for JavaScript Standard Style Linting and Formatting
> Grunt Plugin for JavaScript Standard Style Linting and Formatting
> Dependencies up-to-date!
The following shell commands will install grunt-standard to your project's package.json in devDependencies.
shell
npm install grunt-standard --save-dev
`$3
`shell
yarn add grunt-standard --dev
`$3
- 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.`javascript
grunt.loadNpmTasks('grunt-standard')
`$3
- If you are running
node < 4 use 2.15.0Configure
In your project's
Gruntfile.js, add a section named standard to the data object passed into grunt.initConfig().$3
In this example, the default options are used to lint the specified
*.js files in the root, lib/, and tasks/ directories:`javascript
grunt.initConfig({
standard: {
app: {
src: [
'{,lib/,tasks/}*.js'
]
}
}
})
`$3
#### options.ignore
- Type:
Array
- Default: []
- Action: Lint source files using JavaScript Standard Style.#### 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
- Type:
Array
- Default: []
- Action: eslint plugins Documentation.#### 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:`javascript
grunt.initConfig({
standard: {
options: {
fix: true
},
app: {
src: [
'{,lib/,tasks/}*.js'
]
}
}
})
``