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

Enforce js file extension in imports #407

Open
zepumph opened this issue Nov 8, 2024 · 4 comments
Open

Enforce js file extension in imports #407

zepumph opened this issue Nov 8, 2024 · 4 comments
Assignees

Comments

@zepumph
Copy link
Member

zepumph commented Nov 8, 2024

From phetsims/chipper#1498. There is a plugin that we can add a lint rule for:

Two options:
https://github.com/import-js/eslint-plugin-import/blob/67cc79841fc823ad4af2532af2dc6704e4b3b03a/docs/rules/extensions.md
https://github.com/solana-labs/eslint-plugin-require-extensions

@samreid, what do you think?

@samreid
Copy link
Member

samreid commented Nov 8, 2024

Is the existing bad-text lint rule insufficient? Do we need something with --fix?

image

@samreid samreid assigned zepumph and unassigned samreid Nov 8, 2024
zepumph added a commit to phetsims/phet-lib that referenced this issue Nov 8, 2024
zepumph added a commit that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/quake that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/faradays-law that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/optics-lab that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/skiffle that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/greenhouse-effect that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/chipper that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/aqua that referenced this issue Nov 8, 2024
zepumph added a commit to phetsims/binder that referenced this issue Nov 8, 2024
@zepumph
Copy link
Member Author

zepumph commented Nov 8, 2024

I experimented with that, but it is a pretty naiive test, as it doesn't support a case like import winston from 'winston';.

I updated it and moved it to the base bad-text rule, but we may still want to swap things out to use a plugin if we find another corner case or two in the future.

@chrisklus
Copy link
Contributor

There's a few website imports getting caught by this, but it's unclear to me why all imports that don't have a suffix are not breaking, see https://github.com/phetsims/website-meteor/issues/813. Any ideas?

@zepumph
Copy link
Member Author

zepumph commented Nov 13, 2024

Well that isn't ideal! I think the best thing for now is to turn off this error until we can implement the plugin directly as an actual solution.

zepumph added a commit that referenced this issue Nov 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

No branches or pull requests

3 participants