Skip to content

fix: add eslintrc files for check code convention #9104

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
wants to merge 2 commits into from

Conversation

Artxe2
Copy link
Contributor

@Artxe2 Artxe2 commented Aug 13, 2023

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

1. Added eslintrc file to check snake_case.
ex) "$$" | "abc_abc", "__abc_abc", "$$abc_abc", "abc123", "abc_123" | "ABC_ABC", "ABC123", "ABC_123" | "AbcAbc", "Abc123", "Abc_123"
but the test folder was excluded because there were too many errors.

2. I modified the code according to the added eslint rule.
for public variable names, camelCase was applied using export as keyword or eslint-disable comment.

I'm not sure if this amounts to a large changes.


This PR has been force pushed,
including modifications to the regular expression in id-match and any additional changes that result from it.

check snake_case rule

  1. $$
  2. lower_snake_case that starts with a 0-2 letter _ or $
  3. UPPER_SNAKE_CASE
  4. PascalCase
  5. Numbers can start with the second letter of each word. ex) a11y_required_attributes
  6. It is possible to add a number with a hyphen at the end. ex) snake_case_123, PascalCase_123

@changeset-bot
Copy link

changeset-bot bot commented Aug 13, 2023

⚠️ No Changeset found

Latest commit: 5701e8a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

import path from 'path';
import glob from 'tiny-glob/sync.js';
import {
mkdirSync as mkdir_sync,
Copy link
Member

Choose a reason for hiding this comment

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

we don't have a convention of aliasing external packages to snake_case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I understand.
If svelte 5 accepts the eslint rule,
You can use the eslint-disable-next-line id-match comment here.

Copy link
Member

Choose a reason for hiding this comment

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

I appreciate that this rule found a lot of places that should be updated. However, I think it's just going to end up being too annoying to do eslint disable wherever we're calling an external package and think we probably can't accept this PR as a result. I really appreciate the effort you put into it. I think we could accept the fixes you identified if they were split out separately from the lint rule itself - though it might be better to wait until Svelte 5 for that as we're going to be throwing away all the existing compiler code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the thorough review.
The changes were intended for validating the effectiveness of the rule, and I believe applying them in the current version wouldn't bring significant benefits.

@@ -10,11 +10,11 @@ export {
SvelteComponentTyped
} from './index.js';

/** @returns {void} */
Copy link
Member

Choose a reason for hiding this comment

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

i'm not sure why these comments were removed

Copy link
Contributor Author

@Artxe2 Artxe2 Aug 27, 2023

Choose a reason for hiding this comment

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

The return void is deduced automatically,
and I removed it because other parts of the code didn't add these type comments, but if it was a change to specify that nothing should be returned,
this change is should be roll back.

@benmccann
Copy link
Member

thank you for this. it's a very interesting idea. unfortunately I don't think we can move forward for the reasons mentioned above: #9104 (comment)

@benmccann benmccann closed this Aug 28, 2023
@Artxe2 Artxe2 deleted the fix-eslint-rule branch September 14, 2023 12:21
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.

2 participants