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

2.9.1 breaks import/extensions #1558

Closed
afc163 opened this issue Dec 9, 2019 · 21 comments · Fixed by #1563
Closed

2.9.1 breaks import/extensions #1558

afc163 opened this issue Dec 9, 2019 · 21 comments · Fixed by #1563

Comments

@afc163
Copy link

afc163 commented Dec 9, 2019

https://github.com/ant-design/ant-design/runs/339595849

/home/runner/work/ant-design/ant-design/components/_util/__tests__/util.test.js
   4:21  error  Missing file extension "ts" for "rc-util/lib/KeyCode"           import/extensions
   5:22  error  Missing file extension "ts" for "../raf"                        import/extensions
   6:38  error  Missing file extension "tsx" for "../throttleByAnimationFrame"  import/extensions
   7:32  error  Missing file extension "ts" for "../getDataOrAriaProps"         import/extensions
   8:26  error  Missing file extension "tsx" for "../triggerEvent"              import/extensions
   9:18  error  Missing file extension "tsx" for "../wave"                      import/extensions
  10:25  error  Missing file extension "tsx" for "../transButton"               import/extensions
  11:27  error  Missing file extension "tsx" for "../openAnimation"             import/extensions

2.8.3 works fine.

@ljharb
Copy link
Member

ljharb commented Dec 9, 2019

Can you share your eslint config, and the contents of the file?

@afc163
Copy link
Author

afc163 commented Dec 9, 2019

Reproduce step:

  1. git clone git@github.com:ant-design/ant-design.git
  2. cd ant-design
  3. npm install
  4. npm install eslint-plugin-import@2.9.1
  5. npm run lint:script

@suits-at
Copy link

suits-at commented Dec 9, 2019

We are also experiencing this issue

@krailler
Copy link

krailler commented Dec 9, 2019

Same here 😅

@AlberErre
Copy link

we are experience this issue too, a workaround is to add this to the config:

        "import/extensions": [
          "error",
          "always",
          {
            ts: "never",
            tsx: "never",
            js: "never",
            jsx: "never"
          }
        ]

@EvgenyOrekhov
Copy link

Started getting Missing file extension errors for packages like:

  • @ember/object/computed
  • @ember/routing/router
  • ember-intl/test-support

with the following configuration:

    "import/extensions": [
      "error",
      "ignorePackages",
      {
        "js": "never",
        "mjs": "never"
      }
    ],

@ljharb
Copy link
Member

ljharb commented Dec 9, 2019

#1521 / cc @saschanaz

@saschanaz
Copy link
Contributor

The existing test written before #1521 already says the errors in this issue is expected:

https://github.com/benmosher/eslint-plugin-import/blob/568ca430e3114c582e0ae49509ce294347f6e722/tests/src/rules/extensions.js#L290-L310

I'd say #1518 unexpectedly ignored those errors.

Maybe there should be a new option to ignore foo/baz?

@ljharb
Copy link
Member

ljharb commented Dec 10, 2019

when ignorePackages is true, i wouldn’t expect any warnings for any package with any configuration.

@rfgamaral
Copy link

When can we expect a release with this fixed?

@sorenhoyer

This comment has been minimized.

@ljharb

This comment has been minimized.

@sorenhoyer

This comment has been minimized.

@ljharb

This comment has been minimized.

@Methuselah96
Copy link

I tried to upgrade to 2.20.0 and this still seemed to be unresolved for me. Does anyone else still have issues with 2.20.0?

@ljharb
Copy link
Member

ljharb commented Jan 18, 2020

Please file a new issue if you’re still having trouble with 2.20.

cheezenaan added a commit to cheezenaan/blog that referenced this issue Jan 22, 2020
cheezenaan added a commit to cheezenaan/blog that referenced this issue Jan 22, 2020
* chore(deps): update dependency eslint-plugin-import to v2.20.0

* chore(eslint): Add settings for eslint-plugin-import

to cope with `import/extension` violation

ref. import-js/eslint-plugin-import#1558

Co-authored-by: WhiteSource Renovate <renovatebot@gmail.com>
Co-authored-by: cheezenaan <cheezenaan@gmail.com>
namiwa added a commit to auturec/app that referenced this issue Jan 22, 2020
fixes lint error for imported modules and packages seen in import-js/eslint-plugin-import#1558
yuya373 added a commit to yuya373/manga-viewer that referenced this issue Feb 24, 2020
@gkatsanos
Copy link

Same issue with .vue files.

  "settings": {
    "import/extensions": [
      "error",
      "ignorePackages", {
        ".vue": "never"
      }
    ],
    "import/resolver": {
      "node": {
        "paths": ["app/javascript"],
        "extensions": [".js", ".vue"]
      }
    }
  },

@ljharb
Copy link
Member

ljharb commented Mar 5, 2020

@gkatsanos your config is conflating the import/extensions setting with a rule, which it is not. See the readme, and please file a new issue if you’re still having trouble getting a valid configuration.

@gkatsanos
Copy link

gkatsanos commented Mar 5, 2020

Do you mind pointing me to the README anchor in question? This was working perfectly until I cleaned up my node_modules and upgraded this module..

"settings": {
    "import/extensions": [
      ".vue"
    ],
    "import/resolver": {
      "node": {
        "paths": ["app/javascript"],
        "extensions": [".js", ".vue"]
      }
    }
  },

this also produces the linting error.

@gkatsanos
Copy link

I went through https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md and tried literally ALL combinations. If you guys would add an example in this documentation to help us out so we wouldn't have to play detective with the config options, since clearly a breaking change was introduced, it would be tremendously helpful.

@ljharb
Copy link
Member

ljharb commented Mar 5, 2020

@gkatsanos https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md is the docs for the rule; https://github.com/benmosher/eslint-plugin-import#importextensions is the docs for the global setting. You likely want both defined.

again, a new issue would be ideal to discuss this. Please file one so we can adequately discuss your problem, separately from this resolved 3-month-old issue.

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

Successfully merging a pull request may close this issue.