项目作者: EasyAsABC123

项目描述 :
Grunt task for stylish linter
高级语言: JavaScript
项目地址: git://github.com/EasyAsABC123/grunt-standard.git
创建时间: 2015-04-19T19:51:35Z
项目社区:https://github.com/EasyAsABC123/grunt-standard

开源协议:MIT License

下载


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

  1. npm install grunt-standard --save-dev

Yarn

  1. 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.
  1. 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:

  1. grunt.initConfig({
  2. standard: {
  3. app: {
  4. src: [
  5. '{,lib/,tasks/}*.js'
  6. ]
  7. }
  8. }
  9. })

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:

  1. grunt.initConfig({
  2. standard: {
  3. options: {
  4. fix: true
  5. },
  6. app: {
  7. src: [
  8. '{,lib/,tasks/}*.js'
  9. ]
  10. }
  11. }
  12. })

Contribute