@4th-motion/stylelint-config 中文文档教程

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

@4th-motion/stylelint-config

一个易于设置的 stylelint 配置,可以在您的项目之间共享。

版本 License

使用此配置,您可以确保团队中的所有开发人员都遵守编码scsslesscss 文件的标准。 可以随时进行更改 - 旧配置会自动覆盖,因为只有一个真实来源。


Terminal


Installation

将此包作为 devDependency 添加到您的项目:

yarn add --dev @4th-motion/stylelint-config

您可以选择添加 @4th-motion/git-hooks 如果你想在提交时自动检查:

yarn add --dev @4th-motion/git-hooks


Usage

一旦@4th-motion/stylelint-config 包已安装,您可以启动它:

yarn 4th-stylelint-init

请注意,任何可选的东西(例如 git-hooks)必须在之前出现这个脚本被执行。 如果您需要再次运行配置,可以使用标志 --force 再次运行配置过程并覆盖所有设置。


Behind the scenes

初始化过程扩展了 package.json 文件如下:

{
  "scripts": {
    "lint:scss": "4th-stylelint . --color --fix"
  },
  "stylelint": {
    "extends": [
      "@4th-motion/stylelint-config"
    ]
  }
}

如果你有 @4th-motion/git-hooks 作为作为 devDependency,package.json 文件将进一步扩展:

{
  "scripts": {
    "lint:scss:staged": "git diff --diff-filter=ACMRT --cached --name-only '*.scss' | xargs 4th-stylelint"
  },
  "git": {
    "pre-commit": "lint:scss:staged"
  }
}


Customize to your needs

您可以根据需要编辑定义编码标准的文件。 您还可以将此项目重命名为 @company/stylelint-config 以使其适合您的合作伙伴。 要更改初始化进程的名称,您必须修改 package.json 文件中 bin 中的字段,如下所示:

{
  "bin": {
    "company-stylelint": "./bin/stylelint.sh",
    "company-stylelint-init": "./init.js"
  },
}


Further documents


Related projects

@4th-motion/git-hooks@4th-motion/eslint-config
@4th-motion/git-hooks@4th-motion/eslint-config


License

Copyright © 2020 年,4th motion GmbH。 根据 MIT 许可 发布。

@4th-motion/stylelint-config

An easy to set up stylelint configuration that can be shared between your projects.

Version License

With this configuration, you can ensure that all developers on your team adhere to the coding standards for scss, less and css files. Changes can be made at any time - old configurations are automatically overwritten, since there is only one source of truth.


Terminal


Installation

Add this package as a devDependency to your project:

yarn add --dev @4th-motion/stylelint-config

Optionally you can add @4th-motion/git-hooks if you want to auto-lint upon committing:

yarn add --dev @4th-motion/git-hooks


Usage

Once the @4th-motion/stylelint-config package is installed, you can initiate it with:

yarn 4th-stylelint-init

Note that any optional stuff (e.g. git-hooks) must be present before this script is executed. In case you need to run the configuration again, you can use the flag --force to run the configuration process again and overwrite all settings.


Behind the scenes

The initialization process extends the package.json file as follows:

{
  "scripts": {
    "lint:scss": "4th-stylelint . --color --fix"
  },
  "stylelint": {
    "extends": [
      "@4th-motion/stylelint-config"
    ]
  }
}

If you have @4th-motion/git-hooks as a devDependency, the package.json file will be extended even further:

{
  "scripts": {
    "lint:scss:staged": "git diff --diff-filter=ACMRT --cached --name-only '*.scss' | xargs 4th-stylelint"
  },
  "git": {
    "pre-commit": "lint:scss:staged"
  }
}


Customize to your needs

You can edit the files that define the coding standards as needed. You can also rename this project to @company/stylelint-config to tailor it to your cooporate. To change the name of the initialization process, you must modify the fields within bin in the package.json file as follows:

{
  "bin": {
    "company-stylelint": "./bin/stylelint.sh",
    "company-stylelint-init": "./init.js"
  },
}


Further documents


Related projects

@4th-motion/git-hooks@4th-motion/eslint-config
@4th-motion/git-hooks@4th-motion/eslint-config


License

Copyright © 2020 by 4th motion GmbH. Released under the MIT License.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文