Tslint: max-line-length optionally disabled for import statements

Created on 13 Apr 2016  Â·  5Comments  Â·  Source: palantir/tslint

We use 120-chars long max-line-length rule, but while the application grows, we often encounter cases where the 120 chars is to small for import statements.
For some time, we've used a workaround, breaking line after from keyword:

import {ReallyLongClassNameLikeInLargeApplications}
  from '../../../../nested/in/the/abyss/of/our/large/directory/structure/deep/deep/deep/ReallyLongClassNameLikeInLargeApplications.ts'

And this worked till one of the latest updates of WebStorm IDE, when we got awesome "optimize imports" flag in "Code > Reformat Code" dialog, which removes unused imports, duplication etc., but also removes our line-break in the import … from statement.
This became dangerous when I tried to configure IDE to reformat my code before each commit automatically. Implicit code reformat, causes breaking TSLint rule just before the commit – which brings the broken code, to the repo.

P2 Accepting PRs Enhancement

Most helpful comment

An option to specify an ignore pattern just landed in #3099

All 5 comments

any updates on this? @palantirtech

It's worth to mention that ESLint has an ignorePattern option that allows to address the issue of long imports: http://eslint.org/docs/rules/max-len#ignorepattern

Any updates? ignoring all line by commenting is nonsense.

I think adding ignorePattern option is right direction.

Is there any update for this issue?
I am using tslint and need some way how to ignore long import from being violated through max-line-length.
Is there at least some workaround?

An option to specify an ignore pattern just landed in #3099

Was this page helpful?
0 / 5 - 0 ratings