<commit_before>@page generator Creating a generator
@parent DoneJS
@hide sidebar
@outline 2 ol
@description Generators add additional functionality to DoneJS applications. In this guide will create a generator that adds JSHint and an `.editorconfig` file to a DoneJS application.

@body

If you have used `donejs add nw` or `donejs add cordova` to create a [desktop- or mobile version](./Features.html#ios-android-and-desktop-builds) of your application you already used a DoneJS generator. Generators are [npm](https://www.npmjs.com/) modules that provide a [Yeoman](http://yeoman.io/) generator that adds functionality to your application.

In this guide you will create your own version of [donejs-jshint](https://www.npmjs.com/package/donejs-jshint), a DoneJS generator that adds:

- [JSHint](http://jshint.com/), a JavaScript code quality tool
- An [.editorconfig](http://editorconfig.org/) file which helps text editors and IDEs to define and maintain a consistent coding style.

It will also update the `npm test` script to run JSHint with our tests. You can find the code in the [donejs-jshint](https://github.com/donejs/donejs-jshint) repository. We can run the generator with:


    $ donejs add jshint


Currently it will only ask if we want to use spaces or tabs and to overwrite the `package.json` to add the npm scripts for JSHint:

<img src="static/img/donejs-generator-use.png" alt="DoneJS generator" style="width: 100%;" class="alignnone size-full wp-image-3023" />

> __Note:__ Since `donejs-jshint` already exists we will use `donejs-<username>-jshint` with `<username>` being your GitHub username for the remainder of this article. Once published it can then be used as `donejs add <username>-jshint`.


## Setting up

### Creating the project on GitHub

We will use [GitHub](https://github.com) to host the code for the project which makes it easy for others to contribute and to automatically run the tests in [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) which we will enable later.

If you don't have an account yet, go to [GitHub](https://github.com/join) to sign up and follow [the help](https://help.github.com/articles/set-up-git/) on how to set it up for the command-line `git`. Once completed, create a new repository from your dashboard.
<commit_msg>an -> a dot editor config<commit_after>@page generator Creating a generator
@parent DoneJS
@hide sidebar
@outline 2 ol
@description Generators add additional functionality to DoneJS applications. In this guide will create a generator that adds JSHint and a `.editorconfig` file to a DoneJS application.

@body

If you have used `donejs add nw` or `donejs add cordova` to create a [desktop- or mobile version](./Features.html#ios-android-and-desktop-builds) of your application you already used a DoneJS generator. Generators are [npm](https://www.npmjs.com/) modules that provide a [Yeoman](http://yeoman.io/) generator that adds functionality to your application.

In this guide you will create your own version of [donejs-jshint](https://www.npmjs.com/package/donejs-jshint), a DoneJS generator that adds:

- [JSHint](http://jshint.com/), a JavaScript code quality tool
- An [.editorconfig](http://editorconfig.org/) file which helps text editors and IDEs to define and maintain a consistent coding style.

It will also update the `npm test` script to run JSHint with our tests. You can find the code in the [donejs-jshint](https://github.com/donejs/donejs-jshint) repository. We can run the generator with:


    $ donejs add jshint


Currently it will only ask if we want to use spaces or tabs and to overwrite the `package.json` to add the npm scripts for JSHint:

<img src="static/img/donejs-generator-use.png" alt="DoneJS generator" style="width: 100%;" class="alignnone size-full wp-image-3023" />

> __Note:__ Since `donejs-jshint` already exists we will use `donejs-<username>-jshint` with `<username>` being your GitHub username for the remainder of this article. Once published it can then be used as `donejs add <username>-jshint`.


## Setting up

### Creating the project on GitHub

We will use [GitHub](https://github.com) to host the code for the project which makes it easy for others to contribute and to automatically run the tests in [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) which we will enable later.

If you don't have an account yet, go to [GitHub](https://github.com/join) to sign up and follow [the help](https://help.github.com/articles/set-up-git/) on how to set it up for the command-line `git`. Once completed, create a new repository from your dashboard.

{'fraction_non_alphanumeric': 0.09355464539771502, 'fraction_numerical': 0.0034490191851692174, 'mean_word_length': 4.5568862275449105, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 14, 'https://': 14, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2725440', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1273, 'n_words': 592}