Giter VIP home page Giter VIP logo

eslint-plugin-ember's Introduction

eslint-plugin-ember

NPM version NPM downloads CI

An ESLint plugin that provides a 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. Update your config

// eslint.config.js (flat config)
const eslintPluginEmberRecommended = require('eslint-plugin-ember/configs/recommended');

module.exports = [
  ...eslintPluginEmberRecommended,
];

or

// .eslintrc.js (legacy config)
module.exports = {
  plugins: ['ember'],
  extends: [
    'eslint:recommended',
    'plugin:ember/recommended' // or other configuration
  ],
  rules: {
    // override / enable optional rules
    'ember/no-replace-test-comments': 'error'
  }
};

gts/gjs

lint files having First-Class Component Templates (fcct)

learn more here

Note

special care should be used when setting up parsers, since they cannot be overwritten. thus they should be used in override only and specific to file types

gjs/gts support is provided by the ember-eslint-parser

Note

if you import .gts files in .ts files, then ember-eslint-parser is required for .ts as well to enable typed linting

// .eslintrc.js
module.exports = {
  overrides: [
    {
      files: ['**/*.{js,ts}'],
      plugins: ['ember'],
      parser: '@typescript-eslint/parser',
      extends: [
        'eslint:recommended',
        'plugin:ember/recommended', // or other configuration
      ],
      rules: {
        // override / enable optional rules
        'ember/no-replace-test-comments': 'error'
      }
    },
    {
      files: ['**/*.gts'],
      parser: 'ember-eslint-parser',
      plugins: ['ember'],
      extends: [
        'eslint:recommended',
        'plugin:@typescript-eslint/recommended',
        'plugin:ember/recommended',
        'plugin:ember/recommended-gts',
      ],
    },
    {
      files: ['**/*.gjs'],
      parser: 'ember-eslint-parser',
      plugins: ['ember'],
      extends: [
        'eslint:recommended',
        'plugin:ember/recommended',
        'plugin:ember/recommended-gjs',
      ],
    },
    {
      files: ['tests/**/*.{js,ts,gjs,gts}'],
      rules: {
        // override / enable optional rules
        'ember/no-replace-test-comments': 'error'
      }
    },
  ],
};

rules applied to fcct templates

  • semi rule, same as prettier plugin
  • no-undef rule will take effect for template vars (includes js scope)
  • no-unused rule will take effect for template block params

rules in templates can be disabled with eslint directives with mustache or html comments:

<template>
  <div>
    {{!eslint-disable-next-line}}
    {{test}}
  </div>
  <div>
    {{!--eslint-disable--}}
    {{test}}
    {{test}}
    {{test}}
    {{!--eslint-enable--}}
  </div>
</template>
<template>
  <div>
    <!--eslint-disable-next-line-->
    {{test}}
  </div>
  <div>
    <!-- eslint-disable -->
    {{test}}
    {{test}}
    {{test}}
    <!-- eslint-enable -->
  </div>
</template>

🧰 Configurations

Name
base
recommended
gjs logo recommended-gjs
gts logo recommended-gts

🍟 Rules

💼 Configurations enabled in.
✅ Set in the recommended configuration.
gjs logo Set in the recommended-gjs configuration.
gts logo Set in the recommended-gts configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.

Components

Name                         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

Computed Properties

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

Controllers

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

Deprecations

Name Description 💼 🔧 💡
closure-actions enforce usage of closure actions
new-module-imports enforce using "New Module Imports" from Ember RFC #176
no-array-prototype-extensions disallow usage of Ember's Array prototype extensions 🔧
no-at-ember-render-modifiers disallow importing from @ember/render-modifiers
no-deprecated-router-transition-methods enforce usage of router service transition methods 🔧
no-function-prototype-extensions disallow usage of Ember's function prototype extensions
no-implicit-injections enforce usage of implicit service injections 🔧
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

Ember Data

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 🔧

Ember Object

Name                                 Description 💼 🔧 💡
avoid-leaking-state-in-ember-objects disallow state leakage
no-get require using ES5 getters instead of Ember's get / getProperties functions 🔧
no-get-with-default disallow usage of the Ember's getWithDefault function 🔧
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 🔧

Ember Octane

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
no-tracked-properties-from-args disallow creating @tracked properties from this.args
template-indent enforce consistent indentation for gts/gjs templates 🔧
template-no-let-reference disallow referencing let variables in <template> gjs logo gts logo

jQuery

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

Miscellaneous

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 🔧
no-runloop disallow usage of @ember/runloop functions
require-fetch-import enforce explicit import for fetch()

Routes

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

Services

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) 💡

Stylistic Issues

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 🔧

Testing

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 🔧

🍻 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).

eslint-plugin-ember's People

Contributors

alexlafroscia avatar bachvo avatar barrythepenguin avatar bmish avatar clcuevas avatar dcyriller avatar ddzz avatar dependabot-preview[bot] avatar dependabot[bot] avatar dwickern avatar jbandura avatar laurmurclar avatar lin-ll avatar michalsnik avatar mikoscz avatar mongoose700 avatar nlfurniss avatar nullvoxpopuli avatar patocallaghan avatar patricklx avatar rafleszczynski avatar raido avatar rwjblue avatar scalvert avatar serabe avatar steventsao avatar t-sauer avatar tgvrssanthosh avatar turbo87 avatar ventuno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eslint-plugin-ember's Issues

Error running `ember` @ 2.6.2 with addon installed

I have an application running ember 2.6.2 and after installing eslint-plugin-ember I'm met with the following:

ember s --proxy
An addon must define a `name` property.

Is there anything I'm missing here? I took a brief look at the dependencies for the addon and nothing jumped out at me.

Many thanks.

Component rules not applied for components extending a common base component

The various component level rules do not get applied if you extend another application level component.

For example this shows no linter errors when it should:

export default MyComponent.extend({
  foo: 'bar',
   store: inject.service()
});

Whereas this does:

export default Component.extend({
  foo: 'bar',
   store: inject.service()
});

ESLint setup for plugin codebase

This plugin should have its own ESLint setup present, to assure code aesthetics/style consistency.

  • ESLint config, required dependencies
  • Running ESLint check as part of tests on TravisCI

alias-model-in-controller to restrictive?

I just started using eslint-plugin-ember. One thing I noticed is that i get a lot of alias-model-in-controller errors. The rule makes sense, but some times we have routes where we're not interested in the model. e.g a login route or a forgot password route.
I wonder if we have any alternative. Maybe detect if the model hook was implemented or not?

Improvement: Support for native ES6 Classes

Currently eslint-plugin-ember only lints standard EmberObject model classes, i.e. Controller.extend({ ... }). But native ES6 classes are on the horizon and may already be used with some caveats.

This code runs without any problems, with the necessary Babel configuration:

// Please excuse the German names here. I just copied this from our production app.
import Controller from '@ember/controller';
import { computed } from 'ember-decorators/object';
import { reads } from 'ember-decorators/object/computed';

export default class extends Controller {
  queryParams = {
    posteingangTab: {
      scope: 'controller'
    }
  };

  @reads('model') posteingang;

  @computed('posteingang')
  rezeptkopfdatenIds(posteingang) {
    return posteingang.hasMany('rezeptkopfdaten').ids();
  }
}

It would be awesome if this plugin could support both the old and new syntax.

Also a new rule proposal: use-es6-classes 😊

Contribution

Hi, I'm currently moving our codebase to conform to your eslint rules and am writing some codemods that people may find useful.

So far I've adapted Tom Dale's module codemod to handle your local-modules and use-ember-get-and-set rules. I've also created one for your no-on-calls-in-components rule and one for your use-brace-expansion rule.

Any feedback is welcome and let me know if the codemod doesn't align to the rule!

False positive for `no-empty-attrs`

We have a local variable named attr and the no-empty-attrs rule is being triggered. Renaming the variable works but should not raise this.

someArrayOfStrings.filter(function(attr) {
  return attr.underscore().endsWith('_id');
});

Drop support for node 4

According to ember-cli's site, the node version supported is the latest LTS, which happens to be Node 6. This probably means that we can drop support for Node 4.

use-ember-get-and-set and model relationships test

Consider this code in model unit test:

test('user relationship', function(assert) {
  const contact = this.store().modelFor('contact');
  const relationship = get(contact, 'relationshipsByName').get('user');
  assert.equal(relationship.key, 'user');
  assert.equal(relationship.kind, 'belongsTo');
});

This will throw an error because we're not using Ember.get getter for the user property. But we can't do it because relationshipsByName is an Ember.Map which has different get function.

My first idea was to add some optional settings to this rule where we would define particular preceding properties which shouldn't throw an error.

I'm almost sure that this won't be the only case, especially when we're using some JQuery addons which can also have their own getters (for example pickadate.js).

WDYT?

Describe supported Node.js versions

  • Point-out oldest supported Node.js version to run rules present in this plugin in README file (likely to be v4 LTS, as of this writing).
  • Update TravisCI testing matrix to run tests under it (in addition to currently used v6).

Support member functions

With the following...

foo: computed(function() {

}).volatile(),

bar: computed(function() {

})

I get the 'bar' multi-line function should be above 'foo' method, but I wasn't expecting to.

Add support for tagged templates

Component.extend({
  layout: hbs`Hello World`,
  init() {},
  actions: {}
});

layout is being detected as an unknown type, and so I am getting suggestions it should be placed lower down.

Import rules from "eslint-plugin-ember-best-practices"

It seems that the folks at LinkedIn started yet another ESLint plugin for Ember at https://github.com/ember-best-practices/eslint-plugin-ember-best-practices

IMHO we should focus our efforts on one plugin and eslint-plugin-ember seems to be the best fit for that.

I would like to propose to

  1. import the rules from the other project
  2. move this project into an independent GitHub org so that the people working on the other project can also act as maintainers here

/cc @michalsnik @trentmwillis @scalvert @rwjblue

New rule: "import-rsvp/jquery"

Instead of accessing Ember.$ and Ember.RSVP we should:

import $ from 'jquery';
import RSVP from 'rsvp';

I think it might be a good idea to encode that in an ESLint rule

Nested Brace Expanded Properties

I get errors from ember/use-brace-expansion with something like this:

  sampleProperty: computed(
    'foo.bar.{name,place}',
    'foo.baz.{thing,@each.stuff}',
    'foo.qux.[]',
    function() {

It doesn't pass until I nest them all like this:

  sampleProperty: computed(
    'foo.{bar.{name,place},baz.{thing,@each.stuff},qux.[]}',
    function() {

This does not work. Ember does not support nested brace expansion, per this comment/code.

alias-model-in-controller not working via route controller setup

alias-model-in-controller rule in documentation has an ability to be covered by setting model in route's setupController method. This is not working, and even is not intended to, so it should be removed from documentation.

Anyway, I hope there was some way to cover such scenarios. We have cases when our controller do not have model (this may be misconception on legacy code level, and can be 'not-so-easily' converted to components or something else). But what about case, when I do want stay with model property name?

New rule proposal - "no-unused-dependent-properties"

Proposed rule should check if there are any unused dependent properties in computed properties.

Correct:

test: computed('a', 'b', function() {
    return get(this, 'a') + get(this, 'b');
}),

Incorrect:

test: computed('a', 'b', function() {
    return get(this, 'a') + 'asd';
}),

New rule: `call-super`

In almost all cases you should call this._super(...arguments); when overriding methods.

Without inspecting the prototype chain, we can't guard for all possible overwrites, however we can at least guard for known methods provided by Ember. For example, overriding didReceiveAttrs in a component should prompt you to call this._super in that method.

Side note regarding #96: for ES6 classes it's super.didReceiveAttrs(...arguments); or super(...arguments); for the constructor. This does not fully work yet though: https://github.com/rwjblue/ember-decorators/issues/120#issuecomment-314750389

"alias-model-in-controller" should allow nested properties

export default Route.extend({
  store: service(),

  model() {
    const store = get(this, 'store');

    return hash({
      pets:   store.findAll('pet'),
      people: store.findAll('people')
    });
  }
});
export default Controller.extend({
  pets:   reads('model.pets'),
  people: reads('model.people')
});

Loading multiple different models via RSVP.hash and aliasing them is a common pattern in Ember applications. Currently alias-model-in-controller does not detect this and prompts the user to alias model.

Question on named-functions-in-promises

So I understand the main motivation for named-functions-in-promises is testability. I also prefer named functions for readability in stacktraces/debugging.

However, I currently am of the opinion that using arrow functions to bind context is a bit more readable than just doing a .bind(). Adapting the example from the docs:

export default Component.extend({
  actions: {
    updateUser(user) {
      user.save()
        .then(user => this._reloadUser(user))
        .then(() => this._notifyAboutSuccess())
        .catch(err => this._notifyAboutFailure(err));
        // .then(this._reloadUser.bind(this))
        // .then(this._notifyAboutSuccess.bind(this))
        // .catch(this._notifyAboutFailure.bind(this));
    },
  },

  // ... Imagine there's a lot of other functions here ...

  _reloadUser(user) {
    return user.reload();
  },
  _notifyAboutSuccess() { /* ... */ },
  _notifyAboutFailure(err) { /* ... */ },
});

From my perspective, this still keeps the testability and debuggability (though it will add an extra call to an anonymous function). It has the added benefit of being able to read through the promise chain and know what parameters each function takes without having to jump up and down the file. I'm happy to be persuaded otherwise.

Currently, the rule disallows using the anonymous functions, including arrow function expressions. My proposal would be to also allow arrow function expressions where the body is a CallExpression. To be more strict, can ensure that the method being called belongs to the parent this. Thoughts?

[BUG] routes-segments-snake-case

Hi guys,
during running eslint with your plugin I'm getting this error.
The temporary fix for that is disabling the rule but I would like to use it if possible :)

Cannot read property 'map' of null
TypeError: Cannot read property 'map' of null
    at getSegmentNames (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint-plugin-ember/lib/rules/routes-segments-snake-case.js:32:9)
    at CallExpression.routeOptions.properties.forEach (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint-plugin-ember/lib/rules/routes-segments-snake-case.js:48:34)
    at Array.forEach (native)
    at Linter.CallExpression (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint-plugin-ember/lib/rules/routes-segments-snake-case.js:47:35)
    at emitOne (events.js:101:20)
    at Linter.emit (events.js:191:7)
    at NodeEventGenerator.applySelector (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint/lib/util/node-event-generator.js:294:22)
    at NodeEventGenerator.enterNode (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint/lib/util/node-event-generator.js:308:14)
    at CodePathAnalyzer.enterNode (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:602:23)
    at Traverser.enter (/Users/maciej/.nvm/versions/node/v7.9.0/lib/node_modules/eslint/lib/linter.js:922:36)

Improve "order-in-*" rule warnings

Currently the rules only state "Check order of properties", but we should try to be more helpful and tell the user if the property should be moved up or down, possibly even a line number.

order-in-models + services?

The changes to order-in-models rule seem to want services injected in models to appear at the bottom of the model. This seems like a strange departure since other ordering rules want services to be at the top. Also the example does not show a way to customize where services should appear like in the order-in-controllers rule so I'm not sure if that's even an option or not.

Add optional `requireThisBinding` in `named-functions-in-promises` rule

As discussed in #64 we agreed that it might have a sense to add new optional setting, called for example requireThisBinding which would require using current module's methods instead of custom ones.

Example with requireThisBinding = true:

// Good
user.save().then(this._reloadPage.bind(this));

// Good
user.save().then(() => this._reloadPage());

// Bad
user.save().then(reloadPage.bind(this));

// Bad
user.save().then(() => reloadPage());

Default setting would be false so all of the above examples will work fine and we'll keep it backwards compatible.

I don't have any better name for the setting in my mind at this moment, so feel free to add your propositions in comments.

Brace rules confirmation

Should computed keys be braced with a preference for longer prefixes?

i.e.

computed('foo.bar.{baz,bash}', 'foo.baz')

is preferred to

computed('foo.{baz,bar.baz,bar.bash}')

order-in-controllers vs query-params-on-top

@davidpett encountered an issue (originally discussed in #23) with both of those rules turned on. On of which requires setting queryParams on the very top of a controller, but order-in-controllers rule wants service injections first.That leads to a clear problem.

My first thought is to add queryParams in order-in-controllers rule as the next thing after service injections (to be consistent) and getting rid of query-params-on-top (or at least disabling it in default as well as in recommended config).
That way if anyone would want to change order in his controllers he can do so in eslint's configuration.

Not sure right now if there is a better way of handling this though.

To be discussed.
cc @jbandura @kevinkucharczyk @netes @bardzusny @davidpett

Add a changelog

Changelogs are especially useful for projects like this where it serves as a go-to place to discover whether new rules have been added or existing rules have been deprecated.

New rule proposal: ensure this._super() is called in lifecycle hooks

It is generally a good practice to call this._super(...arguments) in Ember's lifecycle hooks, so this rule would enforce its existence. For setup hooks it would enforce it being the first thing called, and in teardown hooks it would enforce it being the last thing called.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.