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

chore(codestyle): fixup codebase to more-modern practices #1087

Closed
wants to merge 4 commits into from

Conversation

DAcodedBEAT
Copy link
Contributor

@DAcodedBEAT DAcodedBEAT commented Dec 6, 2024

Most prominent changes:

  1. Prefer const over let

    • Signals intent: the variable won’t be reassigned.
    • Improves code clarity and reduces bugs.
  2. Use node:* for Node.js imports

    • Clearly indicates built-in modules.
    • Avoids naming conflicts and aligns with modern standards.
  3. Use import type for importing types

    • Ensures no runtime code is imported.
    • Reduces bundle size and improves clarity.
  4. Prefer arrow functions

    • Cleaner syntax and auto-binds this.
    • Reduces boilerplate and common errors.
  5. Break up long lines

    • Easier to read and understand.
    • Simplifies maintenance and debugging.

Summary

These changes enhance readability, clarity, and alignment with modern best practices, making the codebase cleaner and less error-prone.

@vassbo
Copy link
Collaborator

vassbo commented Dec 6, 2024

  • Test failed as install does not work.
  • Also prettier should be updated if semicolons are a standard
  • I don't see the reason for node: ?
  • Also most IDE's split large lines into multiple more readable lines

@vassbo vassbo closed this Dec 6, 2024
@vassbo
Copy link
Collaborator

vassbo commented Dec 6, 2024

Actually looks like it failed because NDI 6.1 was just released yesterday.

@DAcodedBEAT
Copy link
Contributor Author

@vassbo

  • correct, the tests failing seem to be related to NDI and not the javascript changes itself
  • I can remove the semicolons if you prefer that
  • the node:* prefix for builtin modules helps optimize the import and prevent potential typosquatting attacks (accidentally installing a name which collides with a builtin and using the wrong module)
  • sure, but not everyone uses an IDE - I'm thinking of the code review process but there might be others which use standard text editors.

@vassbo
Copy link
Collaborator

vassbo commented Dec 10, 2024

Okay, I think we should keep the semicolons disabled for now as that is how the code has been for now, and I'll try to merge it afterwards, but it seems like this prettier config is ignored as semi is disabled here:

    "prettier": {
        "trailingComma": "es5",
        "printWidth": 250,
        "tabWidth": 4,
        "semi": false,
        "singleQuote": false
    }

@vassbo vassbo reopened this Dec 10, 2024
@vassbo vassbo deleted the branch ChurchApps:dev December 13, 2024 12:32
@vassbo vassbo closed this Dec 13, 2024
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