Skip to content

Code style/formatting rules for TypeScript are not enforced by TSLint #2362

@mturley

Description

@mturley

In patternfly-4/react-core, in our tslint.json we extend tslint-config-prettier, but we're not running Prettier when we lint our TypeScript.

From https://www.npmjs.com/package/tslint-config-prettier:

Do you want to use TSLint and Prettier without conflicts? tslint-config-prettier disables all conflicting rules that may cause such problems. Prettier takes care of the formatting whereas tslint takes care of all the other things.

With this configuration, TSLint is no longer enforcing any code formatting / style rules. For code formatting we need to run Prettier, either by using its CLI directly, or by adding tslint-plugin-prettier to our tslint configuration.

I noticed these rules were not being enforced when I reviewed this commit: 6eb1ffd#diff-d2816c60d6fa971b0f62310ff6bef46eR26
Note the lack of indentation in that block.
Here's the CI task that ran tslint on that commit and passed: https://circleci.com/gh/patternfly/patternfly-react/3602

@redallen suggested that maybe we should remove eslint-plugin-prettier from our eslint configuration and use the prettier CLI directly for both eslint and tslint, to get a consistent configuration. This needs more investigation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions