My goal is to write clean and readable code. The least I can do is make sure it’s formatted correctly. One of my favorite Visual Studio plugins is called Prettier. I use that plugin to make sure everything is formatted consistently throughout my code. My biggest issue is that it adds semicolons to every single function.

But it doesn’t treat all functions equal.

The SPFx tslint rules don’t like that.

Prettier has the option to enable / disable semicolons at the end of every statement. Disabling that setting takes away all the semicolons from all lines. I like to have semicolons after each statement.

You could disable the semi-colon check in SPFx project’s tslint.json file

OR you could edit your gulpfile.js and add suppression to prevent the message.

The build.AddSuppression will accept a string or a regex. You can see here I’ve added a regex value to suppress errors that end with ‘error semicolon: Unecessary semicolon”

Either way works for me – no more semicolon warnings!

Comments
  • pooja
    Posted at 8:00 pm August 23, 2019
    pooja
    Reply
    Author

    Thank you so much for posting such an amazing and helpful post. All Your shares and post gives a perfect direction for developers šŸ™‚

  • Leave a Reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.