# @waynestate/pinstripe 中文文档

规范地址：https://npmcn.com/package/%40waynestate/pinstripe/

版本：0\.1\.1
npm 元数据更新时间：2026-11-02T20:12:21.354Z
中文译文更新时间：2026-11-02T21:19:32.270Z
软件包许可：MIT

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40waynestate/pinstripe
原文对照：https://npmcn.com/package/%40waynestate/pinstripe/?lang=original
项目主页：https://pinstripe.apps.wayne.edu/
源码仓库：https://github.com/waynestate/pinstripe

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：18.6 kB，6 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=22\.13
- 运行依赖：8 个
- peer 依赖：eslint ^10\.0\.0，prettier ^3\.0\.0
- 首次发布：2026-10-29T02:18:19.799Z
- 最新版本发布：2026-11-02T20:12:21.158Z
- 已发布版本数：3（近 12 个月 3 个）

## 中文简介

韦恩州立应用程序栈的编码标准：共享ESLint和Vue的pretier预设。

## 安装

```sh
npm install @waynestate/pinstripe
```

也可以使用：`pnpm add @waynestate/pinstripe`、`yarn add @waynestate/pinstripe`、`bun add @waynestate/pinstripe`

## README

[![Pinstripe's front page: the headline Pinstripe, 'Sharp code. Every line.', and a swatch of green pinstripe cloth with the necktie mark sewn on and a hang tag reading Cut PER, Size level 8, Lining Larastan, Fit a11y.](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/hero.jpg)](https://npmcn.com/package/%40waynestate/pinstripe/site/index.html)

# 细条纹

![php ^8.3](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/badges/php.svg) ![phpstan level 8](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/badges/phpstan.svg) ![licence MIT](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/badges/license.svg) [![GitHub CI](https://github.com/waynestate/pinstripe/actions/workflows/ci.yml/badge.svg)](https://github.com/waynestate/pinstripe/actions/workflows/ci.yml)

**锋利的代码。每一行。**

Wayne State应用程序栈的编码标准：为Pint， PHPStan（与Laravel的Larastan）， Rector， 和ESLint与Prettier。你的应用程序指向它们，只添加自己的异常。细条纹是编码的好东西 西装就像求职面试一样：没人会注意到它，但当它不见了的时候，每个人都会注意到。

检查: `composer ci` （同样的命令在GitLab和GitHub上运行）。

开发在韦恩州立大学的GitLab进行；这个存储库是一个发布镜像。先在那里换土地。

首页: [`site/index.html`](https://npmcn.com/package/%40waynestate/pinstripe/site/index.html)这是一个静态的裁缝店，你可以在浏览器中打开或提供服务 `site/`. 在Citadel上，它由raw-PHP部署层提供 [`deploy/`](https://npmcn.com/package/%40waynestate/pinstripe/deploy/)：前端控制器服务的SQUIRE套件 `site/` 在安全帽的安全头后面。为了地方发展，继续服务 `site/` 直接。

![A yellow tape measure unrolls across a green card with seven marks, one per preset: The cut, Pint, presets per and laravel; The inseam, PHPStan, level 8; The lining, Larastan; The press, Rector, with dead code, code quality, type declarations and early return; The buttonholes, ESLint, javascript and typescript with vue and accessibility; The hem, Prettier, 100 columns, single quotes, semicolons, trailing commas; The chalk line, baseline.](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/tape.svg)

七张，一卷。每个标记都是从这个repo中的预设文件中读取的；在减少运动的情况下，胶带保持展开状态。

**试穿一下**：从 `site/` 电话宽度  

![Three phone-width crops of Pinstripe's front page: the hero with the pinstripe swatch and hang tag, the fitting where messy PHP is chalked, and the pieces with the pincushion.](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/gallery.jpg)

**样板本**：品牌板  

![Pinstripe's brand board: the necktie mark in its green and gold, the pinstripe cloth, and the type and colours it is cut from.](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/board.jpg)

## 在原始PHP应用中使用它

添加Pinstripe作为开发依赖项：

```
composer require --dev waynestate/pinstripe:^0.1
```

Pinstripe 0.1.0在Packagist上，而npm包， `@waynestate/pinstripe`，也在0.1.0。

将PHPStan指向原始配置。 `phpstan.neon`：

```neon
includes:
    - vendor/waynestate/pinstripe/phpstan/raw.neon

parameters:
    paths:
        - app
```

添加可以在所有操作系统上运行的Composer脚本：

```json
{
    "scripts": {
        "lint": "pint --test --config vendor/waynestate/pinstripe/pint/per.json",
        "fix": "pint --config vendor/waynestate/pinstripe/pint/per.json",
        "analyse": "phpstan analyse"
    }
}
```

`composer lint` 风格失败。 `composer fix` 修复它。品脱的 `per` 预设为PER编码风格，和 `tests/fixtures/per` 保持一个干净和一个凌乱的证明。 `composer analyse` 在级别8运行PHPStan，也有弃用检查。 细条纹船只 `phpstan/phpstan-deprecation-rules`，自动加载 `phpstan/extension-installer`。调用一个 `@deprecated` 方法使构建失败。 裁缝在布料退役前用旗子把旧的剪裁做好。

## 在Laravel应用中使用它

与Laravel部分相同：

```
composer require --dev waynestate/pinstripe:^0.1 larastan/larastan
```

细条纹拉进来 `phpstan/extension-installer`，为你登记拉腊斯坦。当Composer询问时，允许 插件(`config.allow-plugins` 在你的 `composer.json`）. 你的 `phpstan.neon` 包括 `vendor/waynestate/pinstripe/phpstan/laravel.neon` 再没有别的了：没有拉腊斯坦的台词可以补充，而且 脚本指向 `vendor/waynestate/pinstripe/pint/laravel.json`.

在Laravel上证明： `composer ci` 创建一个最小的Laravel 13应用程序(`tests/fixtures/laravel-app`), `pint/laravel.json` 然后用 `phpstan/laravel.neon` 每次运行，如果应用程序停止，则失败 传递。较小的固定装置(`tests/fixtures/laravel`)证明了预设确实加载了Larastan：它植入了an 只有拉腊斯坦报告的雄辩的属性，它留下了一个干净的孪生兄弟。

## 将其用于Vue

添加Pinstripe作为开发依赖项：

```
npm install --save-dev @waynestate/pinstripe eslint prettier
```

创建 `eslint.config.js` 并传播预设。打字稿:

```js
import pinstripe from '@waynestate/pinstripe/eslint/typescript'

export default [...pinstripe]
```

对于普通JavaScript，导入 `@waynestate/pinstripe/eslint/javascript` 代替。

点美化预设在 `package.json`：

```json
{
    "prettier": "@waynestate/pinstripe/prettier"
}
```

添加可以在所有操作系统上运行的脚本：

```json
{
    "scripts": {
        "lint": "eslint .",
        "format": "prettier --write ."
    }
}
```

`npm run lint` 在风格和可访问性上失败。 `npm run format` 修复布局。预设是现成的 西装：它适合所有应用程序，你只需要添加自己的袖扣。

## 把它用在雷克特身上

Rector为您的应用程序已经支持的PHP版本更新代码。将其添加为开发依赖项：

```
composer require --dev rector/rector
```

创建 `rector.php` 使用Pinstripe预设，只添加你自己的路径：

```php
<?php

$base = require __DIR__ . '/vendor/waynestate/pinstripe/rector/base.php';

return $base->withPaths([__DIR__ . '/src']);
```

预设从应用程序自己的层读取PHP层 `composer.json`，因此它不会与版本脱节 应用程序实际上是运行的。检查一下 `vendor/bin/rector process --dry-run` 然后应用于 `vendor/bin/rector process`.

经过验证的固定装置： `composer ci` 针对一个现代应用程序(`tests/fixtures/rector-clean`)和 老式的(`tests/fixtures/rector-old`)，如果干净的那个发生了变化，或者旧的那个留下了，它就会失败 独自一人。Rector是裁缝的压力机：它在不改变剪裁的情况下将旧代码平滑到标准。

## 严格的切割

新的应用程序可以包括 `vendor/waynestate/pinstripe/phpstan/strict.neon` 而不是 `raw.neon` 或者 `laravel.neon`。它能保持底部的切割并打开 `phpstan/phpstan-strict-rules`，所以松散的比较喜欢 `==` 构建失败。现有的应用程序仍然停留在基本切割和基线上。

PHPStan从3级以上检查phpdoc方法签名 `phpstan/phpstan-strict-rules` 每次运行它时，强制打开它们后面的两个开关。底座切割大头针 `reportMaybesInMethodSignatures` 和 `reportStaticMethodSignatures` 关闭，这样它就和文件一样了；严格切割使它们保持打开状态，因此它还报告可能不匹配的覆盖和静态方法覆盖。

`phpstan/phpstan-strict-rules` 每次运行时还会强制打开8个开关。每一个都是这样决定的：低噪音和真正的虫子在每个切口都保持打开状态，嘈杂的虫子被固定在基本切口中，只在底部打开 `strict.neon`.

| 参数 | Raw和Laravel切割 | 严格的削减 | 为什么 |
| --- | --- | --- | --- |
| `checkExplicitMixedMissingReturn` | 在 | 在 | 声明返回的函数 `mixed` 那能掉下来的最后是一个真正的bug，而且在实践中很少见。 |
| `checkFunctionNameCase` | 在 | 在 | 大小写错误的函数名在Windows和macOS上有效，在Linux上失效。 |
| `checkInternalClassCaseSensitivity` | 在 | 在 | PHP自己的类也有同样的问题。 |
| `checkStrictPrintfPlaceholderTypes` | 在 | 在 | `%d` 输入字符串是一个真正的格式化错误，而且很少见。 |
| `checkDynamicProperties` | 从 | 在 | 用未声明的属性填充遗留代码。 |
| `reportMaybesInPropertyPhpDocTypes` | 从 | 在 | 报告“可能”phpdoc不匹配，遗留docblocks不断出错。 |
| `reportWrongPhpDocTypeInVarTag` | 从 | 在 | 老 `@var` 标签经常松动；修复它们是清理，而不是寻找bug。 |
| `reportNonIntStringArrayKey` | 从 | 在 | 在松散键控数组上有噪声的漏边检查。 |

严格是裁缝在第一针之前画的粉笔线。

## 采用现有的应用程序

生成一个基线 `phpstan analyse --generate-baseline`，包括在你的 `phpstan.neon`直到永远 缩小它。新代码没有基线。基线是裁缝的粉笔线：它标记了织物的现状，以及每一个 释放，让它进来，永远不要让它出来。

## 基线只会收缩

细条纹船只 `pinstripe-baseline`一个PHP命令可以在每个操作系统上运行，以实现这一承诺。两者都读 NEON基线和PHP格式(`phpstan-baseline.php`）。

```
vendor/bin/pinstripe-baseline count phpstan-baseline.neon
```

打印基线忽略的错误数：每个条目的错误数之和 `count`， 1当 `count` 不在。

```
vendor/bin/pinstripe-baseline check --max=42 phpstan-baseline.neon
```

退出1，带 `baseline grew: N errors, the most allowed is M` 当计数超过限制时，否则为0。来 与目标分支进行比较，而不是一个固定的数字，传递一个git ref：

```
vendor/bin/pinstripe-baseline check --against=origin/main phpstan-baseline.neon
```

在GitLab CI中，合并请求的基础SHA已经在环境中了：

```
vendor/bin/pinstripe-baseline check --against=$CI_MERGE_REQUEST_DIFF_BASE_SHA phpstan-baseline.neon
```

基线是裁缝的粉笔线，而这个命令是卷尺：它在线的瞬间失效 变长。

## 测试了

维护者：如何构建、测试和发布这个项目，以及它的数据来自哪里 [MAINTAINING.md](https://npmcn.com/package/%40waynestate/pinstripe/MAINTAINING.md).

-   品脱1.32.1
-   PHPStan 2.3.3
-   PHPStan extension-installer 1.4.3
-   PHPStan strict-rules 2.1.0
-   Larastan 3.13.2
-   校长2.8.1发布
-   ESLint 10.13.0
-   漂亮3.9.10
-   eslint-plugin-vue 10.12.0
-   eslint-plugin-vuejs-accessibility 2.6.3
-   typescript-eslint 8.72.1
-   Node 22.13或更新版本

## 接下来

飞行前的工作，并读取PHP地板从信条。

## 演员

[![WayneUI](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/wayneui.png)](https://github.com/waynestate/wayne-ui "WayneUI") [![CREED](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/creed.png)](https://github.com/waynestate/creed "CREED") [![PROCTOR](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/proctor.png)](https://github.com/waynestate/proctor "PROCTOR") [![SESAME](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/sesame.png)](https://github.com/waynestate/sesame "SESAME") [![HELMET](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/helmet.png)](https://github.com/waynestate/helmet "HELMET") [![Sourdough](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/sourdough.png)](https://github.com/waynestate/sourdough "Sourdough") [![SQUIRE](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/squire.png)](https://github.com/waynestate/squire "SQUIRE") [![PREFLIGHT](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/preflight.png)](https://github.com/waynestate/preflight "PREFLIGHT") [![Pinstripe](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/pinstripe.png)](https://github.com/waynestate/pinstripe "Pinstripe") [![BOOSTER](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/booster.png)](https://github.com/waynestate/booster "BOOSTER") [![ROLLCALL](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/rollcall.png)](https://github.com/waynestate/rollcall "ROLLCALL") [![DRAWBRIDGE](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/drawbridge.png)](https://github.com/waynestate/drawbridge "DRAWBRIDGE") [![ADVISOR](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/advisor.png)](https://github.com/waynestate/advisor "ADVISOR") [![WELD](https://npmcn.com/package/%40waynestate/pinstripe/docs/readme/cast/weld.png)](https://github.com/waynestate/weld "WELD")

十四部，一间试衣间。README艺术是从首页剪下来的 [`scripts/readme-art`](https://npmcn.com/package/%40waynestate/pinstripe/scripts/readme-art/README.md)； 衣服没有损坏，而且每条边都是先别好的。

## 常见问题

### @waynestate/pinstripe 是什么？

韦恩州立应用程序栈的编码标准：共享ESLint和Vue的pretier预设。

### 如何安装 @waynestate/pinstripe？

在项目目录运行 npm install @waynestate/pinstripe，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：eslint（^10\.0\.0）、prettier（^3\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @waynestate/pinstripe 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/waynestate\_\_pinstripe 是否存在。

### @waynestate/pinstripe 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @waynestate/pinstripe 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22\.13。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @waynestate/pinstripe 可以商用吗？

@waynestate/pinstripe 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @waynestate/pinstripe 还在维护吗？

最新版本 0\.1\.1 发布于 2026/11/03（今天）；至今共发布 3 个版本，其中过去 12 个月发布了 3 个；首次发布于 2026/10/29。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

