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

Error: '<variable>' is assigned to itself #454

Closed
2 tasks done
probablykasper opened this issue Apr 28, 2023 · 2 comments · Fixed by #455 or #461
Closed
2 tasks done

Error: '<variable>' is assigned to itself #454

probablykasper opened this issue Apr 28, 2023 · 2 comments · Fixed by #455 or #461

Comments

@probablykasper
Copy link

probablykasper commented Apr 28, 2023

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.39.0

What version of eslint-plugin-svelte are you using?

2.27.1

What did you do?

Configuration
module.exports = {
	root: true,
	extends: [
		'eslint:recommended',
		'plugin:@typescript-eslint/recommended',
		'plugin:svelte/recommended',
		'prettier'
	],
	parser: '@typescript-eslint/parser',
	plugins: ['@typescript-eslint'],
	ignorePatterns: ['*.cjs'],
	parserOptions: {
		sourceType: 'module',
		ecmaVersion: 2020,
		extraFileExtensions: ['.svelte']
	},
	env: {
		browser: true,
		es2017: true,
		node: true
	},
	overrides: [
		{
			files: ['*.svelte'],
			parser: 'svelte-eslint-parser',
			parserOptions: {
				parser: '@typescript-eslint/parser'
			}
		}
	]
};
  1. npm create svelte@latest
  2. Put the following in src/routes/+page.svelte
<script lang="ts">
	let x = new Date();
	setTimeout(() => {
		x.setFullYear(2020);
		x = x;
	}, 1000);
</script>

What did you expect to happen?

Expected no error because self-assignments are used in Svelte to trigger updates

What actually happened?

ESLint emits this error when using the default config provided with npm create svelte@latest:

  5:9  error  'x' is assigned to itself  no-self-assign

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/probablykasper/eslint-svelte-self-assign-bug

Additional comments

No response

@brunocontreras
Copy link

This issue was resolved in PR #455 but was rolled back in release #457 by the bot

@ota-meshi
Copy link
Member

thanks for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants