Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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 a 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 other configuration
],
rules: {
// override rule settings here
'ember/no-jquery': 'error'
}
};
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. | |
β | recommended | extends the base configuration by enabling the recommended rules. |
Rules are grouped by category to help you understand their purpose. Each rule has emojis denoting:
--fix
command line optionName | Description | β | π§ | π‘ |
---|---|---|---|---|
no-attrs-in-components | disallow usage of this.attrs in components | β | ||
no-attrs-snapshot | disallow use of attrs snapshot in the didReceiveAttrs and didUpdateAttrs component hooks | β | ||
no-classic-components | enforce using Glimmer components | β | ||
no-component-lifecycle-hooks | disallow usage of "classic" ember component lifecycle hooks. Render modifiers or custom functional modifiers should be used instead. | β | ||
no-on-calls-in-components | disallow usage of on to call lifecycle hooks in components | β | ||
require-tagless-components | disallow using the wrapper element of a component | β |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
computed-property-getters | enforce the consistent use of getters in computed properties | |||
no-arrow-function-computed-properties | disallow arrow functions in computed properties | β | ||
no-assignment-of-untracked-properties-used-in-tracking-contexts | disallow assignment of untracked properties that are used as computed property dependencies | β | π§ | |
no-computed-properties-in-native-classes | disallow using computed properties in native classes | β | ||
no-deeply-nested-dependent-keys-with-each | disallow usage of deeply-nested computed property dependent keys with @each | β | ||
no-duplicate-dependent-keys | disallow repeating computed property dependent keys | β | π§ | |
no-incorrect-computed-macros | disallow incorrect usage of computed property macros | β | π§ | |
no-invalid-dependent-keys | disallow invalid dependent keys in computed properties | β | π§ | |
no-side-effects | disallow unexpected side effects in computed properties | β | ||
no-volatile-computed-properties | disallow volatile computed properties | β | ||
require-computed-macros | require using computed property macros when possible | β | π§ | |
require-computed-property-dependencies | require dependencies to be declared statically in computed properties | β | π§ | |
require-return-from-computed | disallow missing return statements in computed properties | β | ||
use-brace-expansion | enforce usage of brace expansion in computed property dependent keys | β |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
alias-model-in-controller | enforce aliasing model in controllers | |||
avoid-using-needs-in-controllers | disallow using needs in controllers | β | ||
no-controllers | disallow non-essential controllers |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
closure-actions | enforce usage of closure actions | β | ||
new-module-imports | enforce using "New Module Imports" from Ember RFC #176 | β | ||
no-function-prototype-extensions | disallow usage of Ember's function prototype extensions | β | ||
no-mixins | disallow the usage of mixins | β | ||
no-new-mixins | disallow the creation of new mixins | β | ||
no-observers | disallow usage of observers | β | ||
no-old-shims | disallow usage of old shims for modules | β | π§ | |
no-string-prototype-extensions | disallow usage of String prototype extensions | β |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
no-empty-attrs | disallow usage of empty attributes in Ember Data models | |||
use-ember-data-rfc-395-imports | enforce usage of @ember-data/ package imports instead ember-data | β | π§ |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
avoid-leaking-state-in-ember-objects | disallow state leakage | β | ||
no-get-with-default | disallow usage of the Ember's getWithDefault function | β | π§ | |
no-get | require using ES5 getters instead of Ember's get / getProperties functions | β | π§ | |
no-proxies | disallow using array or object proxies | |||
no-try-invoke | disallow usage of the Ember's tryInvoke util | β | ||
require-super-in-lifecycle-hooks | require super to be called in lifecycle hooks | β | π§ | |
use-ember-get-and-set | enforce usage of Ember.get and Ember.set | π§ |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
classic-decorator-hooks | enforce using correct hooks for both classic and non-classic classes | β | ||
classic-decorator-no-classic-methods | disallow usage of classic APIs such as get /set in classes that aren't explicitly decorated with @classic | β | ||
no-actions-hash | disallow the actions hash in components, controllers, and routes | β | ||
no-classic-classes | disallow "classic" classes in favor of native JS classes | β | ||
no-ember-super-in-es-classes | disallow use of this._super in ES class methods | β | π§ | |
no-empty-glimmer-component-classes | disallow empty backing classes for Glimmer components | β |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
jquery-ember-run | disallow usage of jQuery without an Ember run loop | β | ||
no-global-jquery | disallow usage of global jQuery object | β | ||
no-jquery | disallow any usage of jQuery | β |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
named-functions-in-promises | enforce usage of named functions in promises | |||
no-html-safe | disallow the use of htmlSafe | |||
no-incorrect-calls-with-inline-anonymous-functions | disallow inline anonymous functions as arguments to debounce , once , and scheduleOnce | β | ||
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-property-modifications | disallow modifying the specified properties | π§ | ||
require-fetch-import | enforce explicit import for fetch() |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
no-capital-letters-in-routes | disallow routes with uppercased letters in router.js | β | ||
no-controller-access-in-routes | disallow routes from accessing the controller outside of setupController/resetController | β | ||
no-private-routing-service | disallow injecting the private routing service | β | ||
no-shadow-route-definition | enforce no route path definition shadowing | β | ||
no-unnecessary-index-route | disallow unnecessary index route definition | |||
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 | π‘ | ||
routes-segments-snake-case | enforce usage of snake_cased dynamic segments in routes | β |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
no-implicit-service-injection-argument | disallow omitting the injected service name argument | π§ | ||
no-restricted-service-injections | disallow injecting certain services under certain paths | |||
no-unnecessary-service-injection-argument | disallow unnecessary argument when injecting services | π§ | ||
no-unused-services | disallow unused service injections (see rule doc for limitations) | π‘ |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
order-in-components | enforce proper order of properties in components | π§ | ||
order-in-controllers | enforce proper order of properties in controllers | π§ | ||
order-in-models | enforce proper order of properties in models | π§ | ||
order-in-routes | enforce proper order of properties in routes | π§ |
Name | Description | β | π§ | π‘ |
---|---|---|---|---|
no-current-route-name | disallow usage of the currentRouteName() test helper | |||
no-ember-testing-in-module-scope | disallow use of Ember.testing in module scope | β | ||
no-invalid-test-waiters | disallow incorrect usage of test waiter APIs | β | ||
no-legacy-test-waiters | disallow the use of the legacy test waiter APIs | β | ||
no-noop-setup-on-error-in-before | disallows using no-op setupOnerror in before or beforeEach | β | π§ | |
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 | |||
no-restricted-resolver-tests | disallow the use of patterns that use the restricted resolver in tests | β | ||
no-settled-after-test-helper | disallow usage of await settled() right after test helper that calls it internally | β | π§ | |
no-test-and-then | disallow usage of the andThen test wait helper | β | ||
no-test-import-export | disallow importing of "-test.js" in a test file and exporting from a test file | β | ||
no-test-module-for | disallow usage of moduleFor , moduleForComponent , etc | β | ||
no-test-support-import | disallow importing of "test-support" files in production code. | β | ||
no-test-this-render | disallow usage of the this.render in tests, recommending to use @ember/test-helpers' render instead. | β | ||
prefer-ember-test-helpers | enforce usage of @ember/test-helpers methods over native window methods | β | ||
require-valid-css-selector-in-test-helpers | disallow using invalid CSS selectors in test helpers | β | π§ |
For the simplified list of rules, go here.
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.
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)yarn update
to automatically update the README and other files (and re-run this if you change the rule name or description)yarn test
yarn lint
(yarn lint:js --fix
can fix many errors)Note that new rules should not immediately be added to the recommended configuration, as we only consider such breaking changes during major version updates.
See the LICENSE file for license rights and limitations (MIT).
FAQs
ESLint plugin for Ember.js apps
The npm package eslint-plugin-ember receives a total of 128,025 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.