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: update typescript-eslint monorepo to v4 (major) #6233

Merged
merged 4 commits into from Sep 3, 2020

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Aug 31, 2020

This PR contains the following updates:

Package Type Update Change
@typescript-eslint/eslint-plugin dependencies major ^3.10.1 -> ^4.0.1
@typescript-eslint/eslint-plugin devDependencies major ^3.10.1 -> ^4.0.1
@typescript-eslint/parser dependencies major ^3.10.1 -> ^4.0.1
@typescript-eslint/parser devDependencies major ^3.10.1 -> ^4.0.1

Release Notes

typescript-eslint/typescript-eslint

v4.0.1

Compare Source

Bug Fixes

v4.0.0

Compare Source

Bug Fixes
  • eslint-plugin: [no-shadow] fix false-positive on enum declaration (#​2374) (9de669f)
  • eslint-plugin: [no-unused-vars] handle TSCallSignature (#​2336) (c70f54f)
  • correct decorator traversal for AssignmentPattern (#​2375) (d738fa4)
  • scope-manager: correct analysis of abstract class properties (#​2420) (cd84549)
  • typescript-estree: correct ChainExpression interaction with parentheses and non-nulls (#​2380) (762bc99)
Features
  • consume new scope analysis package (#​2039) (3be125d)
  • support ESTree optional chaining representation (#​2308) (e9d2ab6)
  • eslint-plugin: [ban-ts-comment] change default for ts-expect-error to allow-with-description (#​2351) (a3f163a), closes #​2146
  • eslint-plugin: [no-unnecessary-condition][strict-boolean-expressions] add option to make the rules error on files without strictNullChecks turned on (#​2345) (9273441)
  • eslint-plugin: [typedef] remove all defaults (#​2352) (a9cd6fb)
  • eslint-plugin: add consistent-type-imports rule (#​2367) (58b1c2d)
  • typescript-estree: switch to globby (#​2418) (3a7ec9b), closes #​2398
BREAKING CHANGES
  • typescript-estree: - removes the ability to supply a RegExp to projectFolderIgnoreList, and changes the meaning of the string value from a regex to a glob.

    • Removed decorators property from several Nodes that could never semantically have them (FunctionDeclaration, TSEnumDeclaration, and TSInterfaceDeclaration)
  • Removed AST_NODE_TYPES.Import. This is a minor breaking change as the node type that used this was removed ages ago.

  • eslint-plugin: Default rule options is a breaking change.

3.10.1 (2020-08-25)

Bug Fixes
  • eslint-plugin: [no-unnecessary-condition] correct regression with unary negations (#​2422) (d1f0887), closes #​2421

Renovate configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻️ Rebasing: Renovate will not automatically rebase this PR, because other commits have been found.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/major-typescript-eslint-monorepo branch from 9554817 to 30b5b95 Compare August 31, 2020 18:58
@raymondfeng raymondfeng force-pushed the renovate/major-typescript-eslint-monorepo branch from 30b5b95 to 8518302 Compare August 31, 2020 20:20
@raymondfeng
Copy link
Contributor

raymondfeng commented Aug 31, 2020

We need to replace no-shadow with @typescript-eslint/no-shadow.

@@ -40,6 +40,8 @@ describe('example-passport-login acceptance test', () => {
*/
before(() => MockTestOauth2SocialApp.startMock());
after(MockTestOauth2SocialApp.stopMock);

// eslint-disable-next-line mocha/handle-done-callback
before(async function setupApplication(this: Mocha.Context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a false alarm from mocha plugin. The rule should only apply to done instead of this.

Copy link
Member

Choose a reason for hiding this comment

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

Can you please open a bug report for the mocha plugin or perhaps send a pull request to fix the problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

@raymondfeng raymondfeng force-pushed the renovate/major-typescript-eslint-monorepo branch from 8518302 to 3061262 Compare August 31, 2020 21:40
@renovate renovate bot requested a review from nabdelgadir as a code owner August 31, 2020 21:40
@raymondfeng raymondfeng force-pushed the renovate/major-typescript-eslint-monorepo branch 4 times, most recently from d6e0071 to bbcc6fc Compare August 31, 2020 22:45
@bajtos
Copy link
Member

bajtos commented Sep 1, 2020

Regarding the first commit message:

BREAKING CHANGE: typescript-eslint 4.x introduces some breaking changes.
The following are impacted:

- decorator functions are correctly honored as usage of defined variables
- @typescript-eslint/no-shadow replaces no-shadow

Can you please wrap rule names in backticks to make them easier to read + get better formatting in the generated changelog?

BREAKING CHANGE: typescript-eslint 4.x introduces some breaking changes.
The following are impacted:

- decorator functions are correctly honored as usage of defined variables
- `@typescript-eslint/no-shadow` replaces `no-shadow`

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Looks mostly good, I have few comments to discuss. PTAL 👇🏻

* }
* ```
*/
'mocha/handle-done-callback': 'off',
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to disable this rule in @loopback/eslint-config, to fix the problem for all consumers, including our loopback4-example-shopping and the IBM products we are working on.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I initially had the change in eslint-config but I think it's too invasive. The usage of (this: Mocha.Context) signature is probably not very common. I prefer to leave it out for now.

@@ -7,6 +7,7 @@ import {generateUniqueId} from './unique-id';

export type BindingAddress<T = unknown> = string | BindingKey<T>;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export class BindingKey<ValueType> {
Copy link
Member

Choose a reason for hiding this comment

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

Which value is not used here? Is it ValueType?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. Unused type parameters are checked now by the rule.

packages/openapi-v3/src/controller-spec.ts Outdated Show resolved Hide resolved
@@ -20,6 +20,7 @@ interface ResponseWithContent extends ResponseObject {
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isResponseObject(c: any): c is ResponseWithContent {
// eslint-disable-next-line no-prototype-builtins
return !!c?.hasOwnProperty('content') && !!c.content;
Copy link
Member

Choose a reason for hiding this comment

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

Similarly here.

Suggested change
return !!c?.hasOwnProperty('content') && !!c.content;
return c && Object.prototype.hasOwnProperty.call(c, 'content') && !!c.content;

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed.

SourceWithRelations extends Entity,
Target extends Entity
>(
export function flattenTargetsOfOneToOneRelation<Target extends Entity>(
Copy link
Member

Choose a reason for hiding this comment

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

Removing the first of two parameters can break existing code, we must be careful here.

I assume most places in our codebase are leveraging type inference provided by the compiler, so no change is needed there. The places passing two parameters (SourceWithRelations, Target) will be found by the compiler and trigger compilation errors, so that should be easy to handle too.

However: is flattenTargetsOfOneToOneRelation a part of our public API? If yes, then we need to communicate this change to our users.

Copy link
Contributor

Choose a reason for hiding this comment

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

I did search references of flattenTargetsOfOneToOneRelation and it's only used internally. There is no mentioning in our docs either. Please also note that even our code does not explicitly provide the generic parameter types.

For this case, I think it's fine to fix it without bearing the extra overhead.

@raymondfeng raymondfeng force-pushed the renovate/major-typescript-eslint-monorepo branch 2 times, most recently from 53dbdad to bc0aa30 Compare September 1, 2020 15:30
@raymondfeng
Copy link
Contributor

@bajtos PTAL

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

👏🏻

@bajtos
Copy link
Member

bajtos commented Sep 3, 2020

To make the auto-generated release notes more useful, I am proposing to change the first commit message from chore to feat.

- chore: update typescript-eslint monorepo to v4
+ feat: update typescript-eslint monorepo to v4

At the moment, https://github.com/strongloop/loopback-next/blob/master/packages/eslint-config/CHANGELOG.md is full of "version bump only" entries, completely hiding the actual changes we are making in some of the releases.

renovate-bot and others added 4 commits September 3, 2020 08:29
Signed-off-by: Renovate Bot <bot@renovateapp.com>
…lint 4.x

BREAKING CHANGE: typescript-eslint 4.x introduces some breaking changes.
The following are impacted:

- decorator functions are correctly honored as usage of defined variables
- @typescript-eslint/no-shadow replaces no-shadow

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
The mocha plugin incorretly reports the following signature as a
violation of `mocha/handle-done-callback` (misinterpreting `this`
as `done`).

```ts
before(async function setupApplication(this: Mocha.Context) {
  this.timeout(6000);
  // ...
});
```

See lo1tuma/eslint-plugin-mocha#270

Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
Signed-off-by: Raymond Feng <enjoyjava@gmail.com>
@raymondfeng raymondfeng force-pushed the renovate/major-typescript-eslint-monorepo branch from bc0aa30 to d7a1e6a Compare September 3, 2020 15:29
@raymondfeng raymondfeng merged commit 5910843 into master Sep 3, 2020
@raymondfeng raymondfeng deleted the renovate/major-typescript-eslint-monorepo branch September 3, 2020 15:57
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.

None yet

3 participants