Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ESlint instead of TSlint #7719

Merged
merged 11 commits into from Aug 10, 2021
Merged

Conversation

horacehylee
Copy link
Contributor

@horacehylee horacehylee commented Aug 7, 2021

Description

Migrated TSlint configs to ESlint ones using tslint-to-eslint-config tool, and refined the configs to better match the current coding style.

Changes:

  • member-delimiter-style that as suggested default for type definition to be with semicolon
  • Indentation fixes that is enforced by eslint-indent
  • Added dependencies for ESlint with Typescript
  • Removed TSlint

Fixes #4698 (Start linting all TypeScript code with ESLint)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@github-actions
Copy link

github-actions bot commented Aug 7, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@github-actions
Copy link

github-actions bot commented Aug 7, 2021

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@horacehylee horacehylee marked this pull request as ready for review August 7, 2021 07:06
@stack72
Copy link
Contributor

stack72 commented Aug 9, 2021

/run-acceptance-tests

@github-actions
Copy link

github-actions bot commented Aug 9, 2021

Please view the results of the PR Build + Acceptance Tests Run Here

@emiliza emiliza requested a review from t0yv0 August 9, 2021 19:51
@@ -32,7 +32,7 @@ const grpcChannelOptions = { "grpc.max_receive_message_length": maxRPCMessageSiz
/**
* excessiveDebugOutput enables, well, pretty excessive debug output pertaining to resources and properties.
*/
export let excessiveDebugOutput: boolean = false;
export const excessiveDebugOutput: boolean = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be substantive?

`const` is a signal that the identifier won't be reassigned. `let` is a signal that the variable may be reassigned,

Will this prevent a user from reassigning this value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

I think the original intention was to allow it to be assigned. Though, I suspect nobody is setting it these days (besides maybe a Pulumi engineer on a rare occasion).

With ES6 modules, you aren't allowed to reassign an exported value from outside the module (imports are a read-only live view of the value), so it might be worth considering changing it to const to discourage anyone setting it from outside the module going forward.

Changing it to const does mean it isn't useful unless you're modifying the source directly (either by modifying a copy of @pulumi/pulumi inside node_modules or using yarn link locally). If being able to set it is missed, we could consider adding a setExcessiveDebugOutput function, or perhaps better, switch to using an environment variable that could work across all SDKs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case let's accept this change for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If being able to set it is missed, we could consider adding a setExcessiveDebugOutput function, or perhaps better, switch to using an environment variable that could work across all SDKs.

Could we open an issue for it? I could also work on this issue as well as a follow up.

@t0yv0
Copy link
Member

t0yv0 commented Aug 9, 2021

This is looking very helpful 👍

Almost all changes appear to be strictly lint-level (not substantive) except one change from let to const, is that correct? This is the only issue I'd like resolved before approving.

Also I've not used these tools in a long time so can't comment on the tslint config, but I'd vote to check this in and continue iterating as needed.

@horacehylee
Copy link
Contributor Author

The prefer-const config is enabled for both ESlint and TSlint config, which should prefer to use const than let

Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments. LGTM otherwise. Thanks, @horacehylee!

sdk/nodejs/.eslintrc.js Outdated Show resolved Hide resolved
CHANGELOG_PENDING.md Outdated Show resolved Hide resolved
@@ -32,7 +32,7 @@ const grpcChannelOptions = { "grpc.max_receive_message_length": maxRPCMessageSiz
/**
* excessiveDebugOutput enables, well, pretty excessive debug output pertaining to resources and properties.
*/
export let excessiveDebugOutput: boolean = false;
export const excessiveDebugOutput: boolean = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

I think the original intention was to allow it to be assigned. Though, I suspect nobody is setting it these days (besides maybe a Pulumi engineer on a rare occasion).

With ES6 modules, you aren't allowed to reassign an exported value from outside the module (imports are a read-only live view of the value), so it might be worth considering changing it to const to discourage anyone setting it from outside the module going forward.

Changing it to const does mean it isn't useful unless you're modifying the source directly (either by modifying a copy of @pulumi/pulumi inside node_modules or using yarn link locally). If being able to set it is missed, we could consider adding a setExcessiveDebugOutput function, or perhaps better, switch to using an environment variable that could work across all SDKs.

@github-actions
Copy link

PR is now waiting for a maintainer to run the acceptance tests.

Note for the maintainer: To run the acceptance tests, please comment /run-acceptance-tests on the PR

Further commands available:

  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@justinvp
Copy link
Member

/run-acceptance-tests

@github-actions
Copy link

Please view the results of the PR Build + Acceptance Tests Run Here

@justinvp justinvp merged commit a92a005 into pulumi:master Aug 10, 2021
@horacehylee horacehylee deleted the tslint-to-eslint branch August 11, 2021 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Start linting all TypeScript code with ESLint
4 participants