No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    eslint error on import form quasar (import/no-extraneous-dependencies) with airbnb style

    Help
    1
    3
    1798
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Elco last edited by Elco

      I switched my eslint config to airbnb, because I prefer the style over standard.

      This causes an error in imports from quasar.

      To reproduce:

      quasar init test
      cd test
      npm install
      npm install -s eslint-config-airbnb-base
      

      Then in your .eslintrc.js file, change:
      extends: 'standard' to extends: 'airbnb-base'

      I get this error:

      /home/elco/repos/quasar-template/src/components/Error404.vue
        35:1   error  'quasar' should be listed in the project's dependencies. Run 'npm i -S quasar' to add it  import/no-extraneous-dependencies
        35:29  error  Unable to resolve path to module 'quasar'                                                 import/no-unresolved
        35:29  error  Missing file extension for "quasar"                                                       import/extensions
      

      This is with the standard template, I only changed the linter. I can obviously install quasar, but that resolves to this (https://www.npmjs.com/package/quasar), which is not the right thing.

      How can I make eslint understand the imports from quasar?


      PS: I use this to automatically fix linting errors (also makes switching from standard to airbnb easier):

      In package.json, add this line to scripts:
      "lint-fix": "eslint --fix --ext .js,.vue src"

      Now you can fix your linting errors by running: npm run lint-fix

      1 Reply Last reply Reply Quote 0
      • E
        Elco last edited by

        It seems to be caused by eslint being unaware of the alias in config/index.js

        1 Reply Last reply Reply Quote 0
        • E
          Elco last edited by

          Found a fix 🙂

          In eslintrc.js:

          plugins: [
              'html',
              'import',
            ],
            settings: {
              'import/core-modules': [ 'quasar' ],
            },
          

          install npm module eslint-plugin-import

          1 Reply Last reply Reply Quote 0
          • First post
            Last post