ember-cli / ember-cli-eslint

Ember CLI addon for linting Ember projects with ESLint
MIT License
116 stars 49 forks source link
ember ember-cli eslint

ember-cli-eslint

Latest NPM release TravisCI Build Status Ember Observer Score

ESLint for Ember CLI apps and addons.

🔴 DEPRECATED 🔴

Please use ESLint directly instead.

More info / background:

Installation

ESLint 4 (for Node 4 and above):

ember install ember-cli-eslint@4

ESLint 3 (for Node 4 and above):

ember install ember-cli-eslint@3

ESLint 2 (for Node 0.10 and above):

ember install ember-cli-eslint@2

After installation, an .eslintrc.js file will be placed in both the root of your project and the /tests directory.

Furthermore, a .eslintignore file can be used to exclude files from linting while the linter is running. Its syntax is identical to .gitignore files.

Disabling JSHint

Congratulations! You've made the leap into the next generation of JavaScript linting. At the moment, however, ember-cli defaults to generating applications and addons with a jshint configuration.

If you notice the two awkwardly running side by side, click here! #### ember-cli >= 2.5.0 As of `ember-cli v.2.5.0`, [`jshint` is provided through its own `ember-cli-jshint` addon](https://github.com/ember-cli/ember-cli/pull/5757). Running `npm uninstall --save-dev ember-cli-jshint`, in addition to removing any `.jshintrc` files from your project should guarantee that its behavior is disabled. #### ember-cli < 2.5.0 Controlling linting is a bit trickier on versions of `ember-cli` prior to `2.5.0`. Within your `ember-cli-build.js` file, `ember-cli-qunit` or `ember-cli-mocha` can be configured to have their default linting process disabled during: ```javascript module.exports = function(defaults) { const app = new EmberApp(defaults, { 'ember-cli-qunit': { useLintTree: false } }); }; ``` or ```javascript module.exports = function(defaults) { const app = new EmberApp(defaults, { 'ember-cli-mocha': { useLintTree: false } }); }; ``` Alongside this setting, the `hinting` property can then be used to enable/disable globally: ```javascript const isTesting = process.env.EMBER_ENV === 'test'; module.exports = function(defaults) { const app = new EmberApp(defaults, { hinting: !isTesting, }); }; ```

Usage

ESLint will be run by ember-cli-qunit or ember-cli-mocha automatically when you run ember test. If ESLint is not being run automatically, try updating your ember-cli and/or ember-cli-qunit/ember-cli-mocha dependencies.

Configuration

ember-cli-eslint can be configured through the eslint key in your ember-cli-build.js file:

let app = new EmberApp(defaults, {
  eslint: {
    testGenerator: 'qunit',
    group: true,
    rulesDir: 'eslint-rules',
    extensions: ['js'],
  }
});

On Build Files

Please note that if you are using this to lint files which are part of the build process (ie. index.js, ember-cli-build.js, config/), whether in an application or as part of an addon, they will not be linted. It is recommended that eslint is setup separately to lint these files and can be setup as an npm script and run as part of a CI process.

Contributing

Installation

Running

Running Tests

Linting

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the MIT License.