Eslint-plugin-import: 2.9.1 breaks import/extensions

Created on 9 Dec 2019  Â·  21Comments  Â·  Source: benmosher/eslint-plugin-import

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.

bug help wanted

Most helpful comment

When can we expect a release with this fixed?

All 21 comments

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

Reproduce step:

  1. git clone [email protected]:ant-design/ant-design.git
  2. cd ant-design
  3. npm install
  4. npm install [email protected]
  5. npm run lint:script

We are also experiencing this issue

Same here 😅

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"
          }
        ]

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"
      }
    ],

1521 / cc @saschanaz

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?

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

When can we expect a release with this fixed?

Can someone please publish a release with the fix, now that it has been merged to master (26 days ago)? Maybe a good idea to reopen, until a version with the fix has been published?

Issues are only closed when fixes are merged; releases have nothing to do with that.

This package is sometimes 6+ months between releases - 26 days is not a long period of time, especially spanning the holidays. A release will happen as soon as i have time to clear out the PR queue and cut one.

Hmm for a breaking bug such as this, given semantic versioning, why not just publish the patch when you approved the PR. By deliberarely leaving this package in a broken state 26 days longer than necessary, the consequense is that people/companies lose time/money (eventually they'd also lose trust in this package) while debugging. Those headaches could very easily have been avoided. Please prioritize breaking bugfixes instead of deliberately delaying them only to batch/bundle them in bigger releases. Or please reach out if you need more people to help do this.

Semver describes breakage, it doesn’t dictate a release schedule.

Please don’t attempt to dictate maintainers’ time and thus money either, especially if you’re not contributing money or effort (both of which are easily available options). I’m a person, i have a life, and the headaches I’d endure for prioritizing publishing this package sooner than it’s ready isn’t for you to say is less than the ones you’re enduring now.

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?

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

Same issue with .vue files.

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

@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.

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.

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.

@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.

Was this page helpful?
0 / 5 - 0 ratings