TSLint - how to avoid that all my code underlined in red?
Asked Answered
A

1

6

I loaded an angular project in ItelliJ and all the files have some code underlined in red. The same red colour is on the scrollbar on the right. It seems the code is full of errors, but they are just missing spaces or things like that; the project is correctly builded. Even comments that don't have a space after the // get underlined in red.

The responsible is TSLint.

This distracts me; I would like to have underlined code only for "real" problems, and maybe yellow suggestion on the left (and not in scrollbar) for missing spaces in comments or import.

I found this (here https://github.com/Microsoft/vscode-tslint/issues/199)

tslint.alwaysShowRuleFailuresAsWarnings

but it's in visualStudio and I don't know where to add this option in intelliJ.

Do you know how to disable this red underlining?

Also another question, if I would disable TSLint, do I loose anything except formatting? I like to have a well-formatted code, but from the IntelliJ environment I would like to have mostly the syntax errors rather than formatting, at least not in real time (maybe i can run to check the code formatting when I want, as I did until now).

Here the screenshot as requested by the first answer. The settings are ignored, maybe there is a problem in my computer... (TLSint is 5.0.0 by the way)

Settings - I chosen no highlitghting First two lines are in red because a trailing whitespace. I don't like such whitespaces but the red is too much

Aargau answered 21/5, 2019 at 9:44 Comment(0)
A
7

The editor highlights the errors according to the severity levels specified in the TSLint configuration files by default. You can either set warn as defaultSeverity ({"defaultSeverity": "warn"}) in your tslint.json or override it with a specific severity in IDE settings (Settings | Editor | Inspections | TypeScript | TSLint): uncheck Use rule severity from the configuration file to use the inspection severity for all linter rules:

enter image description here

if I would disable TSLint, do I loose anything except formatting

If you are mostly interested in syntax errors, you can safely disable TSLint

Axletree answered 21/5, 2019 at 10:12 Comment(6)
I choosen "no highlighting, only fix" and other options - but the effect is similar. Many things are underlined in red. I also rebooted intelliJAargau
works fine for me - after choosing "no highlighting, only fix" TSLint errors are not highlighted in code, they are only shown in tooltips if I hover over the code. I didn't even need to restart. What errors can you see namely? provide screenshots of the error messagesAxletree
Thanks, it works now, i had to uncheck the «Use rule severity from the configuration file»Aargau
OK, can you still add the info about the unchecking the «Use rule severity from the configuration file» in it? For people who will readAargau
Please can you read my answer? I explicitly mentioned there that Use rule severity from the configuration file has to be unchecked (quotation: "uncheck Use rule severity from the configuration file to use the inspection severity for all linter rules"), and even provided screenshot with the cleared checkbox...Axletree
Yes you are right, I after read everything and marked the answer, I didn't see at the beginning maybe because there was a lot of text all toghether in the answer and I was distracted by that "density". Also I am not english so I need more time to read in this foreign language. But finally i re-read all ;)Aargau

© 2022 - 2024 — McMap. All rights reserved.