Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ember-cli-eslint

ember-cli66.8kMITdeprecated5.1.0

Call eslint directly instead: https://github.com/emberjs/rfcs/blob/master/text/0121-remove-ember-cli-eslint.md

Ember-cli eslint support, for checking your application matches your coding standards.

ember, ember-addon, eslint, eslint ember, eslint ember-cli, lint

readme

ember-cli-eslint

Latest NPM release TravisCI Build Status Ember Observer Score

ESLint for Ember CLI apps and addons

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.

<summary> If you notice the two awkwardly running side by side, click here! </summary>

ember-cli >= 2.5.0

As of ember-cli v.2.5.0, jshint is provided through its own ember-cli-jshint addon. 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:

module.exports = function(defaults) {
  const app = new EmberApp(defaults, {
    'ember-cli-qunit': {
      useLintTree: false
    }
  });
};

or

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:

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'],
  }
});
  • testGenerator is automatically detected if ember-qunit/ember-cli-qunit or ember-mocha/ember-cli-mocha are used, but can also be set to qunit and mocha manually.

  • group can be set to false to go back to the previous behavior where every generated test was contained in its own separate module.

  • rulesDir is the name of the directory for your custom eslint rules. It defaults to eslint-rules.

  • extensions is an array containing the file extensions to lint. If you want to lint JavaScript and TypeScript files for example it should be set to ['js', 'ts']. NOTE: If you add Typescript files typescript-eslint-parser has to be installed and specified as the parser. For more information take a look at the typescript-eslint-parser

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

  • git clone this repository
  • cd ember-cli-eslint
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server
  • ember try:each

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

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.

changelog

Changelog

v5.1.0 (2019-01-18)

:rocket: Enhancement

:bug: Bug Fix

:house: Internal

  • #311 TravisCI: Remove deprecated sudo: false option. (@Turbo87)

Committers: 3

v5.0.0 (2018-11-09)

:boom: Breaking Change

:house: Internal

Committers: 2

4.2.3

  • Extend test framework detection to ember-qunit and ember-mocha (#225)

4.2.2

  • Fix file deletion bug. (#222)

4.2.1

  • Fix detection of test frameworks for prerelease versions. (#215)

4.2.0

  • Make extensions configurable (#203)

4.1.0

  • Allow passthrough of rulesDir option to broccoli-lint-eslint (#197)

4.0.0

  • Update to ESLint 4 (#191)

3.1.0

  • Use new group option of broccoli-lint-eslint by default (#176)

3.0.3

  • Remove direct ember-cli-babel dependency (it was unused).

3.0.2

  • Lazily require eslint (speed up non-build related commands by ~ 100ms) (#145)

3.0.1

  • Removed noise from ember-cli-eslint blueprint (#143)

3.0.0

  • Update broccoli-lint-eslint and ESLint to v3.x (#101)

2.0.1

  • Removed noise from ember-cli-eslint blueprint (#143)

2.0.0

  • Remove deprecated coding-standard files (#108)

1.8.0

  • Respect Ember CLI --silent flag (#100)
  • Deprecate coding-standard files in favor of plain .eslintrc files (#107)
  • Use default ESLint parser unless babel-eslint is specifically requested (#107)
  • Remove .jshintrc files automatically on install (#91)

1.7.0 / 02-07-2016

  • fix blueprints, they now reference the correct coding standard by default
  • upgrade build dependencies

1.6.0 / 15-06-2016

1.5.0 / 09-06-2016

  • Utilize third argument to testGenerator provided to broccoli-lint-eslint if available.
  • Do not fail tests for lint warnings.

1.4.1 / 30-05-2016

  • Remove eslint-config-ember and phantomjs from devDependencies.

1.4.0 / 14-05-2016

  • Root configuration no longer relies on eslint-config-ember. (Discussion around appropriate base configuration is still ongoing)
  • Default blueprint now generates .eslintrc.js and tests/.eslintrc.js (.eslintrc has been deprecated.
    • Potential Changes: If you have a .eslintrc or tests/.eslintrc file, please reformat it to be a .eslintrc.js file (using module.exports) so that ember-cli-eslint can detect potential duplicates.
  • Base root configuration now extends from eslint:recommended.
  • Base /test configuration now defines embertest: true as an env setting.

1.3.0 / 13-04-2016

  • broccoli-lint-eslint@^2.0.0
  • Passing build
  • Move local eslint config settings to config directory.
  • Update version of eslint-config-ember installed by default blueprint to 0.3.0.
  • Update project to `ember-cli@2.3.0`.
  • Implement lintTree function that calls project.generateTestFile -- if it's available.
  • Disable ember-cli-qunit's and ember-cli-mocha's' lintTree hook.

1.2.1

1.2.0

1.1.0

  • Upgrading package dependencies for Ember 1.13.8

1.0.0

  • Bumping package to publish beta to stable

1.0.0-beta.15

  • Bumping package because npm broke index.js again

1.0.0-beta.14

  • Bumping version for broccoli-lint-eslint and eslint-config-ember

1.0.0-beta.13

  • Adding tmp to .npmignore

1.0.0-beta.12

  • Upgrade broccoli-lint-eslint to 1.0.0

1.0.0-beta.11

  • Bump package number, again

1.0.0-beta.10

  • Update badges
  • Update package call

1.0.0-beta.9

  • Force change due to npm index.js issue
  • Add badge for travis

1.0.0-beta.8

  • Fixing linting errors for dummy app
  • Moving to package install in ember blueprint

1.0.0-beta.7

  • Remove dirs and files that are not required
  • Fix testing .eslintrc blueprint file
  • Consume native eslint-config-eslint for own linting
  • Move afterInstall to blueprint
  • Upgrade to eslint-config-ember@0.0.5
  • Add .gitkeep to blueprint to be usable as an addon

1.0.0-beta.2

  • Update blueprint to use eslint-config-ember

0.1.4

  • Updating documentation
  • Updating broccoli-lint-eslint to 0.1.3

0.1.3

  • Removing default eslint.json to allow ESLint to use default config lookup
  • Moved the generator to use .eslintrc
  • Updating broccoli-lint-eslint to 0.1.2