├── .editorconfig ├── .eslintrc.json ├── .gitattributes ├── .gitignore ├── .travis.yml ├── .verb.md ├── LICENSE ├── README.md ├── docs ├── demo.gif ├── example-eslintrc.md ├── example-ignore.md └── what-will-happen.md ├── generator.js ├── index.js ├── package.json ├── templates ├── _eslintignore └── _eslintrc.json └── test.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | end_of_line = lf 6 | charset = utf-8 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{**/{actual,fixtures,expected,templates}/**,*.md}] 12 | trim_trailing_whitespace = false 13 | insert_final_newline = false -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaFeatures": { 3 | "modules": true, 4 | "experimentalObjectRestSpread": true 5 | }, 6 | 7 | "env": { 8 | "browser": false, 9 | "es6": true, 10 | "node": true, 11 | "mocha": true 12 | }, 13 | 14 | "globals": { 15 | "document": false, 16 | "navigator": false, 17 | "window": false 18 | }, 19 | 20 | "rules": { 21 | "accessor-pairs": 2, 22 | "arrow-spacing": [2, { "before": true, "after": true }], 23 | "block-spacing": [2, "always"], 24 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 25 | "comma-dangle": [2, "never"], 26 | "comma-spacing": [2, { "before": false, "after": true }], 27 | "comma-style": [2, "last"], 28 | "constructor-super": 2, 29 | "curly": [2, "multi-line"], 30 | "dot-location": [2, "property"], 31 | "eol-last": 2, 32 | "eqeqeq": [2, "allow-null"], 33 | "generator-star-spacing": [2, { "before": true, "after": true }], 34 | "handle-callback-err": [2, "^(err|error)$" ], 35 | "indent": [2, 2, { "SwitchCase": 1 }], 36 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 37 | "keyword-spacing": [2, { "before": true, "after": true }], 38 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 39 | "new-parens": 2, 40 | "no-array-constructor": 2, 41 | "no-caller": 2, 42 | "no-class-assign": 2, 43 | "no-cond-assign": 2, 44 | "no-const-assign": 2, 45 | "no-control-regex": 2, 46 | "no-debugger": 2, 47 | "no-delete-var": 2, 48 | "no-dupe-args": 2, 49 | "no-dupe-class-members": 2, 50 | "no-dupe-keys": 2, 51 | "no-duplicate-case": 2, 52 | "no-empty-character-class": 2, 53 | "no-eval": 2, 54 | "no-ex-assign": 2, 55 | "no-extend-native": 2, 56 | "no-extra-bind": 2, 57 | "no-extra-boolean-cast": 2, 58 | "no-extra-parens": [2, "functions"], 59 | "no-fallthrough": 2, 60 | "no-floating-decimal": 2, 61 | "no-func-assign": 2, 62 | "no-implied-eval": 2, 63 | "no-inner-declarations": [2, "functions"], 64 | "no-invalid-regexp": 2, 65 | "no-irregular-whitespace": 2, 66 | "no-iterator": 2, 67 | "no-label-var": 2, 68 | "no-labels": 2, 69 | "no-lone-blocks": 2, 70 | "no-mixed-spaces-and-tabs": 2, 71 | "no-multi-spaces": 2, 72 | "no-multi-str": 2, 73 | "no-multiple-empty-lines": [2, { "max": 1 }], 74 | "no-native-reassign": 0, 75 | "no-negated-in-lhs": 2, 76 | "no-new": 2, 77 | "no-new-func": 2, 78 | "no-new-object": 2, 79 | "no-new-require": 2, 80 | "no-new-wrappers": 2, 81 | "no-obj-calls": 2, 82 | "no-octal": 2, 83 | "no-octal-escape": 2, 84 | "no-proto": 0, 85 | "no-redeclare": 2, 86 | "no-regex-spaces": 2, 87 | "no-return-assign": 2, 88 | "no-self-compare": 2, 89 | "no-sequences": 2, 90 | "no-shadow-restricted-names": 2, 91 | "no-spaced-func": 2, 92 | "no-sparse-arrays": 2, 93 | "no-this-before-super": 2, 94 | "no-throw-literal": 2, 95 | "no-trailing-spaces": 0, 96 | "no-undef": 2, 97 | "no-undef-init": 2, 98 | "no-unexpected-multiline": 2, 99 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 100 | "no-unreachable": 2, 101 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 102 | "no-useless-call": 0, 103 | "no-with": 2, 104 | "one-var": [0, { "initialized": "never" }], 105 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 106 | "padded-blocks": [0, "never"], 107 | "quotes": [2, "single", "avoid-escape"], 108 | "radix": 2, 109 | "semi": [2, "always"], 110 | "semi-spacing": [2, { "before": false, "after": true }], 111 | "space-before-blocks": [2, "always"], 112 | "space-before-function-paren": [2, "never"], 113 | "space-in-parens": [2, "never"], 114 | "space-infix-ops": 2, 115 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 116 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 117 | "use-isnan": 2, 118 | "valid-typeof": 2, 119 | "wrap-iife": [2, "any"], 120 | "yoda": [2, "never"] 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | * text eol=lf 3 | 4 | # binaries 5 | *.ai binary 6 | *.psd binary 7 | *.jpg binary 8 | *.gif binary 9 | *.png binary 10 | *.jpeg binary 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # always ignore files 2 | *.DS_Store 3 | *.sublime-* 4 | 5 | # test related, or directories generated by tests 6 | test/actual 7 | actual 8 | coverage 9 | .nyc* 10 | 11 | # npm 12 | node_modules 13 | npm-debug.log 14 | 15 | # yarn 16 | yarn.lock 17 | yarn-error.log 18 | 19 | # misc 20 | _gh_pages 21 | _draft 22 | _drafts 23 | bower_components 24 | vendor 25 | temp 26 | tmp 27 | TODO.md 28 | package-lock.json -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | os: 3 | - linux 4 | - osx 5 | language: node_js 6 | node_js: 7 | - node 8 | - '8' 9 | - '7' 10 | - '6' 11 | - '5' 12 | - '4' 13 | - '0.12' 14 | - '0.10' 15 | -------------------------------------------------------------------------------- /.verb.md: -------------------------------------------------------------------------------- 1 | ## History 2 | 3 | **0.2.0 - 2016-07-27** 4 | 5 | - Renamed the `eslint` task to `eslintrc`. This will mostly likely only be used by API, so make sure you update any references to `eslint:eslint` to be `eslint:eslintrc` 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017, Jon Schlinkert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 | 6 |

7 | 8 | Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be used from the command line when installed globally, or as a plugin in your own generator. 9 | 10 | # generate-eslint 11 | 12 | [![NPM version](https://img.shields.io/npm/v/generate-eslint.svg?style=flat)](https://www.npmjs.com/package/generate-eslint) [![NPM monthly downloads](https://img.shields.io/npm/dm/generate-eslint.svg?style=flat)](https://npmjs.org/package/generate-eslint) [![Build Status](https://img.shields.io/travis/generate/generate-eslint.svg?style=flat)](https://travis-ci.org/generate/generate-eslint) 13 | 14 | ![generate-eslint demo](https://raw.githubusercontent.com/generate/generate-eslint/master/docs/demo.gif) 15 | 16 |
17 | Table of Contents 18 | 19 | - [History](#history) 20 | - [Getting started](#getting-started) 21 | * [Install](#install) 22 | * [CLI](#cli) 23 | * [Help](#help) 24 | - [Available tasks](#available-tasks) 25 | * [default](#default) 26 | * [eslintrc](#eslintrc) 27 | * [ignore](#ignore) 28 | - [Next steps](#next-steps) 29 | * [Running unit tests](#running-unit-tests) 30 | * [Publishing your generator](#publishing-your-generator) 31 | - [About](#about) 32 | * [What is "Generate"?](#what-is-generate) 33 | * [Related projects](#related-projects) 34 | * [Community](#community) 35 | * [Contributing](#contributing) 36 | * [Running tests](#running-tests) 37 | * [Author](#author) 38 | * [License](#license) 39 | 40 | _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ 41 | 42 |
43 | 44 | ## History 45 | 46 | **0.2.0 - 2016-07-27** 47 | 48 | * Renamed the `eslint` task to `eslintrc`. This will mostly likely only be used by API, so make sure you update any references to `eslint:eslint` to be `eslint:eslintrc` 49 | 50 | ## Getting started 51 | 52 | ### Install 53 | 54 | **Installing the CLI** 55 | 56 | To run the `readme` generator from the command line, you'll need to install [Generate][] globally first. You can do that now with the following command: 57 | 58 | ```sh 59 | $ npm install --global generate 60 | ``` 61 | 62 | This adds the `gen` command to your system path, allowing it to be run from any directory. 63 | 64 | **Install generate-eslint** 65 | 66 | Install this module with the following command: 67 | 68 | ```sh 69 | $ npm install --global generate-eslint 70 | ``` 71 | 72 | ### CLI 73 | 74 | Run this generator's `default` [task](https://github.com/generate/generate/blob/master/docs/tasks.md#default) with the following command: 75 | 76 | ```sh 77 | $ gen readme 78 | ``` 79 | 80 | **What will happen?** 81 | 82 | Running the `default` task will add or replace the `.eslintrc.json` file in the current working directory with a template from one of the following locations, in order of precedence: 83 | 84 | * defined by you, stored at `~/templates/_eslintrc.json` (user home on your system), or if not defined 85 | * the generic template in this project's [templates](templates) directory. 86 | 87 | **What you should see in the terminal** 88 | 89 | If completed successfully, you should see both `starting` and `finished` events in the terminal, like the following: 90 | 91 | ```sh 92 | [00:44:21] starting ... 93 | ... 94 | [00:44:22] finished ✔ 95 | ``` 96 | 97 | If you do not see one or both of those events, please [let us know about it](../../issues). 98 | 99 | ### Help 100 | 101 | To see a general help menu and available commands for Generate's CLI, run: 102 | 103 | ```sh 104 | $ gen help 105 | ``` 106 | 107 | ## Available tasks 108 | 109 | All available tasks for this generator. 110 | 111 | ### [default](generator.js#L21) 112 | 113 | Generate a `.eslintrc.json` file to the current working directory. Described in more detail in the [usage](#usage) section. 114 | 115 | **Example** 116 | 117 | ```sh 118 | $ gen eslint 119 | ``` 120 | 121 | ### [eslintrc](generator.js#L34) 122 | 123 | Alias for the [default](#default) task, to provide a semantic task name for when this generator is used as a plugin or sub-generator. 124 | 125 | **Example** 126 | 127 | ```sh 128 | $ gen eslint:eslintrc 129 | ``` 130 | 131 | ### [ignore](generator.js#L54) 132 | 133 | Generate a `.eslintignore` file to the current working directory. This task is also aliased as `eslintignore` to provide a more semantic task name for when this generator is used as a plugin or sub-generator. 134 | 135 | **Example** 136 | 137 | ```sh 138 | $ gen eslint:ignore 139 | ``` 140 | 141 | Visit Generate's [documentation for tasks](https://github.com/generate/generate/blob/master/docs/tasks.md). 142 | 143 | ## Next steps 144 | 145 | ### Running unit tests 146 | 147 | It's never too early to begin running unit tests. When you're ready to get started, the following command will ensure the project's dependencies are installed then run all of the unit tests: 148 | 149 | ```sh 150 | $ npm install && test 151 | ``` 152 | 153 | ### Publishing your generator 154 | 155 | If you're tests are passing and you're ready to publish your generator to [npm](https://www.npmjs.com), you can do that now with the following command: 156 | 157 | **Are you sure you're ready?!** 158 | 159 | Let's go! 160 | 161 | ```sh 162 | $ npm publish 163 | ``` 164 | 165 | ## About 166 | 167 | ### What is "Generate"? 168 | 169 | Generate is a command line tool and developer framework for scaffolding out new GitHub projects using [generators](https://github.com/generate/generate/blob/master/docs/generators.md) and [tasks](https://github.com/generate/generate/blob/master/docs/tasks.md). 170 | 171 | Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for [gulp](http://gulpjs.com), [base](https://github.com/node-base/base) and [assemble](https://github.com/assemble/assemble) plugins, and much more. 172 | 173 | **For more information**: 174 | 175 | * Visit the [generate project](https://github.com/generate/generate/) 176 | * Visit the [generate documentation](https://github.com/generate/generate/blob/master/docs/) 177 | * Find [generators on npm](https://www.npmjs.com/browse/keyword/generate-generator) (help us [author generators](https://github.com/generate/generate/blob/master/docs/micro-generators.md)) 178 | 179 | ### Related projects 180 | 181 | * [generate-file](https://www.npmjs.com/package/generate-file): Generator for generating a single file from a template. | [homepage](https://github.com/generate/generate-file "Generator for generating a single file from a template.") 182 | * [generate-mocha](https://www.npmjs.com/package/generate-mocha): Generate mocha test files. | [homepage](https://github.com/generate/generate-mocha "Generate mocha test files.") 183 | * [generate-node](https://www.npmjs.com/package/generate-node): Generate a node.js project, with everything you need to begin writing code and easily publish… [more](https://github.com/generate/generate-node) | [homepage](https://github.com/generate/generate-node "Generate a node.js project, with everything you need to begin writing code and easily publish the project to npm.") 184 | * [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate "Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.") 185 | 186 | ### Community 187 | 188 | Are you using [Generate][] in your project? Have you published a [generator](https://github.com/generate/generate/blob/master/docs/generators.md) and want to share your project with the world? 189 | 190 | Here are some suggestions! 191 | 192 | * If you get like Generate and want to tweet about it, please feel free to mention `@generatejs` or use the `#generatejs` hashtag 193 | * Show your love by starring [Generate][] and `generate-eslint` 194 | * Get implementation help on [StackOverflow](http://stackoverflow.com/questions/tagged/generate) (please use the `generatejs` tag in questions) 195 | * **Gitter** Discuss Generate with us on [Gitter](https://gitter.im/generate/generate) 196 | * If you publish an generator, thank you! To make your project as discoverable as possible, please add the keyword `generategenerator` to package.json. 197 | 198 | ### Contributing 199 | 200 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). 201 | 202 | ### Running tests 203 | 204 | Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: 205 | 206 | ```sh 207 | $ npm install && npm test 208 | ``` 209 | 210 | ### Author 211 | 212 | **Jon Schlinkert** 213 | 214 | * [github/jonschlinkert](https://github.com/jonschlinkert) 215 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert) 216 | 217 | ### License 218 | 219 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). 220 | Released under the [MIT License](LICENSE). 221 | 222 | *** 223 | 224 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 25, 2017._ -------------------------------------------------------------------------------- /docs/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/generate/generate-eslint/35aac15d3c86a8db6dc786bfb127e70c40562b5a/docs/demo.gif -------------------------------------------------------------------------------- /docs/example-eslintrc.md: -------------------------------------------------------------------------------- 1 | **Plugin usage** 2 | 3 | Use as a plugin in your generator: 4 | 5 | ```js 6 | app.use(require('{%= name %}')); 7 | app.task('default', ['eslintrc']); 8 | ``` 9 | 10 | **Sub-generator usage** 11 | 12 | Use as a sub-generator: 13 | 14 | ```js 15 | // use whatever name you want 16 | app.register('foo', require('{%= name %}')); 17 | // adds tasks to: 18 | // - `foo:ignore` 19 | // - `foo:eslintrc` 20 | 21 | // use `.generate` to run sub-generator tasks 22 | app.generate('foo:eslintrc', function(err) { 23 | if (err) console.log(err); 24 | }); 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/example-ignore.md: -------------------------------------------------------------------------------- 1 | **Plugin usage** 2 | 3 | Use as a plugin in your generator: 4 | 5 | ```js 6 | app.use(require('{%= name %}')); 7 | app.task('default', ['eslint-ignore']); 8 | ``` 9 | 10 | **Sub-generator usage** 11 | 12 | Use as a sub-generator: 13 | 14 | ```js 15 | // use whatever name you want 16 | app.register('foo', require('{%= name %}')); 17 | // adds tasks to: 18 | // - `foo:ignore` 19 | // - `foo:eslint` 20 | 21 | // use `.generate` to run sub-generator tasks 22 | app.generate('foo:ignore', function(err) { 23 | if (err) console.log(err); 24 | }); 25 | ``` 26 | -------------------------------------------------------------------------------- /docs/what-will-happen.md: -------------------------------------------------------------------------------- 1 | **What will happen?** 2 | 3 | Running the `default` task will add or replace the `.eslintrc.json` file in the current working directory with a template from one of the following locations, in order of precedence: 4 | 5 | - defined by you, stored at `~/templates/_eslintrc.json` (user home on your system), or if not defined 6 | - the generic template in this project's [templates](templates) directory. 7 | -------------------------------------------------------------------------------- /generator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | var templates = path.join(__dirname, 'templates'); 5 | var isValid = require('is-valid-app'); 6 | 7 | module.exports = function(app) { 8 | if (!isValid(app, 'generate-eslint')) return; 9 | 10 | /** 11 | * Generate a `.eslintrc.json` file to the current working directory. Described in more 12 | * detail in the [usage](#usage) section. 13 | * 14 | * ```sh 15 | * $ gen eslint 16 | * ``` 17 | * @name default 18 | * @api public 19 | */ 20 | 21 | app.task('default', {silent: true}, ['eslintrc']); 22 | 23 | /** 24 | * Alias for the [default](#default) task, to provide a semantic task name for 25 | * when this generator is used as a plugin or sub-generator. 26 | * 27 | * ```sh 28 | * $ gen eslint:eslintrc 29 | * ``` 30 | * @name eslintrc 31 | * @api public 32 | */ 33 | 34 | app.task('eslintrc', {silent: true}, function() { 35 | return app.src('_eslintrc.json', {cwd: templates}) 36 | .pipe(app.dest(function(file) { 37 | file.basename = '.eslintrc.json'; 38 | return app.cwd; 39 | })); 40 | }); 41 | 42 | /** 43 | * Generate a `.eslintignore` file to the current working directory. This task 44 | * is also aliased as `eslintignore` to provide a more semantic task name for 45 | * when this generator is used as a plugin or sub-generator. 46 | * 47 | * ```sh 48 | * $ gen eslint:ignore 49 | * ``` 50 | * @name ignore 51 | * @api public 52 | */ 53 | 54 | app.task('ignore', {silent: true}, ['eslintignore']); 55 | app.task('eslintignore', {silent: true}, function() { 56 | return app.src('_eslintignore', {cwd: templates}) 57 | .pipe(app.dest(function(file) { 58 | file.basename = '.eslintignore'; 59 | return app.cwd; 60 | })); 61 | }); 62 | }; 63 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = require('./generator'); 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generate-eslint", 3 | "description": "Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be used from the command line when installed globally, or as a plugin in your own generator.", 4 | "version": "1.0.0", 5 | "homepage": "https://github.com/generate/generate-eslint", 6 | "author": "Jon Schlinkert (https://github.com/jonschlinkert)", 7 | "repository": "generate/generate-eslint", 8 | "bugs": { 9 | "url": "https://github.com/generate/generate-eslint/issues" 10 | }, 11 | "license": "MIT", 12 | "files": [ 13 | "generator.js", 14 | "index.js", 15 | "templates" 16 | ], 17 | "main": "index.js", 18 | "engines": { 19 | "node": ">=0.10.0" 20 | }, 21 | "scripts": { 22 | "test": "mocha" 23 | }, 24 | "dependencies": { 25 | "is-valid-app": "^0.3.0" 26 | }, 27 | "devDependencies": { 28 | "delete": "^1.0.1", 29 | "generate": "^0.14.0", 30 | "gulp-format-md": "^0.1.12", 31 | "mocha": "^3.4.2" 32 | }, 33 | "keywords": [ 34 | "boilerplate", 35 | "build", 36 | "cli", 37 | "cli-app", 38 | "command-line", 39 | "config", 40 | "create", 41 | "dev", 42 | "development", 43 | "eslint", 44 | "eslintignore", 45 | "file", 46 | "framework", 47 | "front", 48 | "frontend", 49 | "fs", 50 | "generate", 51 | "generate-generator", 52 | "generate-plugin", 53 | "generategenerator", 54 | "generateplugin", 55 | "generator", 56 | "init", 57 | "initialize", 58 | "new", 59 | "plugin", 60 | "project", 61 | "projects", 62 | "rc", 63 | "runtime", 64 | "scaffold", 65 | "scaffolder", 66 | "scaffolding", 67 | "template", 68 | "templates", 69 | "webapp", 70 | "write", 71 | "yeoman", 72 | "yo" 73 | ], 74 | "verb": { 75 | "toc": { 76 | "method": "preWrite", 77 | "collapsible": true 78 | }, 79 | "layout": "generator", 80 | "sections": { 81 | "file": "readme", 82 | "taskExamples": [ 83 | "eslintrc", 84 | "ignore" 85 | ], 86 | "placements": [ 87 | { 88 | "heading": "eslintrc", 89 | "contents": "{%= doc(\"example-eslintrc.md\") %}", 90 | "placement": "append", 91 | "options": { 92 | "match": "^\\[eslintrc\\]" 93 | } 94 | }, 95 | { 96 | "heading": "ignore", 97 | "contents": "{%= doc(\"example-ignore.md\") %}", 98 | "placement": "append", 99 | "options": { 100 | "match": "^\\[ignore\\]" 101 | } 102 | } 103 | ] 104 | }, 105 | "tasks": [ 106 | "readme" 107 | ], 108 | "plugins": [ 109 | "gulp-format-md" 110 | ], 111 | "related": { 112 | "list": [ 113 | "generate", 114 | "generate-file", 115 | "generate-mocha", 116 | "generate-node" 117 | ] 118 | }, 119 | "reflinks": [ 120 | "assemble", 121 | "base", 122 | "gulp" 123 | ], 124 | "lint": { 125 | "reflinks": true 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /templates/_eslintignore: -------------------------------------------------------------------------------- 1 | /actual/** 2 | /build/** 3 | /conf/** 4 | /coverage/** 5 | /docs/** 6 | /fixtures/** 7 | /jsdoc/** 8 | /templates/** 9 | /tests/actual/** 10 | /tests/templates/** 11 | /tests/bench/** 12 | /tests/fixtures/** 13 | /tests/performance/** 14 | /tmp/** 15 | -------------------------------------------------------------------------------- /templates/_eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": false, 4 | "es6": true, 5 | "node": true, 6 | "mocha": true 7 | }, 8 | 9 | "globals": { 10 | "document": false, 11 | "navigator": false, 12 | "window": false 13 | }, 14 | 15 | "rules": { 16 | "accessor-pairs": 2, 17 | "arrow-spacing": [2, { "before": true, "after": true }], 18 | "block-spacing": [2, "always"], 19 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 20 | "comma-dangle": [2, "never"], 21 | "comma-spacing": [2, { "before": false, "after": true }], 22 | "comma-style": [2, "last"], 23 | "constructor-super": 2, 24 | "curly": [2, "multi-line"], 25 | "dot-location": [2, "property"], 26 | "eol-last": 2, 27 | "eqeqeq": [2, "allow-null"], 28 | "generator-star-spacing": [2, { "before": true, "after": true }], 29 | "handle-callback-err": [2, "^(err|error)$" ], 30 | "indent": [2, 2, { "SwitchCase": 1 }], 31 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 32 | "keyword-spacing": [2, { "before": true, "after": true }], 33 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 34 | "new-parens": 2, 35 | "no-array-constructor": 2, 36 | "no-caller": 2, 37 | "no-class-assign": 2, 38 | "no-cond-assign": 2, 39 | "no-const-assign": 2, 40 | "no-control-regex": 2, 41 | "no-debugger": 2, 42 | "no-delete-var": 2, 43 | "no-dupe-args": 2, 44 | "no-dupe-class-members": 2, 45 | "no-dupe-keys": 2, 46 | "no-duplicate-case": 2, 47 | "no-empty-character-class": 2, 48 | "no-eval": 2, 49 | "no-ex-assign": 2, 50 | "no-extend-native": 2, 51 | "no-extra-bind": 2, 52 | "no-extra-boolean-cast": 2, 53 | "no-extra-parens": [2, "functions"], 54 | "no-fallthrough": 2, 55 | "no-floating-decimal": 2, 56 | "no-func-assign": 2, 57 | "no-implied-eval": 2, 58 | "no-inner-declarations": [2, "functions"], 59 | "no-invalid-regexp": 2, 60 | "no-irregular-whitespace": 2, 61 | "no-iterator": 2, 62 | "no-label-var": 2, 63 | "no-labels": 2, 64 | "no-lone-blocks": 2, 65 | "no-mixed-spaces-and-tabs": 2, 66 | "no-multi-spaces": 2, 67 | "no-multi-str": 2, 68 | "no-multiple-empty-lines": [2, { "max": 1 }], 69 | "no-native-reassign": 0, 70 | "no-negated-in-lhs": 2, 71 | "no-new": 2, 72 | "no-new-func": 2, 73 | "no-new-object": 2, 74 | "no-new-require": 2, 75 | "no-new-wrappers": 2, 76 | "no-obj-calls": 2, 77 | "no-octal": 2, 78 | "no-octal-escape": 2, 79 | "no-proto": 0, 80 | "no-redeclare": 2, 81 | "no-regex-spaces": 2, 82 | "no-return-assign": 2, 83 | "no-self-compare": 2, 84 | "no-sequences": 2, 85 | "no-shadow-restricted-names": 2, 86 | "no-spaced-func": 2, 87 | "no-sparse-arrays": 2, 88 | "no-this-before-super": 2, 89 | "no-throw-literal": 2, 90 | "no-trailing-spaces": 0, 91 | "no-undef": 2, 92 | "no-undef-init": 2, 93 | "no-unexpected-multiline": 2, 94 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 95 | "no-unreachable": 2, 96 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 97 | "no-useless-call": 0, 98 | "no-with": 2, 99 | "one-var": [0, { "initialized": "never" }], 100 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 101 | "padded-blocks": [0, "never"], 102 | "quotes": [2, "single", "avoid-escape"], 103 | "radix": 2, 104 | "semi": [2, "always"], 105 | "semi-spacing": [2, { "before": false, "after": true }], 106 | "space-before-blocks": [2, "always"], 107 | "space-before-function-paren": [2, "never"], 108 | "space-in-parens": [2, "never"], 109 | "space-infix-ops": 2, 110 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 111 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 112 | "use-isnan": 2, 113 | "valid-typeof": 2, 114 | "wrap-iife": [2, "any"], 115 | "yoda": [2, "never"] 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('mocha'); 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | var assert = require('assert'); 7 | var generate = require('generate'); 8 | var del = require('delete'); 9 | var generator = require('./'); 10 | var app; 11 | 12 | var cwd = path.resolve.bind(path, __dirname, 'actual'); 13 | 14 | function exists(name, cb) { 15 | var filepath = cwd(name); 16 | 17 | return function(err) { 18 | if (err) return cb(err); 19 | 20 | fs.stat(filepath, function(err, stat) { 21 | assert(stat); 22 | del(path.dirname(filepath), cb); 23 | }); 24 | } 25 | } 26 | 27 | describe('generate-eslint', function() { 28 | beforeEach(function() { 29 | app = generate({silent: true}); 30 | app.cwd = cwd(); 31 | app.option('dest', cwd()); 32 | }); 33 | 34 | describe('plugin', function() { 35 | it('should only register the plugin once', function(cb) { 36 | var count = 0; 37 | app.on('plugin', function(name) { 38 | if (name === 'generate-eslint') { 39 | count++; 40 | } 41 | }); 42 | app.use(generator); 43 | app.use(generator); 44 | app.use(generator); 45 | assert.equal(count, 1); 46 | cb(); 47 | }); 48 | 49 | it('should extend tasks onto the instance', function() { 50 | app.use(generator); 51 | assert(app.tasks.hasOwnProperty('default')); 52 | assert(app.tasks.hasOwnProperty('eslintrc')); 53 | assert(app.tasks.hasOwnProperty('ignore')); 54 | }); 55 | 56 | it('should run the `default` task', function(cb) { 57 | app.use(generator); 58 | app.generate('default', exists('.eslintrc.json', cb)); 59 | }); 60 | 61 | it('should run the `ignore` task', function(cb) { 62 | app.use(generator); 63 | app.generate('ignore', exists('.eslintignore', cb)); 64 | }); 65 | 66 | it('should run the `eslintignore` (alias) task', function(cb) { 67 | app.use(generator); 68 | app.generate('eslintignore', exists('.eslintignore', cb)); 69 | }); 70 | }); 71 | 72 | describe('generator', function() { 73 | it('should work as a generator', function(cb) { 74 | app.register('eslint', generator); 75 | app.generate('eslint', exists('.eslintrc.json', cb)); 76 | }); 77 | 78 | it('should run the `default` task', function(cb) { 79 | app.register('eslint', generator); 80 | app.generate('eslint:default', exists('.eslintrc.json', cb)); 81 | }); 82 | 83 | it('should run the `eslint` task', function(cb) { 84 | app.register('eslint', generator); 85 | app.generate('eslint:eslintrc', exists('.eslintrc.json', cb)); 86 | }); 87 | 88 | it('should run the `ignore` task', function(cb) { 89 | app.register('eslint', generator); 90 | app.generate('eslint:ignore', exists('.eslintignore', cb)); 91 | }); 92 | 93 | it('should run the `eslintignore` (alias) task', function(cb) { 94 | app.register('eslint', generator); 95 | app.generate('eslint:eslintignore', exists('.eslintignore', cb)); 96 | }); 97 | }); 98 | 99 | describe('sub-generator', function() { 100 | it('should work as a sub-generator', function(cb) { 101 | app.register('foo', function(foo) { 102 | foo.register('eslint', generator); 103 | }); 104 | app.generate('foo.eslint', exists('.eslintrc.json', cb)); 105 | }); 106 | 107 | it('should run the `default` task', function(cb) { 108 | app.register('foo', function(foo) { 109 | foo.register('eslint', generator); 110 | }); 111 | app.generate('foo.eslint:default', exists('.eslintrc.json', cb)); 112 | }); 113 | 114 | it('should run the `ignore` task', function(cb) { 115 | app.register('foo', function(foo) { 116 | foo.register('eslint', generator); 117 | }); 118 | app.generate('foo.eslint:ignore', exists('.eslintignore', cb)); 119 | }); 120 | 121 | it('should run the `eslintignore` (alias) task', function(cb) { 122 | app.register('foo', function(foo) { 123 | foo.register('eslint', generator); 124 | }); 125 | app.generate('foo.eslint:eslintignore', exists('.eslintignore', cb)); 126 | }); 127 | }); 128 | }); 129 | --------------------------------------------------------------------------------