I've been trying to scour the internet to solve this but to no avail. Perhaps you can help me. I am getting tslint 'missing whitespace' warnings that say something like:
WARNING in ./src/app/content/content.controller.ts [4, 13]: missing whitespace [5, 21]: missing whitespace
I want to get rid of the warning
Here's an example of the code.... basically anywhere I have a colon for declaring type is where the error is happening. I don't want to put a space between it so I'd like the linter to not bug me about it...
export class ContentCtrl {
filters:IFilter[];
selectedFilters:IFilter[];
filterToAdd:IFilter;
/** @ngInject */
constructor(private $log:angular.ILogService,
private $timeout:any,
private toastr:any,
private filterService:FilterService) {
const self = this;
I looked through the tslint.json file and could not figure out how to get rid of it.
I saw a promising property that said: "typedef-whitespace"
I changed it to the following but, alas, to no-avail:
"typedef-whitespace": [true,
{
"callSignature": "noSpace",
"catchClause": "noSpace",
"indexSignature": "noSpace",
"parameter": "noSpace"
}
],
How do I get rid of the 'missing whitespace' error?
This error message comes from the whitespace rule. I believe the rule wants you to add a space either before or after (not sure which) the colon in type declarations. However, if you don't like this, you can disable the rule completely, or remove the check-type
option from your tslint.json
file.