Search code examples
javascriptvue.jseslintlintprettier

ESLint / Prettier -- enforce max-len / printWidth, but don't require it?


Is there a way to configure ESLint w/ Prettier to enforce the max-len / printWidth rule but not require it? That is to say, allow you to add line breaks as you see fit?

// eslintrc.js

"max-len": [0, 160, 2, { ignoreUrls: true }],

// prettier.config.js

module.exports = {
  trailingComma: "all",
  tabWidth: 2,
  semi: true,
  singleQuote: false,
  printWidth: 160,
};

Solution

  • Set print-width to 999 in prettier to turn it off, then set the eslint max-len rule to be a warning at what ever your preferred value is.