Socket
Socket
Sign inDemoInstall

babel-plugin-forbid-imports

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-forbid-imports

throw errors if certain packages/directories are imported from


Version published
Weekly downloads
85
decreased by-71.19%
Maintainers
1
Install size
354 kB
Created
Weekly downloads
 

Readme

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

Last updated on 28 Jan 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc