Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propose rule disabling #5

Closed
wants to merge 1 commit into from

Conversation

erikshestopal
Copy link
Contributor

On Commercial, we have a lot of imports that following this format:

import UI from '@commercial/constants/ui';

and eslint flags these lines as:

  1. Unable to resolve path to module '@commercial/constants/ui'
  2. '@commercial/constants' should be listed in the project's dependencies.
  3. Missing file extension for "@commercial/constants/ui

I propose that we disable these three rules as we don't use file extensions in our imports and because the @commercial/blah pattern is very common and used everywhere in the code base.

Suggestions, feedback and alternatives welcome!

@gettinToasty
Copy link

gettinToasty commented Oct 26, 2017

marking our aliases with @ got rid of the "should be listed in the project's dependencies." violation for us, but there's an alternative fix:

import-js/eslint-plugin-import#89 (comment)

(i was actually just looking into this issue yesterday and this plugin seems promising)

@erikshestopal
Copy link
Contributor Author

@gettinToasty something like this?

["module-resolver", {
      "root": ["."],
      "cwd": "babelrc",
      "extensions": [".js", ".jsx"],
      "alias": {
        "@commercial": "./app/assets/javascripts/client",
        "@shared": "./app/assets/javascripts/shared"
      }
    }]

@gettinToasty
Copy link

gettinToasty commented Oct 26, 2017

specifically talking about this:

Just published 0.11 with the optional Webpack resolver plugin. To have the linter read your aliases, just add import/resolver: webpack as a setting in your .eslintrc and make sure to install eslint-import-resolver-webpack wherever the plugin is installed (globally or dev dependency or what have you).

@erikshestopal
Copy link
Contributor Author

Closing since we are moving towards removing react-treat.

@erikshestopal erikshestopal deleted the es-propose-new-disabled-rules branch October 27, 2017 17:27
@gettinToasty
Copy link

gettinToasty commented Oct 27, 2017

i'm not sure what removing react-treat has to do with this? i know at least in our project we have a bunch of locally aliased names and i'm pretty sure commercial does too?

see: all dis shit
screen shot 2017-10-27 at 10 37 57 am

@erikshestopal erikshestopal restored the es-propose-new-disabled-rules branch October 27, 2017 18:26
@erikshestopal
Copy link
Contributor Author

@gettinToasty oh sorry, wrong repo lol!

@erikshestopal erikshestopal reopened this Oct 27, 2017
@albertovillalobos
Copy link

@ThisIsErik lol

@berfarah
Copy link
Contributor

Are there any extensions of eslint that would be able to take webpack configuration into account for resolving imports?

@gettinToasty
Copy link

@berfarah thats literally what i just linked to above lol

@berfarah
Copy link
Contributor

My bad, I missed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants