@1024pix/stylelint-config-rational-order

中文文档
0.1.3发布于 2024/03/25Apache-2.0CommonJS近 30 天下载 5713

Stylelint config that sorts related property declarations by grouping together following the order: Positioning, Box Model, Typography, Visual, Animation, Other.

原始使用文档
文档目录4 节
  1. Usage
  2. Optional options / rules
  3. FAQ
  4. Credits

stylelint-config-rational-order

NPM version NPM downloads Build status License

Stylelint config that sorts related property declarations by grouping together following the order:

  1. Positioning
  2. Box Model
  3. Typography
  4. Visual
  5. Animation
  6. Misc
.declaration-order {
  /* Positioning */
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;

  /* Box Model */
  display: block;
  float: right;
  width: 100px;
  height: 100px;
  margin: 10px;
  padding: 10px;

  /* Typography */
  color: #888;
  font: normal 16px Helvetica, sans-serif;
  line-height: 1.3;
  text-align: center;

  /* Visual */
  background-color: #eee;
  border: 1px solid #888;
  border-radius: 4px;
  opacity: 1;

  /* Animation */
  transition: all 1s;

  /* Misc */
  user-select: none;
}

Usage

  1. Add stylelint, stylelint-order and this package to your project:
npm install --save-dev stylelint stylelint-order stylelint-config-rational-order
# or, if you prefer yarn over npm:
yarn add --dev stylelint stylelint-order stylelint-config-rational-order
  1. Add this package to the end of your extends array inside Stylelint configuration (.stylelintrc for example):
{
  "extends": [
    // "stylelint-config-standard",
    "stylelint-config-rational-order"
  ]
}

This shareable config contains the following:

{
  "plugins": [
    "stylelint-order",
    "stylelint-config-rational-order/plugin"
  ],
  "rules": {
    "order/properties-order": [],
    "plugin/rational-order": [true, {
      "border-in-box-model": false,
      "empty-line-between-groups": false,
    }]
  }
}

Since it adds stylelint-order and stylelint-config-rational-order to plugins and also adds required rules, you don't have to do this yourself when extending this config.

Optional options / rules

border-in-box-model

Defines to which group the border property belongs to.

If true border property belongs to the box model section. The default value is false (border property belongs to the visual section).

empty-line-between-groups

If true adds an empty line between groups. The default value is false.

FAQ

Why should I use the rational order and group and sort CSS properties by type instead of alphabetical order?

The pros and cons of both ways in detail:

Credits

版本与发布记录

@1024pix/stylelint-config-rational-order 共发布 2 个版本,首次发布于 2023/09/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.3latest2024/03/252 年前
0.1.22023/09/253 年前

关于 @1024pix/stylelint-config-rational-order 的常见问题

@1024pix/stylelint-config-rational-order 是什么?

Stylelint config that sorts related property declarations by grouping together following the order: Positioning, Box Model, Typography, Visual, Animation, Other.

如何安装 @1024pix/stylelint-config-rational-order?

在项目目录运行 npm install @1024pix/stylelint-config-rational-order,或使用 pnpm add / yarn add / bun add。

@1024pix/stylelint-config-rational-order 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/1024pix__stylelint-config-rational-order 是否存在。

@1024pix/stylelint-config-rational-order 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@1024pix/stylelint-config-rational-order 可以商用吗?

@1024pix/stylelint-config-rational-order 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@1024pix/stylelint-config-rational-order 的下载量有多少?

根据 npm 官方下载统计,@1024pix/stylelint-config-rational-order 在 2026/10/04 – 2026/11/02 这 30 天内被下载 5,713 次,日均约 190 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@1024pix/stylelint-config-rational-order 还在维护吗?

最新版本 0.1.3 发布于 2024/03/25(2 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/09/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。