Forbid using ! in import paths
See original GitHub issueI’ve heard a few reports that people use Webpack import extension syntax (like !!file!./stuff
) to customize Create React App loaders. We don’t support this officially, and we may accidentally (or on purpose) break this in the future. This also couples apps to Webpack resolution mechanism too hard.
We need to write a Webpack plugin that throws in parsing stage (https://github.com/webpack/docs/wiki/plugins#the-parser-instance-compilerparser) if you attempt to require or import something with !
in the path.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Is it possible to forbid import from path in eslint except one ...
You can achieve this with the eslint rule no-restricted-imports : https://eslint.org/docs/rules/no-restricted-imports.
Read more >eslint-plugin-import/no-restricted-paths.md at main - GitHub
ESLint plugin with rules that help validate proper imports. ... restricted zones where you can forbid files from imported if they match a...
Read more >no-restricted-imports - ESLint - Pluggable JavaScript Linter
This rule allows you to specify imports that you don't want to use in your application. It applies to static imports only, not...
Read more >import-blacklist - Rule
Disallows importing the specified modules via import and require , or importing specific named exports of the specified modules, or using imports matching ......
Read more >5. The import system — Python 3.11.1 documentation
path for a top level package) changes. With namespace packages, there is no parent/__init__.py file. In fact, there may be multiple parent ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
eslint-plugin-import 2.0.0 was released yesterday with this new rule. I’m making a pull request to add it in our config today.
Maybe it would be an idea to write / use an ESLint plugin for this then? eslint-plugin-import would be a good place for that.