eslint-plugin-ember
Eslint plugin for Ember.js apps
Last updated 12 days ago by bmishkin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-plugin-ember 
SYNC missed versions from official npm registry.

eslint-plugin-ember

NPM version NPM downloads CI

An ESlint plugin that provides set of rules for Ember Applications based on commonly known good practices.

❗️Requirements

???? Usage

1. Install plugin

yarn add --dev eslint-plugin-ember

Or

npm install --save-dev eslint-plugin-ember

2. Modify your .eslintrc.js

// .eslintrc.js
module.exports = {
  plugins: ['ember'],
  extends: [
    'eslint:recommended',
    'plugin:ember/recommended' // or other configuration
  ],
  rules: {
    // override rule settings here
    'ember/no-jquery': 'error'
  }
};

???? Configurations

Name Description
base contains no rules settings, but the basic eslint configuration suitable for any ember project. You can use it to configure rules as you wish.
:white_check_mark: recommended extends the base configuration by enabling the recommended rules.
:car: octane extends the recommended configuration by enabling octane rules. This ruleset is currently considered unstable and experimental :warning: as rules may be added and removed until the final ruleset is settled upon.

???? Rules

Rules are grouped by category to help you understand their purpose. Each rule has emojis denoting:

  • What configuration it belongs to
  • :wrench: if some problems reported by the rule are automatically fixable by the --fix command line option

Components

Rule ID Description
:white_check_mark: no-attrs-in-components disallow usage of this.attrs in components
:white_check_mark: no-attrs-snapshot disallow use of attrs snapshot in the didReceiveAttrs and didUpdateAttrs component hooks
:car: no-classic-components enforce using Glimmer components
:car: no-component-lifecycle-hooks disallow usage of "classic" ember component lifecycle hooks. Render modifiers or custom functional modifiers should be used instead.
:white_check_mark: no-on-calls-in-components disallow usage of on to call lifecycle hooks in components
:car: require-tagless-components disallow using the wrapper element of a component

Computed Properties

Rule ID Description
computed-property-getters enforce the consistent use of getters in computed properties
:white_check_mark: no-arrow-function-computed-properties disallow arrow functions in computed properties
:white_check_mark::wrench: no-assignment-of-untracked-properties-used-in-tracking-contexts disallow assignment of untracked properties that are used as computed property dependencies
:car: no-computed-properties-in-native-classes disallow using computed properties in native classes
:white_check_mark: no-deeply-nested-dependent-keys-with-each disallow usage of deeply-nested computed property dependent keys with @each
:white_check_mark::wrench: no-duplicate-dependent-keys disallow repeating computed property dependent keys
:white_check_mark::wrench: no-incorrect-computed-macros disallow incorrect usage of computed property macros
:white_check_mark::wrench: no-invalid-dependent-keys disallow invalid dependent keys in computed properties
:white_check_mark: no-side-effects disallow unexpected side effects in computed properties
:white_check_mark: no-volatile-computed-properties disallow volatile computed properties
:white_check_mark::wrench: require-computed-macros require using computed property macros when possible
:white_check_mark::wrench: require-computed-property-dependencies require dependencies to be declared statically in computed properties
:white_check_mark: require-return-from-computed disallow missing return statements in computed properties
:white_check_mark: use-brace-expansion enforce usage of brace expansion in computed property dependent keys

Controllers

Rule ID Description
alias-model-in-controller enforce aliasing model in controllers
:white_check_mark: avoid-using-needs-in-controllers disallow using needs in controllers
no-controllers disallow non-essential controllers

Deprecations

Rule ID Description
:white_check_mark: closure-actions enforce usage of closure actions
:white_check_mark: new-module-imports enforce using "New Module Imports" from Ember RFC #176
:white_check_mark: no-function-prototype-extensions disallow usage of Ember's function prototype extensions
:white_check_mark: no-mixins disallow the usage of mixins
:white_check_mark: no-new-mixins disallow the creation of new mixins
:white_check_mark: no-observers disallow usage of observers
:white_check_mark::wrench: no-old-shims disallow usage of old shims for modules

Ember Data

Rule ID Description
no-empty-attrs disallow usage of empty attributes in Ember Data models
:white_check_mark::wrench: use-ember-data-rfc-395-imports enforce usage of @ember-data/ package imports instead ember-data

Ember Object

Rule ID Description
:white_check_mark: avoid-leaking-state-in-ember-objects disallow state leakage
:white_check_mark::wrench: no-get-with-default disallow usage of the Ember's getWithDefault function
:white_check_mark::wrench: no-get require using ES5 getters instead of Ember's get / getProperties functions
no-proxies disallow using array or object proxies
:white_check_mark: require-super-in-init require this._super to be called in init hooks
:wrench: use-ember-get-and-set enforce usage of Ember.get and Ember.set

Ember Octane

Rule ID Description
:car: classic-decorator-hooks enforce using correct hooks for both classic and non-classic classes
:car: classic-decorator-no-classic-methods disallow usage of classic APIs such as get/set in classes that aren't explicitly decorated with @classic
:car: no-actions-hash disallow the actions hash in components, controllers, and routes
:car: no-classic-classes disallow "classic" classes in favor of native JS classes
:white_check_mark::wrench: no-ember-super-in-es-classes disallow use of this._super in ES class methods

jQuery

Rule ID Description
:white_check_mark: jquery-ember-run disallow usage of jQuery without an Ember run loop
:white_check_mark: no-global-jquery disallow usage of global jQuery object
:white_check_mark: no-jquery disallow any usage of jQuery

Miscellaneous

Rule ID Description
named-functions-in-promises enforce usage of named functions in promises
:white_check_mark: no-incorrect-calls-with-inline-anonymous-functions disallow inline anonymous functions as arguments to debounce, once, and scheduleOnce
:white_check_mark: no-invalid-debug-function-arguments disallow usages of Ember's assert() / warn() / deprecate() functions that have the arguments passed in the wrong order.
no-restricted-service-injections disallow injecting certain services under certain paths

Routes

Rule ID Description
:white_check_mark: no-capital-letters-in-routes disallow routes with uppercased letters in router.js
:white_check_mark: no-controller-access-in-routes disallow routes from accessing the controller outside of setupController/resetController
:white_check_mark: no-private-routing-service disallow injecting the private routing service
no-unnecessary-index-route disallow unnecessary index route definition
:white_check_mark::wrench: no-unnecessary-route-path-option disallow unnecessary usage of the route path option
route-path-style enforce usage of kebab-case (instead of snake_case or camelCase) in route paths
:white_check_mark: routes-segments-snake-case enforce usage of snake_cased dynamic segments in routes

Stylistic Issues

Rule ID Description
:wrench: no-unnecessary-service-injection-argument disallow unnecessary argument when injecting services
:wrench: order-in-components enforce proper order of properties in components
:wrench: order-in-controllers enforce proper order of properties in controllers
:wrench: order-in-models enforce proper order of properties in models
:wrench: order-in-routes enforce proper order of properties in routes

Testing

Rule ID Description
:white_check_mark: no-ember-testing-in-module-scope disallow use of Ember.testing in module scope
:white_check_mark: no-invalid-test-waiters disallow incorrect usage of test waiter APIs
:white_check_mark: no-legacy-test-waiters disallow the use of the legacy test waiter APIs
:white_check_mark::wrench: no-noop-setup-on-error-in-before disallows using no-op setupOnerror in before or beforeEach
:white_check_mark: no-pause-test disallow usage of the pauseTest helper in tests
no-replace-test-comments disallow 'Replace this with your real tests' comments in test files
:white_check_mark: no-restricted-resolver-tests disallow the use of patterns that use the restricted resolver in tests
:white_check_mark: no-test-and-then disallow usage of the andThen test wait helper
:white_check_mark: no-test-import-export disallow importing of "-test.js" in a test file and exporting from a test file
:white_check_mark: no-test-module-for disallow usage of moduleFor, moduleForComponent, etc
:white_check_mark: no-test-this-render disallow usage of the this.render in tests, recommending to use @ember/test-helpers' render instead.
:white_check_mark: prefer-ember-test-helpers enforce usage of @ember/test-helpers methods over native window methods

For the simplified list of rules, go here.

???? Contribution Guide

If you have any suggestions, ideas, or problems, feel free to create an issue, but first please make sure your question does not repeat previous ones.

Creating a New Rule

  • Create an issue with a description of the proposed rule
  • Create files for the new rule:
    • lib/rules/new-rule.js (implementation, see no-proxies for an example)
    • docs/rules/new-rule.md (documentation, start from the template -- raw, rendered)
    • tests/lib/rules/new-rule.js (tests, see no-proxies for an example)
  • Run yarn update to automatically update the README and other files (and re-run this if you change the rule name or description)
  • Make sure your changes will pass CI by running:
    • yarn test
    • yarn lint (yarn lint:js --fix can fix many errors)
  • Create a PR and link the created issue in the description

Note that new rules should not immediately be added to the recommended configuration, as we only consider such breaking changes during major version updates.

???? License

See the LICENSE file for license rights and limitations (MIT).

Current Tags

  • 9.0.0                                ...           latest (12 days ago)

108 Versions

  • 9.0.0                                ...           12 days ago
  • 8.14.0                                ...           12 days ago
  • 8.13.0                                ...           24 days ago
  • 8.12.0                                ...           a month ago
  • 8.11.0                                ...           a month ago
  • 8.10.1                                ...           a month ago
  • 8.10.0                                ...           a month ago
  • 8.9.2                                ...           2 months ago
  • 8.9.1                                ...           2 months ago
  • 8.9.0                                ...           3 months ago
  • 8.8.0                                ...           3 months ago
  • 8.7.0                                ...           3 months ago
  • 8.6.0                                ...           4 months ago
  • 8.5.2                                ...           4 months ago
  • 8.5.1                                ...           4 months ago
  • 8.5.0                                ...           4 months ago
  • 8.4.0                                ...           5 months ago
  • 8.3.0                                ...           5 months ago
  • 8.2.0                                ...           5 months ago
  • 8.1.1                                ...           6 months ago
  • 8.1.0                                ...           6 months ago
  • 8.0.0                                ...           6 months ago
  • 7.13.0                                ...           6 months ago
  • 7.12.0                                ...           6 months ago
  • 7.11.1                                ...           6 months ago
  • 7.11.0                                ...           6 months ago
  • 7.10.1                                ...           6 months ago
  • 7.10.0                                ...           6 months ago
  • 7.9.0                                ...           7 months ago
  • 7.8.1                                ...           7 months ago
  • 7.8.0                                ...           7 months ago
  • 7.7.2                                ...           9 months ago
  • 7.7.1                                ...           10 months ago
  • 7.7.0                                ...           10 months ago
  • 7.6.0                                ...           10 months ago
  • 7.5.0                                ...           10 months ago
  • 7.4.1                                ...           10 months ago
  • 7.4.0                                ...           10 months ago
  • 7.3.0                                ...           a year ago
  • 7.2.0                                ...           a year ago
  • 7.1.0                                ...           a year ago
  • 7.0.0                                ...           a year ago
  • 6.10.1                                ...           a year ago
  • 6.10.0                                ...           a year ago
  • 6.9.1                                ...           a year ago
  • 6.9.0                                ...           a year ago
  • 6.8.2                                ...           a year ago
  • 6.8.1                                ...           a year ago
  • 6.8.0                                ...           a year ago
  • 6.7.1                                ...           a year ago
  • 6.7.0                                ...           a year ago
  • 6.6.0                                ...           a year ago
  • 6.5.1                                ...           a year ago
  • 6.5.0                                ...           a year ago
  • 6.4.1                                ...           a year ago
  • 6.4.0                                ...           a year ago
  • 6.3.0                                ...           2 years ago
  • 6.2.0                                ...           2 years ago
  • 6.1.0                                ...           2 years ago
  • 6.0.1                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.4.0                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           3 years ago
  • 5.0.3                                ...           3 years ago
  • 5.0.2                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.6.2                                ...           3 years ago
  • 5.0.0-beta.2                                ...           3 years ago
  • 5.0.0-beta.1                                ...           3 years ago
  • 4.6.1                                ...           3 years ago
  • 4.6.0                                ...           3 years ago
  • 4.5.0                                ...           3 years ago
  • 4.4.0                                ...           3 years ago
  • 4.3.0                                ...           3 years ago
  • 4.2.0                                ...           3 years ago
  • 4.1.3                                ...           3 years ago
  • 4.1.2                                ...           3 years ago
  • 4.1.1                                ...           3 years ago
  • 4.1.0                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.6.2                                ...           3 years ago
  • 3.6.1                                ...           3 years ago
  • 3.6.0                                ...           3 years ago
  • 3.5.0                                ...           3 years ago
  • 3.4.1                                ...           3 years ago
  • 3.4.0                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.2.2                                ...           4 years ago
  • 2.2.1                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           6 years ago
Downloads
Today 0
This Week 46
This Month 194
Last Day 0
Last Week 128
Last Month 808
Dependencies (4)

Copyright 2014 - 2016 © taobao.org |