question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Forbid using ! in import paths

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
fsoncommented, Sep 30, 2016

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.

1reaction
SpaceK33zcommented, Sep 24, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found