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

Library is broken with Typescript v5.2 #64

Open
AndreaPontrandolfo opened this issue Sep 12, 2023 · 12 comments
Open

Library is broken with Typescript v5.2 #64

AndreaPontrandolfo opened this issue Sep 12, 2023 · 12 comments

Comments

@AndreaPontrandolfo
Copy link

AndreaPontrandolfo commented Sep 12, 2023

With Typescript v5.2 using ESlint with this plugin throws an exception:

TypeError: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instead.

@DoubleJ-G
Copy link

DoubleJ-G commented Sep 20, 2023

Also got an error on

Error while loading rule 'etc/no-internal': Cannot read properties of undefined (reading 'text')

Appears to happen on TS 5.2 and 5.3

@ekilah
Copy link

ekilah commented Sep 20, 2023

I was doing a TS 5.2 upgrade today and saw this issue. However, I wasn't seeing any problem on TS 5.2 in my own project, which doesn't configure eslint-plugin-etc to do anything but the default.

i.e. all I do in .eslintrc.js is this:

plugins: [
  // other plugins
  'etc'
]

Curious what the repro steps are for an issue? For example, do I need code that breaks a certain rule, or a certain rule enabled, to see an issue?

I am on version 2.0.2 if that makes a difference.

@AndreaPontrandolfo
Copy link
Author

Curious what the repro steps are for an issue? For example, do I need code that breaks a certain rule, or a certain rule enabled, to see an issue?

Can you share the full configuration? Because of course, if you not enabling ANY eslint-plugin-etc rules, you are not gonna see any errors.

@ekilah
Copy link

ekilah commented Sep 20, 2023

You may have missed my edit above, I have since added my config :)

@AndreaPontrandolfo
Copy link
Author

You may have missed my edit above, I have since added my config :)

I mean the whole file.

@ekilah
Copy link

ekilah commented Sep 20, 2023

I use lots of lint configs, so I won't post the whole thing, but the only other relevant part of the file (to eslint-plugin-etc) is the config for one of the rules:

'etc/no-implicit-any-catch': ['error', {allowExplicitAny: false}],

Otherwise, the plugin bit above should mean that I'm using the recommended rule set, I believe:

https://github.com/cartant/eslint-plugin-etc/blob/e04da45c70d404177a11294ed3891cc85aaf4def/source/configs/recommended.ts

but maybe that's not how it works 🤔

@ekilah
Copy link

ekilah commented Sep 20, 2023

Ah, right, I forgot, that is indeed not how it works. I don't have

extends: ["plugin:etc/recommended"],

so i guess I'll amend my previous statement: It seems like this one rule etc/no-implicit-any-catch works fine on TS 5.2 from my limited tests :)

@nirtamir2
Copy link

I have the same issue of #64 (comment)
I specifically for:

type AnyObject = Record<string, unknown>;

// HERE IS THE LINE THAT BREAK
function pick<T extends AnyObject, K extends keyof T>(
  obj: T,
  keys: Array<K>
): Pick<T, K> {
  const picked: Partial<Pick<T, K>> = {};

  for (const key of keys) {
    if (key in obj) {
      picked[key] = obj[key];
    }
  }

  return picked as Pick<T, K>;
}

and the rule that breaks is "etc/no-misused-generics": "error",

@cartant
Copy link
Owner

cartant commented Oct 4, 2023

I've taken a look at this. Fixing this is not straightforward, as the error is being effected from a dep that's pretty deep down:

ajafff/tsutils#156

A lot of these lint rules rely on tsutils, so this is likely to remain a problem until it's fixed in that package and a new version is published.

@Jelmerro
Copy link

Jelmerro commented Nov 8, 2023

From the comments on your linked issue it actually seems like this eslint-plugin-etc package should be using ts-api-utils instead of the outdated tsutils package, there is not going to be a new version of tsutils published, ts-api-utils IS the new version made by the eslint team. I was planning to make a PR, but it seems like the entire stack of *etc is based on tsutils, so I'll leave you to update this, but I did want to inform you about this development in that issue.

@cartant
Copy link
Owner

cartant commented Nov 8, 2023

Thanks for reading that issue's comments more thoroughly than I did, @Jelmerro. I'll take a look at ts-api-utils to see what'll be involved in getting things upgraded.

@CHE1RON
Copy link

CHE1RON commented Feb 29, 2024

Any news on this? 😉

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

No branches or pull requests

7 participants