Home > database >  Flutter/Dart: Ignore lines_longer_than_80_chars only for strings in vscode
Flutter/Dart: Ignore lines_longer_than_80_chars only for strings in vscode

Time:05-21

with the rule when a format the code it becomes like this:

 final regex = 
     r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$';

I want to keep like this when I format:

 final regex = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$';

CodePudding user response:

Code is reformatted by the formatter (dart format), not by the linter. The Dart VS Code extension has settings for the Dart formatter.

There is separately the lines_longer_than_80_chars lint for cases where dart format cannot break up a line (such as with long string literals). If you increase the line length for dart format, you likely will want to disable this lint.

There is no way to make dart format or dart analyzer apply these rules conditionally.

  • Related