Sp-dev-docs: Can we please have a root level tslint.json?

Created on 8 Mar 2018  路  6Comments  路  Source: SharePoint/sp-dev-docs

Category

  • [ X] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

It's really frustrating to have linting failures in the VSCode editor in freshly generated code. It can also be somewhat less productive to have linting issues arise and not be notified of them until the build pipeline executes the linting step.

Expected or Desired Behavior

When using VSCode and tslint with the vscode-tslint extension we should not get linting warnings with the default generated code.

Sexy valid TypeScript

Observed Behavior

When using VSCode and tslint with the vscode-tslint extension we get linting warnings with the default generated code.

Ugly Redsquigglies

Steps to Reproduce

Install the tslint extension in VSCode
Generate a new webpart
Open the the webpart.ts file and observe the linting failures

Suggested resolution

Add a tslint.json file to the root of the project with the below content:

{
    "rulesDirectory": "./config"
}

This is a simple fix to ensure that developers get informed of linting issues in the best editor

Most helpful comment

@joelfmrodrigues Thanks for that blog post, I saw the change that you made to the samples some time back. I finally got around to raising the issue here though.

All 6 comments

+1 to that. Wrote a blog post some time ago about that and also created a new thread on user voice, but only got a few votes...
https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/32544955-make-spfx-projects-compatible-with-tslint-vscode-e
That setup definitely increases productivity

@joelfmrodrigues Thanks for that blog post, I saw the change that you made to the samples some time back. I finally got around to raising the issue here though.

Thanks for your feedback @gavinbarron
We will consider adding this on the next version of SPFx Yeoman generator.

Thanks Marc :)

@mpasarin that would be awesome! Once you try the TSLint extension on VS code while doing SPFx dev, you never go back :) Waiting for the command line to display errors is just not fast enough

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings