简体   繁体   中英

Missing file extension "tsx" for "./reducer" error after using eslint-config-airbnb

I am using eslint and prettier code formatters for my project. After using airbnb I am getting errors like

  • Missing file extension "tsx" for "./reducer"
  • Missing file extension "tsx" for "./saga"

reducer has index.tsx and so does saga folder. I have tried import/extensions: [".js", ".jsx", ".tsx"] in my.eslintrc.yml file but still getting the error.

eslint-config-airbnb has this rule enabled:

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

See here .

If want to turn it off, you could override it in your own eslint config file like so:

'import/extensions': 'off'

More information on how you could configure this specific rule can be found here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM