Search code examples
ember.jseslintcode-climate

codeclimate - eslint errors on ember app


Looking for some clarity around a few of these codeclimate ESLINT issues. They are lacking documentation on http://eslint.org/docs/rules/.

I'm hesitant on just "excluding" or removing them from the .eslintrc as I'm sure they have worth, I just can't find a way to resolve them or read more about them.

  • "Unable to resolve path to module 'ember'."
    • import Ember from 'ember';
  • "'my-app' should be listed in the project's dependencies. Run 'npm i -S my-app' to add it"
    • import DateTimeMixin from 'my-app/mixins/controllers/datetime';
    • my-app is not an npm module, its just the project namespace/path.
  • "'ember-data-url-templates' should be listed in the project's dependencies, not devDependencies."
    • import UrlTemplates from 'ember-data-url-templates';
    • How is this determined? Dependencies are automatically added to devDependencies when something like ember install ... is run.

Appreciate any insight/clarity!


Solution

  • The reason why those rules lack documentation on ESLint site, is because they are not part of the ESLint, but instead come from the plugins. First one comes from eslint-plugin-import (I think it's this rule: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md), the other two are coming from eslint-plugin-node (this rule: https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-import.md).

    ESLint is a pluggable linter. As such, a lot of popular rules are not part of ESLint itself and are created by community. Because of that, ESLint documentation only covers rules that are distributed as part of ESLint itself.