How to fix the “Exceeds maximum line length of 120” TypeScript TSLint error?

Sometimes, we want to fix the “Exceeds maximum line length of 120” TypeScript TSLint error.

In this article, we’ll look at how to fix the “Exceeds maximum line length of 120” TypeScript TSLint error.

How to fix the “Exceeds maximum line length of 120” TypeScript TSLint error?

To fix the “Exceeds maximum line length of 120” TypeScript TSLint error, we can add the // tslint:disable-next-line:max-line-length comment before the line that causes the error.

For instance, we write

// tslint:disable-next-line:max-line-length
import { PersonsSingleAccountComponent } from "../persons-information/fragments/persons-single-account/persons-single-account-bookings/persons-single-account-bookings.component";

to add // tslint:disable-next-line:max-line-length before the line that’s longer than 120 character to disable the TSLint max-line-length check on the line.

Conclusion

To fix the “Exceeds maximum line length of 120” TypeScript TSLint error, we can add the // tslint:disable-next-line:max-line-length comment before the line that causes the error.