Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Configs: fix TS2629 & no-class-assign duplicate #10229

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

Closed
2 tasks done
Rudxain opened this issue Oct 29, 2024 · 2 comments Β· Fixed by #10250
Closed
2 tasks done

Configs: fix TS2629 & no-class-assign duplicate #10229

Rudxain opened this issue Oct 29, 2024 · 2 comments Β· Fixed by #10250
Labels
accepting prs Go ahead, send a pull request that resolves this issue locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin preset config change Proposal for an addition, removal, or general change to a preset config

Comments

@Rudxain
Copy link
Contributor

Rudxain commented Oct 29, 2024

Before You File a Proposal Please Confirm You Have Done The Following...

Description

I followed the official instructions, but still stumbled upon this ESL rule enabled by default

Impacted Configurations

recommended

Additional Info

eslint.config.mjs:

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
	eslint.configs.recommended,
	...tseslint.configs.recommended,
);

tsconfig.json:

{
"compilerOptions": {
	"target": "ES2023",
	"skipLibCheck": true
},
"exclude": [ "node_modules" ]
}

package.json:

{
"name": "tsesl-min-repro",
"version": "0.0.0",
"main": "main.js",
"devDependencies": {
	"@eslint/js": "^9.13.0",
	"@types/eslint__js": "^8.42.3",
	"eslint": "^9.13.0",
	"typescript": "^5.6.3",
	"typescript-eslint": "^8.12.1"
}
}

main.ts:

class c { }
c = null

npx eslint .:

/home/rudxain/tsesl-min-repro/main.ts
  2:1  error  'c' is a class                          no-class-assign
  2:1  error  'c' is assigned a value but never used  @typescript-eslint/no-unused-vars

βœ– 2 problems (2 errors, 0 warnings)

npx tsc --noEmit:

main.ts(2,1): error TS2629: Cannot assign to 'c' because it is a class.
@Rudxain Rudxain added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin preset config change Proposal for an addition, removal, or general change to a preset config triage Waiting for team members to take a look labels Oct 29, 2024
@auvred
Copy link
Member

auvred commented Oct 30, 2024

This is also reproducible on playground.

@Rudxain Rudxain changed the title Configs: fix TS2629 & no-class-assign collision Configs: fix TS2629 & no-class-assign duplicate Oct 30, 2024
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Oct 30, 2024

Yeah, seems like a case of a core ESLint rule that should be disabled by the eslint-recommended config. https://github.com/typescript-eslint/typescript-eslint/blob/4af866a6642502117c32b49e64d7012a027c42f5/packages/eslint-plugin/src/configs/eslint-recommended-raw.ts

IMO this shouldn't be considered a breaking change, as nobody should have been able to violate no-class-assign given the TS2629 TS error.

@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Oct 30, 2024
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Nov 13, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin preset config change Proposal for an addition, removal, or general change to a preset config
Projects
None yet
3 participants