Skip to content

Commit

Permalink
1. 添加对style order自动排序功能;
Browse files Browse the repository at this point in the history
  • Loading branch information
benyasin authored and benyasin committed Jul 22, 2021
1 parent 944a84b commit aa4fe23
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 24 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ For a complete usage example, please refer to this [react-snowpack](https://gith

# Changelog

1.0.13

* add supports for style order auto fixing

1.0.12

* fix stylelint some default rules
Expand Down
4 changes: 4 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ module.exports = {

# 更新日志

1.0.13

* 添加对样式排序自动修正的功能

1.0.12

* 修正stylelint一些默认规则
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-specification-unid",
"version": "1.0.12",
"version": "1.0.13",
"description": "A collection of configuration files containing prettier, eslint, stylelint, husky, lint-staged, commitlint",
"keywords": [
"eslint",
Expand Down Expand Up @@ -72,7 +72,7 @@
"stylelint-config-standard": "^20.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.1.0",
"stylelint-no-unsupported-browser-features": "^4.1.4",
"stylelint-order": "^4.0.0",
"stylelint-order": "^4.1.0",
"stylelint-prettier": "^1.1.2",
"stylelint-scss": "^3.19.0",
"typescript": "^4.0.2"
Expand Down
52 changes: 35 additions & 17 deletions src/stylelint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,26 @@ module.exports = {
'stylelint-no-unsupported-browser-features',
'stylelint-prettier/recommended',
],
plugins: ['stylelint-order', "stylelint-scss", 'stylelint-declaration-block-no-ignored-properties'],
plugins: ['stylelint-order', "stylelint-config-rational-order/plugin", "stylelint-scss", 'stylelint-declaration-block-no-ignored-properties'],
rules: {
// `standard` conflict with `rational-order`
"declaration-empty-line-before": [
"never",
{
except: ['after-comment', 'after-declaration', 'first-nested'],
ignore: [
"after-comment",
"after-declaration",
"first-nested",
"inside-single-line-block",
],
},
],
"order/properties-order": [],
"plugin/rational-order": [true, {
"border-in-box-model": false,
"empty-line-between-groups": true,
}],
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"scss/comment-no-empty": true,
Expand All @@ -33,29 +51,29 @@ module.exports = {
],
"scss/no-duplicate-mixins": true,

'selector-pseudo-class-no-unknown': [
"selector-pseudo-class-no-unknown": [
true,
{
ignorePseudoClasses: ['global'],
ignorePseudoClasses: ["global"],
},
],
'no-empty-source': null,
'unicode-bom': 'never',
'no-descending-specificity': null,
'font-family-no-missing-generic-family-keyword': null,
'declaration-colon-space-after': 'always-single-line',
'declaration-colon-space-before': 'never',
'rule-empty-line-before': [
'always',
"no-empty-source": null,
"unicode-bom": "never",
"no-descending-specificity": null,
"font-family-no-missing-generic-family-keyword": null,
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"rule-empty-line-before": [
"always",
{
ignore: ['after-comment', 'first-nested'],
ignore: ["after-comment", "first-nested"],
},
],
//https://github.com/stylelint/stylelint/issues/4114
'function-calc-no-invalid': null,
'function-url-quotes': 'always',
'plugin/declaration-block-no-ignored-properties': true,
'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
"function-calc-no-invalid": null,
"function-url-quotes": "always",
"plugin/declaration-block-no-ignored-properties": true,
"unit-no-unknown": [true, { ignoreUnits: ["rpx"] }],
},
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
ignoreFiles: ["**/*.js", "**/*.jsx", "**/*.tsx", "**/*.ts"],
};
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5966,8 +5966,8 @@ stylelint-config-prettier@^8.0.2:

stylelint-config-rational-order@^0.1.2:
version "0.1.2"
resolved "https://registry.npmjs.org/stylelint-config-rational-order/-/stylelint-config-rational-order-0.1.2.tgz#4e98e390783d437f0ec41fb73bc41992e78d02a0"
integrity sha512-Qo7ZQaihCwTqijfZg4sbdQQHtugOX/B1/fYh018EiDZHW+lkqH9uHOnsDwDPGZrYJuB6CoyI7MZh2ecw2dOkew==
resolved "https://npm.corp.kuaishou.com/stylelint-config-rational-order/-/stylelint-config-rational-order-0.1.2.tgz#4e98e390783d437f0ec41fb73bc41992e78d02a0"
integrity sha1-TpjjkHg9Q38OxB+3O8QZkueNAqA=
dependencies:
stylelint "^9.10.1"
stylelint-order "^2.2.1"
Expand Down Expand Up @@ -6009,10 +6009,10 @@ stylelint-order@^2.2.1:
postcss "^7.0.2"
postcss-sorting "^4.1.0"

stylelint-order@^4.0.0:
stylelint-order@^4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/stylelint-order/-/stylelint-order-4.1.0.tgz#692d05b7d0c235ac66fcf5ea1d9e5f08a76747f6"
integrity sha512-sVTikaDvMqg2aJjh4r48jsdfmqLT+nqB1MOsaBnvM3OwLx4S+WXcsxsgk5w18h/OZoxZCxuyXMh61iBHcj9Qiw==
resolved "https://npm.corp.kuaishou.com/stylelint-order/-/stylelint-order-4.1.0.tgz#692d05b7d0c235ac66fcf5ea1d9e5f08a76747f6"
integrity sha1-aS0Ft9DCNaxm/PXqHZ5fCKdnR/Y=
dependencies:
lodash "^4.17.15"
postcss "^7.0.31"
Expand Down

0 comments on commit aa4fe23

Please sign in to comment.