question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enforce "Import Destructuring Spacing" in tslint

See original GitHub issue

Motivation

Right now there is no consistent way to handle spaces in destructured imports, this introduces some noise in commits as right now we have no spaces, but angular CLI as well as some formatters actually add spaces.

Also ts-lint only validates the case with spaces

Solution

  • Add spaces across the codebase
  • Add TS-lint rule
  • Document the configuration for the websorm and VSCode

Editor configuration

Intellij/Webstorm Settings -> Code Style -> TypeScript -> Spaces Tab -> Check “ES6 import/export braces”

see also https://github.com/mgechev/codelyzer/issues/40 https://stackoverflow.com/questions/41447602/tslint-remove-missing-whitespace-rule-on-import

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
RingoKamcommented, Jul 2, 2017

Oh didn’t see this until now lol

0reactions
kirjscommented, Jun 10, 2017

Added to contributing md, assume vs code does that

Read more comments on GitHub >

github_iconTop Results From Across the Web

TSLint core rules - Palantir Open Source
trailing-comma - Requires or disallows trailing commas in array and object literals, destructuring assignments, function typings, named imports and exports and ...
Read more >
TSLINT: Remove Missing Whitespace rule on Import
However, I am new to linting and I am not sure where to find the right rule to disable. I still want some...
Read more >
Codelyzer core rules
import -destructuring-spacing - Ensures imports are consistent and tidy. TS Only. no-host-metadata-property - Disallows usage of the host metadata property. TS ...
Read more >
object-curly-spacing - ESLint - Pluggable JavaScript Linter
Rule Details​​ This rule enforces consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.
Read more >
angular-tslint-rules - npm
Shared TSLint & codelyzer rules to enforce a consistent code style for Angular development. ... Put one space between the import statement keywords....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found