Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-forbid-imports

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-forbid-imports

throw errors if certain packages/directories are imported from

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
314
increased by43.38%
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-forbid-imports

CircleCI Coverage Status semantic-release Commitizen friendly npm version

throw errors if certain packages/directories are imported from

Purpose

I created this to automatically check whether client code in a webapp project accidentally imports from server code.

Installation

npm install --save-dev babel-plugin-forbid-imports

Configuration options

packages

An array of packages to forbid importing from.

Example

{
  "plugins": [
    [
      "babel-plugin-forbid-imports",
      {
        "packages": ["sequelize"]
      }
    ]
  ]
}

patterns

An array of regular expression patterns. Any imports matching one of these patterns will be forbidden. Each pattern can be a string or an array of [pattern, flags].

Example

{
  "plugins": [
    [
      "babel-plugin-forbid-imports",
      {
        "patterns": ["\\d", ["foo", "i"]]
      }
    ]
  ]
}

paths

An array of paths to files or directories (relative to the babel cwd) to forbid importing from. Subfiles and subdirectories are also forbidden.

Example

{
  "plugins": [
    [
      "babel-plugin-forbid-imports",
      {
        "paths": ["./src/server"]
      }
    ]
  ]
}

Keywords

FAQs

Package last updated on 28 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc