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: Add file extensions to all imports #1910

Merged
merged 5 commits into from
Apr 4, 2023
Merged

Conversation

Pezmc
Copy link
Contributor

@Pezmc Pezmc commented Apr 4, 2023

Description

See discussion in #1908.

Skipping file extensions is a web pack feature that's scheduled to be removed from standard ES modules.

In the new ES modules proposal file extensions are mandatory in import statements.
Being explicit, also enables better static code analysis, performed by tools like VSCode and ESLint

This PR:

  • Adds extensions to all imports (not requires)
  • Enables an ESLint rule (with autofix) to require file extensions
  • Configures ESLint to require all files to resolve

Related Issue(s)

#1908

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on flowforge/helm to update ConfigMap Template
    • Issue/PR raised on flowforge/CloudProject to update values for Staging/Production

Labels

  • Backport needed? -> add the backport label
  • Includes a DB migration? -> add the area:migration label

@Pezmc Pezmc requested a review from Steve-Mcl April 4, 2023 03:13
@Pezmc Pezmc force-pushed the chore-require-file-extensions branch from aacfb7c to b1b1fca Compare April 4, 2023 03:14
@Steve-Mcl
Copy link
Contributor

@Pezmc do you have 2 mins to discuss this PR please?

@@ -417,160 +393,6 @@
"frontend/src/components/icons/nodered-hex.svg"
]
},
{
Copy link
Contributor Author

@Pezmc Pezmc Apr 4, 2023

Choose a reason for hiding this comment

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

Tidy up bad eslint config! These lines are turning off the null rule, which wasn't doing anything.

Copy link
Contributor

@Steve-Mcl Steve-Mcl left a comment

Choose a reason for hiding this comment

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

Following a review of the changes and a quick chat with @Pezmc I am personally very happy happy to see this work merged.

Base automatically changed from chore-rewrite-imports to main April 4, 2023 07:52
@Pezmc Pezmc merged commit 3edfe27 into main Apr 4, 2023
@Pezmc Pezmc deleted the chore-require-file-extensions branch April 4, 2023 07:53
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.

None yet

2 participants