# @magijs/plugin-constraint

> ## 开启、禁用和检查状态

Latest version **0.0.2** (published 2024-12-24) · 0 weekly downloads

## Install

```sh
npm install @magijs/plugin-constraint
pnpm add @magijs/plugin-constraint
yarn add @magijs/plugin-constraint
bun add @magijs/plugin-constraint
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2024-12-24 |
| First published | 2022-06-28 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 283.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | linji, w431106 |

## Links

- npm: https://www.npmjs.com/package/@magijs/plugin-constraint
- npm.io page: https://npm.io/package/@magijs/plugin-constraint

## Dependencies (1)

- [@magijs/compiled](https://npm.io/package/@magijs/compiled.md) 0.0.2

## Recent versions

- 0.0.2 (latest) — 2024-12-24
- 0.0.1 — 2024-05-16
- 0.0.1-alpha.49 — 2024-05-06
- 0.0.1-alpha.47 — 2022-11-23
- 0.0.1-alpha.46 — 2022-11-22
- 0.0.1-alpha.43 — 2022-11-16
- 0.0.1-alpha.44 — 2022-11-16
- 0.0.1-alpha.42 — 2022-11-03
- 0.0.1-alpha.41 — 2022-09-22
- 0.0.1-alpha.40 — 2022-09-21
- 0.0.1-alpha.39 — 2022-09-20
- 0.0.1-alpha.38 — 2022-09-07
- 0.0.1-alpha.35 — 2022-09-05
- 0.0.1-alpha.34 — 2022-08-31
- 0.0.1-alpha.33 — 2022-08-25
- … 18 more at https://npm.io/package/@magijs/plugin-constraint/versions

## README

# 强约束规则

## 开启、禁用和检查状态

### 开启强约束

```js
export default {
    strict: {},
};
```

### 启用额外规则

所有规则是默认开启的，但以下规则除外

    FILES_ALL_TYPESCRIPT

如有需要，可通过 strict.rules 开启

```js
export default defineConfig({
    strict: {
        rules: {
            FILES_ALL_TYPESCRIPT: true,
        },
    },
});
```

### 规则禁用

原则上不允许禁用规则

### 检查开启禁用状态

执行 magi constraint 命令

## 规则列表

### DEP_MAGI_LATEST

magi 版本不允许写死，只能使用 ^ 前缀。

```
// bad
"@magi/magi": "1.0.0"
// still bad
"@magi/magi": "~1.0.0"

// good
"@magi/magi": "^1.0.0"
```

如果出于某些原因使用了 beta 版，也需使用 ^ 前缀保证正式版发布后能自动匹配到。

```
// bad
"@magi/magi": "1.0.0-beta.1"

// good
"@magi/magi": "^1.0.0-beta.1"
"@magi/magi": "^1.0.0-0"
```

---
_Source: https://npm.io/package/@magijs/plugin-constraint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
