# babel-plugin-disallow-unsafe-global-references-and-module-importing

> Experimental babel plugin used to check unsafe global references and unsafe module importing

Latest version **1.0.4** (published 2021-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-disallow-unsafe-global-references-and-module-importing
pnpm add babel-plugin-disallow-unsafe-global-references-and-module-importing
yarn add babel-plugin-disallow-unsafe-global-references-and-module-importing
bun add babel-plugin-disallow-unsafe-global-references-and-module-importing
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-11-07 |
| First published | 2021-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 51.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Huan |
| Maintainers | ngquhuanbl |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-disallow-unsafe-global-references-and-module-importing
- Repository: https://github.com/ngquhuanbl/babel-plugin-disallow-unsafe-global-references-and-module-importing
- npm.io page: https://npm.io/package/babel-plugin-disallow-unsafe-global-references-and-module-importing

## Recent versions

- 1.0.4 (latest) — 2021-11-07
- 1.0.3 — 2021-11-06
- 1.0.1 — 2021-11-06
- 1.0.0 — 2021-11-06

## README

<div align="center">
<h1>babel-plugin-disallow-unsafe-global-references-and-module-importing 🧪</h1>
<p>Allows you to check if your code contains unsafe global references and unsafe module importing</p>
</div>

---

## Rule
1. **THE GLOBAL IDENTIFIER BLACKLIST**:<br>(All references to the below identifiers will be disallowed)
    - `window`, `global`, `globalThis`
    - `eval`, `Function`
    - `localStorage`, `sessionStorage`, `indexedDB`
    - `document.cookie`
    - `require` (CommonJS)
    - Additional identifiers defined in plugin options: `globalIndentifierBlacklist`
2. **THE MODULE SOURCE WHITELIST**:<br>(Only the below module sources are allowed to be imported)
    - Modules of the `zalo` category<br>E.g. `import foo from 'zalo/foo'`
    - All local module sources
    - Additional module sources defined in plugin options: `moduleSourceWhitelist`
## Options
### `{ globalIndentifierBlacklist: ['foo'] }`
- Data type: `Array<string>`
- Usage: Specify additional items for the  **THE GLOBAL IDENTIFIER BLACKLIST**
- Note: Subjects must be global-scoped objects.
### `{ moduleSourceWhitelist: ['bar'] }`
- Data type: `Array<string>`
- Usage: Specify additional items for the **THE MODULE SOURCE WHITELIST**
- Note:
  - All local modules is whitelisted by default. So there's no need to specify them here.
  - Each module is treated as a module category, hence all sub-categories will be whitelisted as a result.<br>E.g. Category: `'lodash'` -> Sub-categories: `'lodash/foo'`, `'lodash/bar'`, etc.

---
_Source: https://npm.io/package/babel-plugin-disallow-unsafe-global-references-and-module-importing · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
