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.

Consistency/linting roadmap

See original GitHub issue

Following the long discussion in #1475, I think it would be nice to write a little roadmap to improve code consistency.

Before moving to eslint

  • Remove unnecessary escape in regex: {, } need no escape and neither do [, ] when used inside character class. Rule no-useless-escape.
  • Strings should single quotes. Backticks should be reserved for strings using substitution. Rule: quotes.
  • Statements should not end with a ;.
  • Remove all // @ts-ignore and fix the errors. These are trickier so I will wait until we merge #1543. See PR #1545.

Breaking rules compared to tslint.

  • Remove extra space before : when giving explicit type. Rule @typescript-eslint/type-annotation-spacing.

Non default eslint rules we want to enforce

  • Prefer type over interface. See here.
  • Ignore everything in src/lib.
  • Properties can be declared in the constructor. set "@typescript-eslint/no-parameter-properties": "off".

Extra changes

  • Convert .plist syntax files to .tmLanguage.json. I find .json files much easier to edit and maintain and they allow for more elaborate constructions not available in the .plist (say .xml) format. The vscode-tmlanguage extension can be used as a conversion tool.

Such changes may induce a lot of modifications and tend to blur file history. So, I want to make sure there is no objection before making any change. I will try to update this post with any further discussion.

The Done ticks refer to the developments in branch format.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tamuratakcommented, Jul 28, 2019

To eliminate the warning, warning File ignored because of a matching ignore pattern, we have to call eslint with ., not with a glob pattern, src/**/*.ts. See eslint/eslint/issues/5623.

By adding the following entries to .eslintignore,

diff --git a/.eslintignore b/.eslintignore
index 5e8f5ff..e959428 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1 +1,6 @@
 src/lib/**/*.ts
+dev/**/*.js
+resources/**/*.js
+out
+node_modules
+viewer

we have to call eslint with the --ext option,

./node_modules/.bin/eslint --ext .ts .

The extension will be able to be specified in a config file in the future release. See https://github.com/eslint/rfcs/tree/master/designs/2019-additional-lint-targets

1reaction
tamuratakcommented, Jul 27, 2019

We had better exclude src/lib/**/*.ts using .eslintignore.

I have posted separated comments to enable them to be hidden if resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linting the Stoplight Docs with Vale
It helps teams maintain a consistent style, and voice, across their documentation; Improve collaboration by having clear rules to follow. It can ...
Read more >
Announcing AsyncAPI & Spectral – Together!
The collaboration between Stoplight's open-source linting tool, Spectral, and AsyncAPI will be a game-changer for creating more consistency ...
Read more >
Roadmap: TSLint -> ESLint · Issue #4534 · palantir/tslint - GitHub
As you may have read in this blog post, we plan to deprecate TSLint in 2019 and support the migration to ESLint as...
Read more >
Overview | Buf®
Overview. Using a linter on your Protobuf sources enables you to enforce consistency and keep your API definitions in line with your chosen...
Read more >
Linting in a monorepo - Turborepo
We recommend specifying a single lint task inside your turbo.json . ... across a monorepo helps keep the development experience consistent.
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