@1password/front-end-style 中文文档教程

发布于 3年前 浏览 29 项目主页 更新于 3年前

1Password Front-End Style

此软件包包含使用 Prettier、ESLint 和 Stylelint 的 1Password 前端代码样式的配置。

Usage

安装后,您需要配置您的项目以使用这些样式:

Prettier

添加到您的 package.json 文件:

"prettier": "@1password/front-end-style/prettierrc.json"

ESLint

创建一个 eslintrc.yml 文件:

---
extends:
  - "@1password/front-end-style/eslintrc.yml"

Stylelint

添加到您的 package.json 文件:

"stylelint": {
    "extends": "@1password/front-end-style/stylelintrc.yml"
}

SVG Lint

还包含一个基本的 SVG linting 工具,用于检查不必要的换行符和标签。

使用 svglint [directory] 运行

IDE Extensions

您还应该安装相关的 IDE 扩展,这样您就可以在编写代码时发现问题(有时会自动修复)。

  • Prettier

    • https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
    • https://atom.io/packages/prettier-atom
  • ESLint

    • https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
    • https://atom.io/packages/eslint
  • Stylelint

    • https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
    • https://atom.io/packages/linter-stylelint

Versioning Expectations

我们将在更新包版本号时使用语义版本控制。 以下用于区分版本标识符。

格式:major.minor.patch

  • major:任何breaking更改

    • Example:
      • Adding a package with new rules
      • Upgrading errors (warn to error)
      • major version bump of any NPM dependencies in package.json
  • 次要:影响包功能的任何非破坏性更改

    • Example:
      • Downgrading errors (error to warn)
      • minor version bump of any NPM dependencies in package.json, but no major version bump
  • 补丁:任何影响包功能的更改

    • Example:
      • Changing code comments
      • Changing the error message of a custom rule
      • Only patch version bumps of NPM dependencies in package.json
      • Updating yarn.lock

1Password Front-End Style

This package contains config for 1Password front-end code style using Prettier, ESLint, and Stylelint.

Usage

After installing, you'll need to configure your project to use these styles:

Prettier

Add to your package.json file:

"prettier": "@1password/front-end-style/prettierrc.json"

ESLint

Create an eslintrc.yml file:

---
extends:
  - "@1password/front-end-style/eslintrc.yml"

Stylelint

Add to your package.json file:

"stylelint": {
    "extends": "@1password/front-end-style/stylelintrc.yml"
}

SVG Lint

A basic SVG linting tool is included as well, which checks for unnecessary line breaks and tags.

Run with svglint [directory]

IDE Extensions

You should also install the related IDE extensions so you can see issues (and sometimes get them auto-fixed) as you code.

  • Prettier

    • https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
    • https://atom.io/packages/prettier-atom
  • ESLint

    • https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
    • https://atom.io/packages/eslint
  • Stylelint

    • https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
    • https://atom.io/packages/linter-stylelint

Versioning Expectations

We'll be using semantic versioning when updating the package version number. The following is used to differentiate between the version identifiers.

Format: major.minor.patch

  • major: Any breaking change

    • Example:
      • Adding a package with new rules
      • Upgrading errors (warn to error)
      • major version bump of any NPM dependencies in package.json
  • minor: Any non-breaking change affecting the functionality of the package

    • Example:
      • Downgrading errors (error to warn)
      • minor version bump of any NPM dependencies in package.json, but no major version bump
  • patch: Any change not affecting the functionality of the package

    • Example:
      • Changing code comments
      • Changing the error message of a custom rule
      • Only patch version bumps of NPM dependencies in package.json
      • Updating yarn.lock
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文