'Prettier auto-correct javascript "import" statement into an one line but then eslitnt 'max-len' rule breaks

I have eslint setup with Prettier formatter in vscode.

there is this following original line,

import MyCustomComponentsIsThis 
   from 'queries/internal/consumer/MyCustomComponentsIsThis';

Prettier formatter always makes it into a single line as below

import MyCustomComponentsIsThis from 'queries/internal/consumer/MyCustomComponentsIsThis';

But this will break the esLint max-len rule so still shows it as error on vscode. How can i overide prettier to keep this like as above two lines of codes



Solution 1:[1]

Add an ignore pattern to your eslint config to ignore import lines:


      rules: {
        "max-len": [
          "error",
          {
            code: 88,
            comments: 86,
            ignoreUrls: true,
            ignoreTemplateLiterals: true,
            ignorePattern: "^import\\s.+\\sfrom\\s.+;$",
          },
        ],
      },

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tplusk