Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
eslint-plugin-ember
Advanced tools
eslint-plugin-ember is an ESLint plugin that provides linting rules specific to Ember.js applications. It helps developers follow best practices and maintain consistency in their Ember.js codebase.
Best Practices
This rule enforces the best practice of avoiding the use of observers in Ember.js applications. Observers can lead to unpredictable behavior and are generally discouraged.
module.exports = {
rules: {
'ember/no-observers': 'error'
}
};
Stylistic Issues
This rule ensures that developers use Ember's `get` and `set` methods for property access and assignment, which is a stylistic convention in Ember.js.
module.exports = {
rules: {
'ember/use-ember-get-and-set': 'error'
}
};
Ember-Specific Rules
This rule disallows the use of jQuery in Ember.js applications, encouraging developers to use native DOM APIs or Ember's own abstractions.
module.exports = {
rules: {
'ember/no-jquery': 'error'
}
};
eslint-plugin-react provides linting rules for React applications. It helps enforce best practices and coding standards specific to React, similar to how eslint-plugin-ember does for Ember.js.
eslint-plugin-vue offers linting rules for Vue.js applications. It ensures that Vue.js code adheres to best practices and stylistic conventions, much like eslint-plugin-ember does for Ember.js.
eslint-plugin-angular provides linting rules for Angular applications. It helps maintain code quality and consistency in Angular projects, similar to the role of eslint-plugin-ember in Ember.js projects.
An ESlint plugin that provides set of rules for Ember Applications based on commonly known good practices.
yarn add --dev eslint-plugin-ember
Or
npm install --save-dev eslint-plugin-ember
.eslintrc.js
:// .eslintrc.js
module.exports = {
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended' // or 'plugin:ember/base'
],
rules: {
// override rules' settings here
}
}
Possible configurations:
If you don't want to use predefined settings, you can use it as a plain plugin:
module.exports = {
plugins: [
'ember'
],
extends: [
'eslint:recommended'
],
rules: {
// add rules' settings here, eg.:
'ember/local-modules': 2
}
}
All rules from this plugin have to be prefixed with ember/
Rules are grouped by category to help you understand their purpose.
All rules below with a check mark :white_check_mark: are enabled by default while using plugin:ember/recommended
config.
The --fix
option on the command line automatically fixes problems reported by rules which have a wrench :wrench: below.
Rule ID | Description | |
---|---|---|
alias-model-in-controller | Enforces aliasing model in controller | |
:white_check_mark: | closure-actions | Enforces usage of closure actions |
named-functions-in-promises | Enforces usage of named functions in promises | |
:white_check_mark: | new-module-imports | Use "New Module Imports" from Ember RFC #176 |
no-empty-attrs | Prevents usage of empty attributes in ember data models | |
:white_check_mark: | no-function-prototype-extensions | Prevents usage of Ember's function prototype extensions |
:white_check_mark: | no-global-jquery | Prevents usage of global jQuery object |
no-jquery | Disallow any usage of jQuery | |
no-observers | Prevents usage of observers | |
:white_check_mark::wrench: | no-old-shims | Prevents usage of old shims for modules |
:white_check_mark: | no-on-calls-in-components | Prevents usage of on calls in components |
:wrench: | use-ember-get-and-set | Enforces usage of Ember.get and Ember.set |
Rule ID | Description | |
---|---|---|
:white_check_mark: | jquery-ember-run | Prevents usage of jQuery without Ember Run Loop |
: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 didReceiveAttrs and didUpdateAttrs |
:white_check_mark: | no-capital-letters-in-routes | Raise an error when there is a route with uppercased letters in router.js |
:white_check_mark: | no-duplicate-dependent-keys | Disallow repeating dependent keys |
:white_check_mark: | no-side-effects | Warns about unexpected side effects in computed properties |
:white_check_mark: | require-super-in-init | Enforces super calls in init hooks |
:white_check_mark: | routes-segments-snake-case | Enforces usage of snake_cased dynamic segments in routes |
Rule ID | Description | |
---|---|---|
:white_check_mark: | avoid-leaking-state-in-ember-objects | Avoids state leakage |
Rule ID | Description | |
---|---|---|
order-in-components | Enforces proper order of properties in components | |
order-in-controllers | Enforces proper order of properties in controllers | |
order-in-models | Enforces proper order of properties in models | |
order-in-routes | Enforces proper order of properties in routes | |
:white_check_mark: | use-brace-expansion | Enforces usage of brace expansion |
:warning: We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules.
Rule ID | Replaced by |
---|---|
avoid-leaking-state-in-components | avoid-leaking-state-in-ember-objects |
local-modules | new-module-imports |
For the simplified list of rules, go here.
In order to add a new rule, you should:
yarn start
docs
fileyarn run update
in order to update readme and recommended configurationPlease be aware that we're using yarn
in this repository, so if you plan to add some dependencies - make sure you commit yarn.lock
file too.
If you have any suggestions, ideas or problems feel free to add new issue, but first please make sure your question does not repeat previous ones.
eslint-plugin-ember
package nameSee the LICENSE file for license rights and limitations (MIT).
v5.0.3 (2017-12-21)
FAQs
ESLint plugin for Ember.js apps
The npm package eslint-plugin-ember receives a total of 89,230 weekly downloads. As such, eslint-plugin-ember popularity was classified as popular.
We found that eslint-plugin-ember demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.