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

Chore(upgrade toolings) #102

Merged
merged 3 commits into from
Jun 9, 2023
Merged

Conversation

jmetev1
Copy link
Contributor

@jmetev1 jmetev1 commented Jun 7, 2023

Description

Brief description of the changes made in the PR. This helps in making better changelog
[x] replace tslint with eslint and typescript-eslint plugin
[x] use prettier to keep consistent formatting
[x] upgrade dependency version (did this mean just lint deps or others too?
[x] upgrade typescript to latest version

Reference to any github issues

  • addresses some of Upgrade toolings #100
    Right now linting is failing. This config comes with some new rules. So someone needs to decide whether to disable those rules or fix all the places that are failing or disable some rules in some places. I didn't want to make that decision. Here is output at moment. Some of rules are way to the right if you want to see.
   23:21  warning  Unexpected any. Specify a different type                          @typescript-eslint/no-explicit-any
   24:21  warning  Unexpected any. Specify a different type                          @typescript-eslint/no-explicit-any
   36:18  error    An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-interface
  142:21  warning  Forbidden non-null assertion                                      @typescript-eslint/no-non-null-assertion
  145:24  warning  Forbidden non-null assertion                                      @typescript-eslint/no-non-null-assertion
  149:24  warning  Forbidden non-null assertion                                      @typescript-eslint/no-non-null-assertion
  153:24  warning  Forbidden non-null assertion                                      @typescript-eslint/no-non-null-assertion
  165:43  warning  Forbidden non-null assertion                                      @typescript-eslint/no-non-null-assertion
  170:45  warning  Forbidden non-null assertion                                      @typescript-eslint/no-non-null-assertion
  234:31  warning  Unexpected any. Specify a different type                          @typescript-eslint/no-explicit-any
  238:29  warning  Unexpected any. Specify a different type                          @typescript-eslint/no-explicit-any

/Users/jacquesmetevier/rhea-promise/lib/connection.ts
  127:16  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  142:15  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  171:46  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  245:50  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  266:12  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  273:32  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  330:13  error    'onOpen' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                   prefer-const
  331:13  error    'onClose' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                  prefer-const
  332:13  error    'onAbort' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                  prefer-const
  334:13  error    'waitTimer' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                prefer-const
  334:24  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  336:32  error    Don't use `Function` as a type. The `Function` type accepts any function-like value.
It provides no type safety when calling the function, which can be a common source of bugs.
It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.
If you are expecting the function to accept certain arguments, you should explicitly define the function shape  @typescript-eslint/ban-types
  347:19  warning  'context' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                 @typescript-eslint/no-unused-vars
  371:17  error    Type string trivially inferred from a string literal, remove type annotation                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-inferrable-types
  380:52  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  380:52  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  414:13  error    'onClose' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                  prefer-const
  415:13  error    'onError' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                  prefer-const
  416:13  error    'onDisconnected' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                           prefer-const
  417:13  error    'onAbort' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                  prefer-const
  419:13  error    'waitTimer' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                prefer-const
  419:24  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  432:20  warning  'context' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                 @typescript-eslint/no-unused-vars
  463:17  error    Type string trivially inferred from a string literal, remove type annotation                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-inferrable-types
  472:52  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  472:52  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  494:9   error    Type boolean trivially inferred from a boolean literal, remove type annotation                                                                                                                                                                                                                                                                                                                                      @typescript-eslint/no-inferrable-types
  603:11  error    'onOpen' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                   prefer-const
  604:11  error    'onClose' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                  prefer-const
  605:11  error    'onDisconnected' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                           prefer-const
  606:11  error    'waitTimer' is never reassigned. Use 'const' instead                                                                                                                                                                                                                                                                                                                                                                prefer-const
  606:22  warning  Unexpected any. Specify a different type                                                                                                                                                                                                                                                                                                                                                                            @typescript-eslint/no-explicit-any
  619:17  warning  'context' is defined but never used                                                                                                                                                                                                                                                                                                                                                                                 @typescript-eslint/no-unused-vars
  628:20  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  629:23  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  644:15  error    Type string trivially inferred from a string literal, remove type annotation                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-inferrable-types
  654:50  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion
  654:50  warning  Forbidden non-null assertion                                                                                                                                                                                                                                                                                                                                                                                        @typescript-eslint/no-non-null-assertion

/Users/jacquesmetevier/rhea-promise/lib/container.ts
   71:31  warning  Unexpected any. Specify a different type                                                           @typescript-eslint/no-explicit-any
  104:26  warning  Unexpected any. Specify a different type                                                           @typescript-eslint/no-explicit-any
  104:32  warning  Unexpected any. Specify a different type                                                           @typescript-eslint/no-explicit-any
  108:3   error    Member create should be declared before all public instance method definitions                     @typescript-eslint/member-ordering
  112:3   error    Member copyFromContainerInstance should be declared before all public instance method definitions  @typescript-eslint/member-ordering

/Users/jacquesmetevier/rhea-promise/lib/entity.ts
  18:3  error  Type number trivially inferred from a number literal, remove type annotation  @typescript-eslint/no-inferrable-types

/Users/jacquesmetevier/rhea-promise/lib/eventContext.ts
   84:8   error    Use 'namespace' instead of 'module' to declare custom TypeScript modules  @typescript-eslint/prefer-namespace-keyword
   84:8   error    ES2015 module syntax is preferred over namespaces                         @typescript-eslint/no-namespace
  107:10  warning  Unexpected any. Specify a different type                                  @typescript-eslint/no-explicit-any

/Users/jacquesmetevier/rhea-promise/lib/link.ts
   55:32  warning  Unexpected any. Specify a different type                                                  @typescript-eslint/no-explicit-any
   75:3   error    Member target should be declared before all public instance set definitions               @typescript-eslint/member-ordering
   83:3   error    Member maxMessageSize should be declared before all public instance set definitions       @typescript-eslint/member-ordering
   87:3   error    Member offeredCapabilities should be declared before all public instance set definitions  @typescript-eslint/member-ordering
   91:3   error    Member desiredCapabilities should be declared before all public instance set definitions  @typescript-eslint/member-ordering
   95:3   error    Member address should be declared before all public instance set definitions              @typescript-eslint/member-ordering
   99:3   error    Member credit should be declared before all public instance set definitions               @typescript-eslint/member-ordering
  100:27  warning  Unexpected any. Specify a different type                                                  @typescript-eslint/no-explicit-any
  103:3   error    Member session should be declared before all public instance set definitions              @typescript-eslint/member-ordering
  107:3   error    Member connection should be declared before all public instance set definitions           @typescript-eslint/member-ordering
  246:13  error    'onError' is never reassigned. Use 'const' instead                                        prefer-const
  247:13  error    'onClose' is never reassigned. Use 'const' instead                                        prefer-const
  248:13  error    'onDisconnected' is never reassigned. Use 'const' instead                                 prefer-const
  249:13  error    'waitTimer' is never reassigned. Use 'const' instead                                      prefer-const
  249:24  warning  Unexpected any. Specify a different type                                                  @typescript-eslint/no-explicit-any
  259:20  warning  'context' is defined but never used                                                       @typescript-eslint/no-unused-vars
  268:23  warning  Forbidden non-null assertion                                                              @typescript-eslint/no-non-null-assertion
  302:11  warning  Forbidden non-null assertion                                                              @typescript-eslint/no-non-null-assertion
  302:11  warning  Forbidden non-null assertion                                                              @typescript-eslint/no-non-null-assertion

/Users/jacquesmetevier/rhea-promise/lib/session.ts
   64:30  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
   67:19  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
   68:30  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
   81:9   error    Type string trivially inferred from a string literal, remove type annotation  @typescript-eslint/no-inferrable-types
   82:20  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
  166:13  error    'onError' is never reassigned. Use 'const' instead                            prefer-const
  167:13  error    'onClose' is never reassigned. Use 'const' instead                            prefer-const
  168:13  error    'onDisconnected' is never reassigned. Use 'const' instead                     prefer-const
  169:13  error    'onAbort' is never reassigned. Use 'const' instead                            prefer-const
  171:13  error    'waitTimer' is never reassigned. Use 'const' instead                          prefer-const
  171:24  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
  184:20  warning  'context' is defined but never used                                           @typescript-eslint/no-unused-vars
  194:42  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  195:18  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  216:17  error    Type string trivially inferred from a string literal, remove type annotation  @typescript-eslint/no-inferrable-types
  226:52  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  226:52  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  334:11  error    'onOpen' is never reassigned. Use 'const' instead                             prefer-const
  335:11  error    'onClose' is never reassigned. Use 'const' instead                            prefer-const
  336:11  error    'onDisconnected' is never reassigned. Use 'const' instead                     prefer-const
  337:11  error    'waitTimer' is never reassigned. Use 'const' instead                          prefer-const
  337:22  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
  373:17  warning  'context' is defined but never used                                           @typescript-eslint/no-unused-vars
  384:55  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  385:23  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  410:50  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  410:50  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  513:11  error    'onSendable' is never reassigned. Use 'const' instead                         prefer-const
  514:11  error    'onClose' is never reassigned. Use 'const' instead                            prefer-const
  515:11  error    'onDisconnected' is never reassigned. Use 'const' instead                     prefer-const
  516:11  error    'waitTimer' is never reassigned. Use 'const' instead                          prefer-const
  516:22  warning  Unexpected any. Specify a different type                                      @typescript-eslint/no-explicit-any
  529:46  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  532:46  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  535:46  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  538:46  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  554:21  warning  'context' is defined but never used                                           @typescript-eslint/no-unused-vars
  565:53  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  566:23  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  591:50  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion
  591:50  warning  Forbidden non-null assertion                                                  @typescript-eslint/no-non-null-assertion

/Users/jacquesmetevier/rhea-promise/lib/util/utils.ts
   92:34  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
   96:7   error    Type boolean trivially inferred from a boolean literal, remove type annotation  @typescript-eslint/no-inferrable-types
  157:12  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
  211:43  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
  211:51  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
  212:15  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
  219:43  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
  219:51  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any
  220:15  warning  Unexpected any. Specify a different type                                        @typescript-eslint/no-explicit-any```

@jmetev1 jmetev1 marked this pull request as ready for review June 7, 2023 19:07
@jeremymeng
Copy link
Collaborator

@jmetev1 thanks for the PR!

[x] upgrade dependency version (did this mean just lint deps or others too?

When I opened the issue I was thinking about all dependencies and devDpendencies

So someone needs to decide whether to disable those rules or fix all the places that are failing or disable some rules in some places. I didn't want to make that decision.

I agree. However, we don't want to break the build either as currently it runs lint script. We could either disable linting when building, or maybe merge this PR in a feature branch, fix linting errors, then merge back to main.

@jmetev1
Copy link
Contributor Author

jmetev1 commented Jun 9, 2023

  1. I don't mind fixing the lint errors. I just figured I would be stepping on someone else's toes. But you like the rules as they are? It should be catching all those things?
  2. I could upgrade more deps. You just want to update minor versions or go major versions? But there aren't really many more. Also did you intend to have package-lock in gitignore? That seems unconventional.

@jmetev1
Copy link
Contributor Author

jmetev1 commented Jun 9, 2023

all lint errors are addressed so it will build now.

@jeremymeng
Copy link
Collaborator

thank a lot! @jmetev1

@jeremymeng jeremymeng merged commit 25a8aee into amqp:master Jun 9, 2023
@jeremymeng
Copy link
Collaborator

jeremymeng commented Jun 9, 2023

2. I could upgrade more deps. You just want to update minor versions or go major versions? But there aren't really many more.

ideally I'd like to go to the latest major just for being able to receive security updates if there will be any. Not a lot of packages address security issue in their older versions. Some major updates may not be straightforward (Mocha v10 has been give me headaches).

Also did you intend to have package-lock in gitignore? That seems unconventional.

That's before I started working on this project. I don't know why the lock file is even commited.

@jmetev1
Copy link
Contributor Author

jmetev1 commented Jun 13, 2023

the lock file is not committed right now. i'm saying i think it's more standard for it to be committed. i would say it should be taken out of gitignore. but i'll leave that up to you.

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.

2 participants