How to customize formatting warning in Webclipse for Angular 2 Typescript? - eclipse

Webclipse gives a lot for formatting warning for the Typescript code, for example, for blank spaces and for using double quotes instead of single quotes. The latter one is annoying since using double quotes for strings is quite appropriate.
Is it possible to customize these warnings?

It appeared that the Webclipse setting for warnings are in the file tslint.json in the root directory of the Angular application. The easiest way to change these settings is to use the Eclipse Quick Fix option, and then use the hint to remove this warning from tslint.json.

Related

Need to suppress link.no-such-reference for Doc-fx note

We use DocFx in our projects. We would like to check for no problems in VSCode but we get the warning link.no-such-reference for DocFx Note formatting which uses square brackets.
Do you support suppression of problems like using:
[//]: # (<!-- markdownlint-disable line-length -->)
Could not find any documentation about suppressing one problem type once at a single code line.

Visual Studio Code double quote syntax

I just upgraded VS code to v1.20.1 and now I have errors everywhere telling me to replace double quotes with single quotes.
First of, I'm thinking of disabling this feature, since I'm a double quote guy. I have checked my user settings(File->Preferences->Settings) and searched for any tslint validations that has got to do with quotes and couldn't find any.
Second of all, I thought to myself that maybe it could be good practice to use single quotes in JS and I should get used to it.
I though doubt this might be good practice, if not please do prove me wrong.
My question are:
Is or will in the later feature using single quotes in JS will be considered as good practice?
How do I disable double quotes validation in VS Code?
Using single or double quotes is a matter of programming taste, at least for me.
To disable quotes validation you need to edit tslint.json (or create it: Create a tslint json file command) in project's folder, find the rule "quotemark" and set the following:
"quotemark": [
false
]
As you see, it is a linter configuration, instead of vscode one. More information of this rule on tslint documentation.
If you want to continue with your double quotes set:
"quotemark": [
true,
"double"
]
Hope it's useful for you.

Use IntelijJ as default diff/merge tool in Eclipse

Has anyone maybe used Intelij as the default merge/diff tool in Eclipse?
I don't know what parameters should be used in the highlighted fields below.
EDIT:
See https://www.jetbrains.com/help/idea/2016.2/running-intellij-idea-as-a-diff-or-merge-command-line-tool.html about what kind of command-line parameters IntelliJ expects for the diff/merge: it seems like you have to add a diff argument first and then use the ${file1Path} and other placeholders separated with spaces, without using any comma nor and.

Highlighting line which are not correctly formated [Eclipse]

So I have some formatting rule to follow, such as :
Space on each side of operator (*, =, +, %, etc)
No space at the end of a line
No more than 80 chars per line
Is there a way to highlight in red line containing formating error?
The eclipse auto-formating tool is no good because either :
It will change to many line (old code not written by me)
or it won't (only my code)
Because I must follow some "colorfull" guideline :
You must change formating error relative to operators in old code but nothing else
Your code must be correctly formated.
Any ideas?
Thanks
You can select which lines of code you want to format. The Eclipse formatting tool doesn't have to run across the entire file. To do this: select the lines you want to format, then press Ctrl-Shift-F.
You could try using the Eclipse Checkstyle Plugin.
You'll need to configure it with just the rules that you need (the default configuration is very strict, so create a new one with just the rules you care about).
This will highlight all lines with formatting issues. I don't think it's possible to ignore old code using the plugin.
Talk to whoever created that coding guideline. It does not make sense in the long run, because editing code in Eclipse will always apply all current formatting rules (which violates that guideline) or none, if you disable the formatter (which leads to you writing bad code).
If there is really no way around that guideline, then you should split your workflow into 2 phases: Reformat all existing code one time to fulfill that operator guideline. You may use any tool you like, even just a regular expression search and replace might be fine.
After that has been done, configure Eclipse to auto-format only changed lines, but always apply all formattings to each changed line. There is no good reason to not re-format the other 75 characters in an existing line of code, if you already touched 5 characters of it.

Eclipse formatter is not strict?

I use this to set my maximum line width to 80:
org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.lineSplit=80
Let's face it, Eclipse's formatter is not strict.
It has a very high success rate, and format things very nicely indeed, but it is not 100% strict, sometimes it leaves lines > 80 characters and so it is useless for a project that just lints and refuses code not strictly matching the 80 columns limit and requires Eclipse code auto-formatting.
These 2 things, Eclipse-based formatting and lint, can only really work together when the success rate is 100%. If not, even changing the code by hand triggers a "reformat/reflow" on save and the check-in bombs and refuses the commit.
I cannot disable the formatting on the client and I cannot circumvent the linting.
Is there any way at all to just make the wonderful Eclipse formatter 100% strict? Something like "considerTheLimitSeriously=true"?
Notice: it's eminently "unstrict" in lines with method signatures, but not only.
Sorry, there's no way to make the formatter 100% strict when it comes to line splitting. According to JLS 3.8. Identifiers:
An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.
So it's possible that some lines cannot be split without causing a compile error.
The best you can do is set the formatting as strict as possible, then look at specific lines in your code to see where this is failing. On the Eclipse main menu go to Window > Preferences, then go to the Java > Code Style > Formatter tab, then click Edit. There you'll find a Line Wrapping tab where you can customize the line wrapping rules.