Search code examples
vue.jseslinteslintrceslintignore

ESLint linting node_modules


I have been trying all results on google search as a possible solution but without any luck so far.

Whenever I run npm run vue-cli-service serve --port 1024 on my vue project (created using vue cli) I get errors from node_modules

4111:10 Type alias 'MergeList' circularly references itself.
    4109 |     @hidden
    4110 |     */
  > 4111 |     type MergeList<O, Path extends List<Key>, O1 extends object, depth extends Depth, I extends Iteration = IterationOf<'0'>> = O extends object ? O extends (infer A)[] ? MergeList<A, Path, O1, depth, I>[] : Pos<I> extends Length<Path> ? OMerge<O, O1, depth> : {
         |          ^
    4112 |         [K in keyof O]: K extends Path[Pos<I>] ? MergeList<O[K], Path, O1, depth, Next<I>> : O[K];
    4113 |     } & {} : O;
    4114 |     /**

All errors looks like it is coming simplely from one folder: ts-toolbelt. The final result can be seen here: pastebin

Here is my .eslintrc:

module.exports = {
  root: true,

  env: {
    node: true,
  },

  extends: [
    'plugin:vue/essential',
    '@vue/airbnb',
    '@vue/typescript',
  ],

  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    "import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
    'import/no-cycle': 'off',
  },

  parserOptions: {
    parser: '@typescript-eslint/parser',
    exclude: [
      "node_modules"
    ]
  },

  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)'
      ],
      env: {
        jest: true
      }
    }
  ],
};

.eslintignore

node_modules/
public/
bin/
build/

vue.config.js

module.exports = {
  transpileDependencies: [
    'vuetify',
  ],
  pwa: {
    workboxOptions: {
      skipWaiting: true,
    },
  },
};

Thank you for anyone taking the time to help


Solution

  • Use ignorePatterns in .eslintrc.js:

    module.exports = {
      // ...
      ignorePatterns: ["**/node_modules/**"] // THIS WORKS!
    };