Skip to content

Rule: 'no-sample-code' with --fix mapped to remove it #42

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

saberzero1
Copy link
Contributor

closes #11

Checks for these:

this.registerInterval(window.setInterval(() => console.log('setInterval'), 5 * 60 * 1000));
this.registerDomEvent(document, 'click', (evt: MouseEvent) => {
	console.log('click', evt);
});

Also has a fixable flag, which means running ESLint with --fix will remove both snippets automatically.

@saberzero1 saberzero1 marked this pull request as ready for review June 9, 2025 08:08
@claremacrae
Copy link

I don’t know what the intended boundaries of #11 are - but just to note that I have seen PR feedback tell plugin authors to rename things like classes that come from the sample plugin too.

Perhaps that is a separate PR.

@saberzero1
Copy link
Contributor Author

I don’t know what the intended boundaries of #11 are - but just to note that I have seen PR feedback tell plugin authors to rename things like classes that come from the sample plugin too.

Perhaps that is a separate PR.

Yeah, I wondered that too. When I asked Joethei on Discord, he indicated that the two snippets this rule targets are very frequent remarks in code reviews, and should therefore be addressed. I suspect that this rule will be expanded in the future as Joethei reports frequent sample code snippets to address.

@joethei
Copy link
Collaborator

joethei commented Jun 12, 2025

There is a rule for the sample names already

@saberzero1
Copy link
Contributor Author

There is a rule for the sample names already

Great.

Do you want me to add any other sample code checks to this PR?

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.

Rule: Remove sample code that's not used
3 participants