├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .npmignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bin └── cli.js ├── compositor.json ├── index.js ├── lib ├── formatAtRuleParams.js ├── formatAtRules.js ├── formatColors.js ├── formatComments.js ├── formatDecls.js ├── formatOrder.js ├── formatRules.js ├── formatSassVariables.js ├── formatSelectors.js ├── formatShorthand.js ├── formatTransforms.js ├── formatValues.js ├── formatZeros.js ├── getIndent.js ├── hasBlock.js ├── hasDecls.js ├── hasRules.js ├── params.js └── util.js ├── package.json └── test ├── cli.js ├── css-modules └── value │ ├── value.css │ └── value.out.css ├── fixtures ├── at-apply │ ├── at-apply.css │ └── at-apply.out.css ├── at-media │ ├── at-media.css │ └── at-media.out.css ├── attr-selector │ ├── attr-selector.css │ └── attr-selector.out.css ├── charset-2 │ ├── charset-2.css │ └── charset-2.out.css ├── charset │ ├── charset.css │ └── charset.out.css ├── color-hex-lowercase │ ├── color-hex-lowercase.css │ └── color-hex-lowercase.out.css ├── comment-in-rules │ ├── comment-in-rules.css │ └── comment-in-rules.out.css ├── comment │ ├── comment.css │ └── comment.out.css ├── content │ ├── content.css │ └── content.out.css ├── cssnext-example │ ├── cssnext-example.css │ └── cssnext-example.out.css ├── custom-media-queries │ ├── custom-media-queries.css │ └── custom-media-queries.out.css ├── custom-properties │ ├── custom-properties.css │ └── custom-properties.out.css ├── custom-selectors │ ├── custom-selectors.css │ └── custom-selectors.out.css ├── data-url │ ├── data-url.css │ └── data-url.out.css ├── font-face │ ├── font-face.css │ └── font-face.out.css ├── font-shorthand │ ├── font-shorthand.css │ └── font-shorthand.out.css ├── ie-hacks │ ├── ie-hacks.css │ └── ie-hacks.out.css ├── import │ ├── import.css │ └── import.out.css ├── important │ ├── important.css │ └── important.out.css ├── inline-comment │ ├── inline-comment.css │ └── inline-comment.out.css ├── lowercase │ ├── lowercase.css │ └── lowercase.out.css ├── media-indent-with-import │ ├── media-indent-with-import.css │ └── media-indent-with-import.out.css ├── media-indent │ ├── media-indent.css │ └── media-indent.out.css ├── media-queries-ranges │ ├── media-queries-ranges.css │ └── media-queries-ranges.out.css ├── nested-2 │ ├── nested-2.css │ └── nested-2.out.css ├── nested-atrule │ ├── nested-atrule.css │ └── nested-atrule.out.css ├── nested-indention-2 │ ├── nested-indention-2.css │ ├── nested-indention-2.out.css │ └── stylelint.config.js ├── nested-indention │ ├── nested-indention.css │ ├── nested-indention.out.css │ └── stylelint.config.js ├── nested-mixin-2 │ ├── nested-mixin-2.css │ └── nested-mixin-2.out.css ├── nested-mixin │ ├── nested-mixin.css │ └── nested-mixin.out.css ├── nested │ ├── nested.css │ └── nested.out.css ├── non-nested-combinator │ ├── non-nested-combinator.css │ └── non-nested-combinator.out.css ├── pseudo-element │ ├── pseudo-element.css │ └── pseudo-element.out.css ├── readme │ ├── readme.css │ └── readme.out.css ├── shorthand-with-sass-variables │ ├── shorthand-with-sass-variables.css │ └── shorthand-with-sass-variables.out.css ├── values │ ├── values.css │ └── values.out.css ├── var-notation │ ├── var-notation.css │ └── var-notation.out.css └── vendor-prefix │ ├── vendor-prefix.css │ └── vendor-prefix.out.css ├── ignore ├── .stylelintrc ├── extend-stylelint.js └── ignore.css ├── index.js ├── recursive ├── bar.css ├── foo.css └── foo │ ├── foo.css │ └── foo.js ├── sass ├── media-indent-with-import │ ├── media-indent-with-import.css │ └── media-indent-with-import.out.css ├── media-indent │ ├── media-indent.css │ └── media-indent.out.css ├── sass-at-root │ ├── sass-at-root.css │ └── sass-at-root.out.css ├── sass-comment │ ├── sass-comment.css │ └── sass-comment.out.css ├── sass-content │ ├── sass-content.css │ └── sass-content.out.css ├── sass-extend │ ├── sass-extend.css │ └── sass-extend.out.css ├── sass-function-2 │ ├── sass-function-2.css │ └── sass-function-2.out.css ├── sass-function │ ├── sass-function.css │ └── sass-function.out.css ├── sass-if-else-2 │ ├── sass-if-else-2.css │ └── sass-if-else-2.out.css ├── sass-if-else │ ├── sass-if-else.css │ └── sass-if-else.out.css ├── sass-include-2 │ ├── sass-include-2.css │ └── sass-include-2.out.css ├── sass-include │ ├── sass-include.css │ └── sass-include.out.css ├── sass-indent │ ├── sass-indent.css │ └── sass-indent.out.css ├── sass-inline-comment │ ├── sass-inline-comment.css │ └── sass-inline-comment.out.css ├── sass-map-function │ ├── sass-map-function.css │ └── sass-map-function.out.css ├── sass-maps │ ├── sass-maps.css │ └── sass-maps.out.css ├── sass-math │ ├── sass-math.css │ └── sass-math.out.css ├── sass-mixin-2 │ ├── sass-mixin-2.css │ └── sass-mixin-2.out.css ├── sass-mixin │ ├── sass-mixin.css │ └── sass-mixin.out.css ├── sass-single-at-rule │ ├── sass-single-at-rule.css │ └── sass-single-at-rule.out.css ├── sass-variables │ ├── sass-variables.css │ └── sass-variables.out.css └── scss │ ├── scss.css │ └── scss.out.css └── stylelint ├── at-rule-empty-line-before-always-except-all-nested ├── .stylelintrc ├── at-rule-empty-line-before-always-except-all-nested.css └── at-rule-empty-line-before-always-except-all-nested.out.css ├── at-rule-empty-line-before-always-except-blockless-after-same-name-blockless ├── .stylelintrc ├── at-rule-empty-line-before-always-except-blockless-after-same-name-blockless.css └── at-rule-empty-line-before-always-except-blockless-after-same-name-blockless.out.css ├── at-rule-empty-line-before-always-except-blockless-group ├── .stylelintrc ├── at-rule-empty-line-before-always-except-blockless-group.css └── at-rule-empty-line-before-always-except-blockless-group.out.css ├── at-rule-empty-line-before-always-except-first-nested ├── .stylelintrc ├── at-rule-empty-line-before-always-except-first-nested.css └── at-rule-empty-line-before-always-except-first-nested.out.css ├── at-rule-empty-line-before-always-except-inside-block ├── .stylelintrc ├── at-rule-empty-line-before-always-except-inside-block.css └── at-rule-empty-line-before-always-except-inside-block.out.css ├── at-rule-empty-line-before-always-ignore-after-comment ├── .stylelintrc ├── at-rule-empty-line-before-always-ignore-after-comment.css └── at-rule-empty-line-before-always-ignore-after-comment.out.css ├── at-rule-empty-line-before-always-ignore-all-nested ├── .stylelintrc ├── at-rule-empty-line-before-always-ignore-all-nested.css └── at-rule-empty-line-before-always-ignore-all-nested.out.css ├── at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless ├── .stylelintrc ├── at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless.css └── at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless.out.css ├── at-rule-empty-line-before-always-ignore-blockless-group ├── .stylelintrc ├── at-rule-empty-line-before-always-ignore-blockless-group.css └── at-rule-empty-line-before-always-ignore-blockless-group.out.css ├── at-rule-empty-line-before-always ├── .stylelintrc ├── at-rule-empty-line-before-always.css └── at-rule-empty-line-before-always.out.css ├── at-rule-empty-line-before-never-except-blockless-group ├── .stylelintrc ├── at-rule-empty-line-before-never-except-blockless-group.css └── at-rule-empty-line-before-never-except-blockless-group.out.css ├── at-rule-empty-line-before-never-except-first-nested ├── .stylelintrc ├── at-rule-empty-line-before-never-except-first-nested.css └── at-rule-empty-line-before-never-except-first-nested.out.css ├── at-rule-empty-line-before-never ├── .stylelintrc ├── at-rule-empty-line-before-never.css └── at-rule-empty-line-before-never.out.css ├── at-rule-semicolon-newline-after-always-severity ├── .stylelintrc ├── at-rule-semicolon-newline-after-always-severity.css └── at-rule-semicolon-newline-after-always-severity.out.css ├── at-rule-semicolon-newline-after-always ├── .stylelintrc ├── at-rule-semicolon-newline-after-always.css └── at-rule-semicolon-newline-after-always.out.css ├── block-closing-brace-newline-after-always-multi-line ├── .stylelintrc ├── block-closing-brace-newline-after-always-multi-line.css └── block-closing-brace-newline-after-always-multi-line.out.css ├── block-closing-brace-newline-after-always-severity ├── .stylelintrc ├── block-closing-brace-newline-after-always-severity.css └── block-closing-brace-newline-after-always-severity.out.css ├── block-closing-brace-newline-after-always-single-line ├── .stylelintrc ├── block-closing-brace-newline-after-always-single-line.css └── block-closing-brace-newline-after-always-single-line.out.css ├── block-closing-brace-newline-after-always ├── .stylelintrc ├── block-closing-brace-newline-after-always.css └── block-closing-brace-newline-after-always.out.css ├── block-closing-brace-newline-after-never-multi-line-severity ├── .stylelintrc ├── block-closing-brace-newline-after-never-multi-line-severity.css └── block-closing-brace-newline-after-never-multi-line-severity.out.css ├── block-closing-brace-newline-after-never-multi-line ├── .stylelintrc ├── block-closing-brace-newline-after-never-multi-line.css └── block-closing-brace-newline-after-never-multi-line.out.css ├── block-closing-brace-newline-after-never-single-line ├── .stylelintrc ├── block-closing-brace-newline-after-never-single-line.css └── block-closing-brace-newline-after-never-single-line.out.css ├── block-opening-brace-newline-before-always-multi-line ├── .stylelintrc ├── block-opening-brace-newline-before-always-multi-line.css └── block-opening-brace-newline-before-always-multi-line.out.css ├── block-opening-brace-newline-before-always-single-line ├── .stylelintrc ├── block-opening-brace-newline-before-always-single-line.css └── block-opening-brace-newline-before-always-single-line.out.css ├── block-opening-brace-newline-before-always ├── .stylelintrc ├── block-opening-brace-newline-before-always.css └── block-opening-brace-newline-before-always.out.css ├── block-opening-brace-newline-before-never-multi-line ├── .stylelintrc ├── block-opening-brace-newline-before-never-multi-line.css └── block-opening-brace-newline-before-never-multi-line.out.css ├── block-opening-brace-newline-before-never-single-line ├── .stylelintrc ├── block-opening-brace-newline-before-never-single-line.css └── block-opening-brace-newline-before-never-single-line.out.css ├── block-opening-brace-space-before-always-multi-line ├── .stylelintrc ├── block-opening-brace-space-before-always-multi-line.css └── block-opening-brace-space-before-always-multi-line.out.css ├── block-opening-brace-space-before-always-single-line ├── .stylelintrc ├── block-opening-brace-space-before-always-single-line.css └── block-opening-brace-space-before-always-single-line.out.css ├── block-opening-brace-space-before-always ├── .stylelintrc ├── block-opening-brace-space-before-always.css └── block-opening-brace-space-before-always.out.css ├── block-opening-brace-space-before-never-multi-line ├── .stylelintrc ├── block-opening-brace-space-before-never-multi-line.css └── block-opening-brace-space-before-never-multi-line.out.css ├── block-opening-brace-space-before-never-single-line ├── .stylelintrc ├── block-opening-brace-space-before-never-single-line.css └── block-opening-brace-space-before-never-single-line.out.css ├── block-opening-brace-space-before-never ├── .stylelintrc ├── block-opening-brace-space-before-never.css └── block-opening-brace-space-before-never.out.css ├── color-hex-case-lower-severity ├── .stylelintrc ├── color-hex-case-lower-severity.css └── color-hex-case-lower-severity.out.css ├── color-hex-case-lower ├── .stylelintrc ├── color-hex-case-lower.css └── color-hex-case-lower.out.css ├── color-hex-case-upper-severity ├── .stylelintrc ├── color-hex-case-upper-severity.css └── color-hex-case-upper-severity.out.css ├── color-hex-case-upper ├── .stylelintrc ├── color-hex-case-upper.css └── color-hex-case-upper.out.css ├── color-hex-length-long ├── .stylelintrc ├── color-hex-length-long.css └── color-hex-length-long.out.css ├── color-hex-length-short ├── .stylelintrc ├── color-hex-length-short.css └── color-hex-length-short.out.css ├── declaration-block-properties-order-groups ├── .stylelintrc ├── declaration-block-properties-order-groups.css └── declaration-block-properties-order-groups.out.css ├── declaration-block-properties-order-severity ├── .stylelintrc ├── declaration-block-properties-order-severity.css └── declaration-block-properties-order-severity.out.css ├── declaration-block-properties-order ├── .stylelintrc ├── declaration-block-properties-order.css └── declaration-block-properties-order.out.css ├── declaration-colon-space-after-never ├── .stylelintrc ├── declaration-colon-space-after-never.css └── declaration-colon-space-after-never.out.css ├── declaration-colon-space-before-always ├── .stylelintrc ├── declaration-colon-space-before-always.css └── declaration-colon-space-before-always.out.css ├── declaration-empty-line-before-always-except ├── .stylelintrc ├── declaration-empty-line-before-always-except.css └── declaration-empty-line-before-always-except.out.css ├── declaration-empty-line-before-always-ignore ├── .stylelintrc ├── declaration-empty-line-before-always-ignore.css └── declaration-empty-line-before-always-ignore.out.css ├── declaration-empty-line-before-always-standard ├── .stylelintrc ├── declaration-empty-line-before-always-standard.css └── declaration-empty-line-before-always-standard.out.css ├── declaration-empty-line-before-always ├── .stylelintrc ├── declaration-empty-line-before-always.css └── declaration-empty-line-before-always.out.css ├── declaration-empty-line-before-never-except ├── .stylelintrc ├── declaration-empty-line-before-never-except.css └── declaration-empty-line-before-never-except.out.css ├── declaration-empty-line-before-never-ignore ├── .stylelintrc ├── declaration-empty-line-before-never-ignore.css └── declaration-empty-line-before-never-ignore.out.css ├── declaration-empty-line-before-never ├── .stylelintrc ├── declaration-empty-line-before-never.css └── declaration-empty-line-before-never.out.css ├── extends ├── .stylelintrc ├── extend-stylelint.js ├── extends.css └── extends.out.css ├── extends2 ├── .stylelintrc ├── extend-stylelint.js ├── extend-stylelint2.js ├── extends2.css └── extends2.out.css ├── extends3 ├── .stylelintrc ├── extend-stylelint.js ├── extend-stylelint2.js ├── extend-stylelint3.js ├── extends3.css └── extends3.out.css ├── indentation-2space-severity ├── .stylelintrc ├── indentation-2space-severity.css └── indentation-2space-severity.out.css ├── indentation-2space ├── .stylelintrc ├── indentation-2space.css └── indentation-2space.out.css ├── indentation-4space-severity ├── .stylelintrc ├── indentation-4space-severity.css └── indentation-4space-severity.out.css ├── indentation-4space ├── .stylelintrc ├── indentation-4space.css └── indentation-4space.out.css ├── indentation-tab-severity ├── .stylelintrc ├── indentation-tab-severity.css └── indentation-tab-severity.out.css ├── indentation-tab ├── .stylelintrc ├── indentation-tab.css └── indentation-tab.out.css ├── length-zero-no-unit ├── .stylelintrc ├── length-zero-no-unit.css └── length-zero-no-unit.out.css ├── number-leading-zero-always ├── .stylelintrc ├── number-leading-zero-always.css └── number-leading-zero-always.out.css ├── number-leading-zero-never ├── .stylelintrc ├── number-leading-zero-never.css └── number-leading-zero-never.out.css ├── number-no-trailing-zeros ├── .stylelintrc ├── number-no-trailing-zeros.css └── number-no-trailing-zeros.out.css ├── order-order ├── .stylelintrc ├── order-order.css └── order-order.out.css ├── order-properties-alphabetical-order ├── .stylelintrc ├── order-properties-alphabetical-order.css └── order-properties-alphabetical-order.out.css ├── order-properties-order ├── .stylelintrc ├── order-properties-order.css └── order-properties-order.out.css ├── selector-combinator-space-after-always ├── .stylelintrc ├── selector-combinator-space-after-always.css └── selector-combinator-space-after-always.out.css ├── selector-combinator-space-after-never ├── .stylelintrc ├── selector-combinator-space-after-never.css └── selector-combinator-space-after-never.out.css ├── selector-combinator-space-before-always ├── .stylelintrc ├── selector-combinator-space-before-always.css └── selector-combinator-space-before-always.out.css ├── selector-combinator-space-before-never ├── .stylelintrc ├── selector-combinator-space-before-never.css └── selector-combinator-space-before-never.out.css ├── selector-list-comma-newline-after-always-multi-line ├── .stylelintrc ├── selector-list-comma-newline-after-always-multi-line.css └── selector-list-comma-newline-after-always-multi-line.out.css ├── selector-list-comma-newline-after-always ├── .stylelintrc ├── selector-list-comma-newline-after-always.css └── selector-list-comma-newline-after-always.out.css ├── selector-list-comma-newline-after-never-multi-line ├── .stylelintrc ├── selector-list-comma-newline-after-never-multi-line.css └── selector-list-comma-newline-after-never-multi-line.out.css ├── selector-list-comma-newline-before-always-multi-line ├── .stylelintrc ├── selector-list-comma-newline-before-always-multi-line.css └── selector-list-comma-newline-before-always-multi-line.out.css ├── selector-list-comma-newline-before-always ├── .stylelintrc ├── selector-list-comma-newline-before-always.css └── selector-list-comma-newline-before-always.out.css ├── selector-list-comma-newline-before-never-multi-line ├── .stylelintrc ├── selector-list-comma-newline-before-never-multi-line.css └── selector-list-comma-newline-before-never-multi-line.out.css ├── selector-list-comma-space-after-always-single-line ├── .stylelintrc ├── selector-list-comma-space-after-always-single-line.css └── selector-list-comma-space-after-always-single-line.out.css ├── selector-list-comma-space-after-always ├── .stylelintrc ├── selector-list-comma-space-after-always.css └── selector-list-comma-space-after-always.out.css ├── selector-list-comma-space-after-never-single-line ├── .stylelintrc ├── selector-list-comma-space-after-never-single-line.css └── selector-list-comma-space-after-never-single-line.out.css ├── selector-list-comma-space-after-never ├── .stylelintrc ├── selector-list-comma-space-after-never.css └── selector-list-comma-space-after-never.out.css ├── selector-list-comma-space-before-always-single-line ├── .stylelintrc.js ├── selector-list-comma-space-before-always-single-line.css └── selector-list-comma-space-before-always-single-line.out.css ├── selector-list-comma-space-before-always ├── .stylelintrc.json ├── selector-list-comma-space-before-always.css └── selector-list-comma-space-before-always.out.css ├── selector-list-comma-space-before-never-single-line ├── .stylelintrc.yaml ├── selector-list-comma-space-before-never-single-line.css └── selector-list-comma-space-before-never-single-line.out.css ├── selector-list-comma-space-before-never ├── .stylelintrc.config.js ├── selector-list-comma-space-before-never.css └── selector-list-comma-space-before-never.out.css ├── shorthand-property-no-redundant-values ├── .stylelintrc ├── shorthand-property-no-redundant-values.css └── shorthand-property-no-redundant-values.out.css ├── string-quotes-double ├── .stylelintrc.yaml ├── string-quotes-double.css └── string-quotes-double.out.css └── string-quotes-single ├── .stylelintrc.yaml ├── string-quotes-single.css └── string-quotes-single.out.css /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "eslint:recommended", 3 | "env": { 4 | "node": true, 5 | "es6": true 6 | }, 7 | "rules": { 8 | "no-console": 0, 9 | "space-before-function-paren": [2, "always"], 10 | "semi": [2, "never"], 11 | "eqeqeq": [2, "allow-null"], 12 | "block-spacing": [2, "always"] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | test 3 | .editorconfig 4 | .eslintrc.json 5 | .travis.yml 6 | CHANGELOG.md 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "4" 5 | - "6" 6 | script: 7 | - npm run lint 8 | - npm test 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This software is released under the MIT license: 2 | 3 | Copyright (c) 2015 Masaaki Morishita 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.)) 21 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const postcss = require('postcss') 2 | 3 | const params = require('./lib/params') 4 | const formatAtRules = require('./lib/formatAtRules') 5 | const formatOrder = require('./lib/formatOrder') 6 | const formatRules = require('./lib/formatRules') 7 | const formatComments = require('./lib/formatComments') 8 | const formatSassVariables = require('./lib/formatSassVariables') 9 | 10 | 11 | const stylefmt = postcss.plugin('stylefmt', function (options) { 12 | var paramer = params(options) 13 | return function (root, result) { 14 | return paramer(root, result).then(function (params) { 15 | if(params) { 16 | formatComments(root, params) 17 | formatAtRules(root, params) 18 | formatRules(root, params) 19 | formatSassVariables(root, params) 20 | // order should be the last to prevent empty line collapse in order rules 21 | formatOrder(root, params) 22 | } 23 | }).catch(function (err) { 24 | console.error(err.stack) 25 | }) 26 | } 27 | }) 28 | 29 | module.exports = stylefmt 30 | -------------------------------------------------------------------------------- /lib/formatAtRuleParams.js: -------------------------------------------------------------------------------- 1 | function formatAtRuleParams (atrule) { 2 | var params = atrule.raws.params ? atrule.raws.params.raw : atrule.params 3 | var atName = atrule.name 4 | var atTypes = [ 5 | 'media', 6 | 'include', 7 | 'mixin', 8 | 'function', 9 | 'for', 10 | 'each', 11 | 'while', 12 | 'if', 13 | 'else', 14 | 'custom-media', 15 | 'custom-selectors' 16 | ] 17 | var sassMapFunctions = [ 18 | 'map-get', 19 | 'map-merge', 20 | 'map-remove', 21 | 'map-keys', 22 | 'map-values', 23 | 'map-has-key', 24 | 'keywords' 25 | ] 26 | 27 | function hasSassMapFunction (params) { 28 | var ret = false 29 | sassMapFunctions.forEach(function (func) { 30 | if (params.match(new RegExp(func))) { 31 | ret = true 32 | } 33 | }) 34 | return ret 35 | } 36 | 37 | if (atTypes.indexOf(atName) > -1) { 38 | params = params.replace(/\s*:\s*/g, ': ') 39 | params = params.replace(/\s*,\s*/g, ', ') 40 | 41 | if (!hasSassMapFunction(params)) { 42 | if (params.match(/^\(\s*/)) { 43 | params = params.replace(/^\(\s*/g, '(') 44 | } else if (atName === 'function' || atName === 'if' || atName === 'else') { 45 | params = params.replace(/\s*\(\s*/, '(') 46 | } else { 47 | params = params.replace(/\s*\(\s*/, ' (') 48 | } 49 | } 50 | 51 | params = params.replace(/\s*\)/g, ')') 52 | params = params.replace(/\)\s*{/g, ') ') 53 | params = params.replace(/\/\*/g, ' $&') 54 | params = params.replace(/\*\//g, '$& ') 55 | params = params.replace(/\s+/g, ' ') 56 | } 57 | 58 | if (atName === 'charset') { 59 | params = params.toLowerCase() 60 | } 61 | 62 | if (atName === 'return' || atName === 'if' || atName === 'else') { 63 | // format math operators before `$` or `(`. 64 | params = params.replace(/(?!^)[+\-*/%](?=\$|\()/g, ' $& ') 65 | // don't format minus sign (-) before a number 66 | // because we don't know if it is 67 | // part of a Sass variable name (e.g. $my-var-1-2). 68 | params = params.replace(/[+\*/%](?=\d+)/g, ' $& ') 69 | 70 | var hasVariableWithDash = (/\$\w+-\w+/).test(params) 71 | 72 | if (!hasVariableWithDash) { 73 | // format minus sign before number if safe 74 | params = params.replace(/-(?=\d+)/g, ' $& ') 75 | } 76 | 77 | params = params.replace(/!=|==|<=|>=/g, ' $& ') 78 | params = params.replace(/(<|>)(?!=)/g, ' $& ') 79 | params = params.replace(/\s+/g, ' ') 80 | } 81 | 82 | if (atName === 'custom-media') { 83 | params = params.replace(/\s*\(\s*/, ' (') 84 | params = params.replace(/\s*\)\s*w+/, ') ') 85 | params = params.replace(/\s*\>\=\s*/, ' >= ') 86 | params = params.replace(/\s*\<\=\s*/, ' <= ') 87 | } 88 | 89 | if (atName === 'custom-selector') { 90 | params = params.replace(/\s+/, ' ') 91 | params = params.replace(/,\s*/g, ', ') 92 | } 93 | 94 | return params 95 | } 96 | 97 | 98 | module.exports = formatAtRuleParams 99 | -------------------------------------------------------------------------------- /lib/formatColors.js: -------------------------------------------------------------------------------- 1 | var cssColors = require('css-color-list') 2 | var namedColorsRegex = new RegExp('(^|\s+)(' + cssColors().join('|') + ')(?=\$|\s+)', 'ig') 3 | var hslRegex = /hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(,\s*[\d\.]+)?\s*\)/ig 4 | var hexRegex = /#[a-f0-9]{3}([a-f0-9]{3})?/ig 5 | var rgbRegex = /rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,\s*[\d\.]+)?\s*\)/ig 6 | var hexShortRegex = /^#([a-f0-9])([a-f0-9])([a-f0-9])$/i 7 | var hexLongRegex = /#([a-f0-9])\1{1}([a-f0-9])\2{1}([a-f0-9])\3{1}/i 8 | 9 | function toLowerCase (value) { 10 | return value.toLowerCase() 11 | } 12 | 13 | function toUpperCase (value) { 14 | return value.toUpperCase() 15 | } 16 | 17 | function getProperty (stylelint, prop) { 18 | var stylelintProperty = null 19 | if (stylelint && stylelint[prop]) { 20 | stylelintProperty = stylelint[prop] 21 | if (typeof stylelintProperty === 'object') { 22 | stylelintProperty = stylelintProperty[0] 23 | } 24 | } 25 | 26 | return stylelintProperty 27 | } 28 | 29 | function shortenColors (value, stylelint) { 30 | var colorHexLength = getProperty(stylelint, 'color-hex-length') 31 | var shortenReplace = '#$1$2$3' 32 | var longerReplace = '#$1$1$2$2$3$3' 33 | 34 | if (colorHexLength === 'short') { 35 | value = value.replace(hexLongRegex, shortenReplace) 36 | } else if (colorHexLength === 'long') { 37 | value = value.replace(hexShortRegex, longerReplace) 38 | } 39 | 40 | return value 41 | } 42 | 43 | function formatColors (value, stylelint) { 44 | var colorCase = getProperty(stylelint, 'color-hex-case') 45 | var formatCase = toLowerCase 46 | var formatLengthColor = shortenColors(value, stylelint) 47 | if (colorCase === 'upper') { 48 | formatCase = toUpperCase 49 | } 50 | 51 | return formatLengthColor.replace(namedColorsRegex, formatCase) 52 | .replace(hslRegex, formatCase) 53 | .replace(hexRegex, formatCase) 54 | .replace(rgbRegex, formatCase) 55 | } 56 | 57 | module.exports = formatColors 58 | -------------------------------------------------------------------------------- /lib/formatComments.js: -------------------------------------------------------------------------------- 1 | var getIndent = require('./getIndent') 2 | 3 | function formatComments (root, params) { 4 | var indentWidth = params.indentWidth 5 | 6 | root.walkComments(function (comment) { 7 | var parentType = comment.parent.type 8 | var indentation = getIndent(comment, indentWidth) 9 | var nlCount = (comment.raws.before || '').split('\n').length - 1 10 | var spaceCount = (comment.raws.before || '').split(' ').length - 1 11 | if (parentType !== 'root') { 12 | if (nlCount) { 13 | comment.raws.before = '\n'.repeat(nlCount) + indentation 14 | } 15 | } else { 16 | if (nlCount) { 17 | comment.raws.before = '\n'.repeat(nlCount) + indentation 18 | } else if (spaceCount){ 19 | comment.raws.before = ' '.repeat(spaceCount) 20 | } 21 | } 22 | }) 23 | 24 | return root 25 | } 26 | 27 | 28 | module.exports = formatComments 29 | -------------------------------------------------------------------------------- /lib/formatDecls.js: -------------------------------------------------------------------------------- 1 | var formatValues = require('./formatValues') 2 | var hasDecls = require('./hasDecls') 3 | var hasEmptyLine = require('stylelint/lib/utils/hasEmptyLine') 4 | var isStandardSyntaxDeclaration = require('stylelint/lib/utils/isStandardSyntaxDeclaration') 5 | var isCustomProperty = require('stylelint/lib/utils/isCustomProperty') 6 | var util = require('./util') 7 | var getProperty = util.getProperty 8 | var getOptions = util.getOptions 9 | var isSingleLineString = require("stylelint/lib/utils/isSingleLineString") 10 | 11 | function formatDecls (rule, indent, indentWidth, stylelint) { 12 | const isSingleLine = isSingleLineString(rule) 13 | if (hasDecls(rule)) { 14 | rule.walkDecls(function (decl) { 15 | var isSassVal = /^\$/.test(decl.prop) 16 | var isIEHack = (/(\*|_)$/).test(decl.raws.before) 17 | if (decl.prop && !isCustomProperty(decl.prop) && !isSassVal) { 18 | decl.prop = decl.prop.toLowerCase() 19 | } 20 | 21 | if (isIEHack) { 22 | decl.prop = decl.raws.before.trim().replace(/\n/g, '') + decl.prop 23 | } 24 | 25 | decl.raws.between = ': ' 26 | decl.raws.before = declarationEmptyLineBefore(stylelint, decl, indent, indentWidth, isSingleLine) 27 | 28 | if (getProperty(stylelint, 'declaration-colon-space-before')) { 29 | decl.raws.between = declarationColonSpaceBefore(stylelint, decl.raws.between) 30 | } 31 | 32 | if (getProperty(stylelint, 'declaration-colon-space-after')) { 33 | decl.raws.between = declarationColonSpaceAfter(stylelint, decl.raws.between) 34 | } 35 | 36 | formatValues(decl, stylelint) 37 | }) 38 | } 39 | 40 | return rule 41 | } 42 | 43 | function declarationColonSpaceBefore (stylelint, between) { 44 | switch (getProperty(stylelint, 'declaration-colon-space-before')) { 45 | case 'always': 46 | return ' ' + between 47 | default: 48 | return between 49 | } 50 | } 51 | 52 | function declarationColonSpaceAfter (stylelint, between) { 53 | switch (getProperty(stylelint, 'declaration-colon-space-after')) { 54 | case 'never': 55 | return between.trim() 56 | default: 57 | return between 58 | } 59 | } 60 | 61 | 62 | function declarationEmptyLineBefore (stylelint, decl, indent, indentWidth, isSingleLine) { 63 | var ignore = false 64 | var prev = decl.prev() 65 | var nlCount = (decl.raws.before || '').split('\n').length - 1 66 | var declBefore 67 | 68 | if (getProperty(stylelint, 'declaration-empty-line-before')) { 69 | 70 | var declarationEmptyLineBeforeRule = getProperty(stylelint, 'declaration-empty-line-before') 71 | var exceptOptions = getOptions(stylelint, 'declaration-empty-line-before', 'except') || [] 72 | var ignoreOptions = getOptions(stylelint, 'declaration-empty-line-before', 'ignore') || [] 73 | 74 | var expectEmptyLineBefore = declarationEmptyLineBeforeRule === "always" 75 | 76 | if (ignoreOptions.indexOf('after-comment') !== -1 && prev && prev.type === 'comment') { 77 | ignore = true 78 | } 79 | 80 | if (ignoreOptions.indexOf('after-declaration') !== -1 && prev && prev.prop && isStandardSyntaxDeclaration(prev) && !isCustomProperty(prev.prop)) { 81 | ignore = true 82 | } 83 | 84 | if (ignoreOptions.indexOf('inside-single-line-block') !== -1 && isSingleLine) { 85 | ignore = true 86 | } 87 | 88 | if (exceptOptions.indexOf('first-nested') !== -1 && decl === decl.parent.first) { 89 | expectEmptyLineBefore = !expectEmptyLineBefore 90 | } 91 | 92 | if (exceptOptions.indexOf('after-comment') !== -1 && prev && prev.type === 'comment') { 93 | expectEmptyLineBefore = !expectEmptyLineBefore 94 | } 95 | 96 | if (exceptOptions.indexOf('after-declaration') !== -1 && prev && prev.prop && isStandardSyntaxDeclaration(prev) && !isCustomProperty(prev.prop)) { 97 | expectEmptyLineBefore = !expectEmptyLineBefore 98 | } 99 | 100 | var hasEmptyLineBefore = hasEmptyLine(decl.raws.before) 101 | 102 | if (decl.parent.type === 'root' && decl === decl.parent.first) { 103 | declBefore = '' 104 | } else if (ignore || (expectEmptyLineBefore === hasEmptyLineBefore)) { 105 | declBefore = '\n'.repeat(nlCount) + indent + indentWidth 106 | } else { 107 | if (!hasEmptyLineBefore) { 108 | declBefore = '\n\n' + indent + indentWidth 109 | } else { 110 | declBefore = '\n' + indent + indentWidth 111 | } 112 | } 113 | } else { 114 | if (prev && prev.type === 'comment') { 115 | if (nlCount) { 116 | declBefore = '\n'.repeat(nlCount) + indent + indentWidth 117 | } 118 | } else { 119 | declBefore = '\n' + indent + indentWidth 120 | } 121 | } 122 | return declBefore 123 | } 124 | 125 | module.exports = formatDecls 126 | -------------------------------------------------------------------------------- /lib/formatOrder.js: -------------------------------------------------------------------------------- 1 | var sorting = require('postcss-sorting') 2 | 3 | function formatOrder (root, params) { 4 | var sortOrder = getSordOrder(params) 5 | if (!sortOrder) { 6 | return 7 | } 8 | 9 | var sort = sorting({ 10 | 'order': getDeclarationBlocksOrder(params), 11 | 'properties-order': sortOrder 12 | }) 13 | 14 | sort(root) 15 | } 16 | 17 | function getSordOrder (params) { 18 | if (params.stylelint['order/properties-alphabetical-order']) { 19 | return 'alphabetical' 20 | } 21 | 22 | var propertiesOrder = 23 | processOrderPluginRule(params.stylelint['order/properties-order']) || 24 | processStylelintRule(params.stylelint['declaration-block-properties-order']) 25 | 26 | if (!Array.isArray(propertiesOrder)) { 27 | return 28 | } 29 | 30 | return propertiesOrder 31 | } 32 | 33 | function getDeclarationBlocksOrder (params) { 34 | // stylelint-order rule or default 35 | var declarationBlockOrder = params.stylelint['order/order'] || [ 36 | 'at-rules', 37 | 'custom-properties', 38 | 'dollar-variables', 39 | 'declarations', 40 | 'rules', 41 | ] 42 | return flattenRule(declarationBlockOrder) 43 | } 44 | 45 | function processOrderPluginRule (sortOrder) { 46 | if (!Array.isArray(sortOrder)) { 47 | return 48 | } 49 | 50 | sortOrder = flattenRule(sortOrder) 51 | 52 | return sortOrder.map(function (item) { 53 | if (typeof item === 'object' && item.emptyLineBefore === 'always') { 54 | // we should change "always" to "true" for postcss-sorting 55 | // copy item to prevent side effects 56 | return Object.assign({}, item, {emptyLineBefore: true}) 57 | } 58 | return item 59 | }) 60 | } 61 | 62 | function processStylelintRule (sortOrder) { 63 | if (!Array.isArray(sortOrder)) { 64 | return 65 | } 66 | 67 | sortOrder = flattenRule(sortOrder) 68 | 69 | // sort order can contain groups, so it needs to be flat for postcss-sorting 70 | var flattenedSortOrder = [] 71 | 72 | sortOrder.forEach(function (item) { 73 | if (typeof item === 'string') { 74 | flattenedSortOrder.push(item) 75 | } else if (typeof item === 'object' && Array.isArray(item.properties)) { 76 | item.properties.forEach(function (prop) { 77 | flattenedSortOrder.push(prop) 78 | }) 79 | } 80 | }) 81 | 82 | return flattenedSortOrder 83 | } 84 | 85 | function flattenRule (rule) { 86 | if (Array.isArray(rule[0])) { 87 | return rule[0] 88 | } 89 | return rule 90 | } 91 | 92 | module.exports = formatOrder 93 | -------------------------------------------------------------------------------- /lib/formatRules.js: -------------------------------------------------------------------------------- 1 | var formatSelectors = require('./formatSelectors') 2 | var formatDecls = require('./formatDecls') 3 | var getIndent = require('./getIndent') 4 | var getProperty = require('./util').getProperty 5 | 6 | function formatRules (root, params) { 7 | var stylelint = params.stylelint 8 | var indentWidth = params.indentWidth 9 | var ruleBuffer 10 | 11 | root.walkRules(function (rule, index) { 12 | ruleBuffer = rule 13 | 14 | var ruleBefore 15 | var parentType = rule.parent.type 16 | var indentation = getIndent(rule, indentWidth) 17 | 18 | if (index === 0 && parentType === 'root') { 19 | ruleBefore = '' 20 | } else { 21 | 22 | if (parentType === 'atrule') { 23 | if (rule.parent.first === rule) { 24 | ruleBefore = '\n' + indentation 25 | } else { 26 | ruleBefore = '\n\n' + indentation 27 | } 28 | } 29 | if (parentType === 'rule') { 30 | if (rule.parent.first === rule) { 31 | ruleBefore = '\n' + indentation 32 | } else { 33 | ruleBefore = '\n\n' + indentation 34 | } 35 | } 36 | 37 | if (parentType === 'root') { 38 | ruleBefore = '\n\n' + indentation 39 | } 40 | 41 | var prev = rule.prev() 42 | if (prev && prev.type === 'comment') { 43 | var nlCount = (rule.raws.before || '').split('\n').length - 1 44 | if (nlCount) { 45 | ruleBefore = '\n'.repeat(nlCount) + indentation 46 | } 47 | } 48 | } 49 | 50 | var isSingleLine 51 | if (index > 0) { 52 | isSingleLine = !/\n/.test(ruleBuffer.toString()) 53 | } else { 54 | isSingleLine = !/\n/.test(rule.toString()) 55 | } 56 | setRuleRawsConfig(rule, { 57 | ruleBefore: ruleBefore, 58 | indentation: indentation, 59 | stylelint: stylelint, 60 | isSingleLine: isSingleLine 61 | }) 62 | 63 | rule = formatSelectors(rule, indentation, stylelint) 64 | rule = formatDecls(rule, indentation, indentWidth, stylelint) 65 | 66 | rule.walkAtRules(function (rule) { 67 | var indentation = getIndent(rule, indentWidth) 68 | formatDecls(rule, indentation, indentWidth, stylelint) 69 | }) 70 | }) 71 | 72 | return root 73 | } 74 | 75 | function setRuleRawsConfig (rule, opts) { 76 | rule.raws.before = opts.ruleBefore 77 | rule.raws.afterName = ' ' 78 | setPropertyForAtRuleSemicolonNewlineAfter(rule.raws, opts) 79 | if (getProperty(opts.stylelint, 'block-closing-brace-newline-after')) { 80 | setPropertyForBlockClosingBraceNewlineAfter(rule.raws, opts) 81 | } else { 82 | setPropertyForAtRuleSemicolonNewlineAfter(rule.raws, opts) 83 | } 84 | if (getProperty(opts.stylelint, 'block-opening-brace-newline-before')) { 85 | rule.raws.between = blockOpeningBraceNewlineBefore(rule, opts) 86 | } else { 87 | rule.raws.between = blockOpeningBraceSpaceBefore(rule, opts) 88 | } 89 | } 90 | 91 | function setPropertyForAtRuleSemicolonNewlineAfter (raws, opts) { 92 | switch (getProperty(opts.stylelint, 'at-rule-semicolon-newline-after')) { 93 | default: 94 | raws.after = '\n' + opts.indentation 95 | raws.semicolon = true 96 | break 97 | } 98 | } 99 | 100 | function setPropertyForBlockClosingBraceNewlineAfter (raws, opts) { 101 | raws.semicolon = true 102 | switch (getProperty(opts.stylelint, 'block-closing-brace-newline-after')) { 103 | case 'never-multi-line': 104 | raws.before = '' 105 | break 106 | default: 107 | raws.before = opts.ruleBefore 108 | break 109 | } 110 | } 111 | 112 | function blockOpeningBraceSpaceBefore (rule, opts) { 113 | if (isIgnoreRule(opts.stylelint, rule)) { 114 | return rule.raws.between 115 | } 116 | switch (getProperty(opts.stylelint, 'block-opening-brace-space-before')) { 117 | case 'never': 118 | return '' 119 | case 'always-single-line': 120 | if (!opts.isSingleLine) { 121 | return rule.raws.between 122 | } 123 | return ' ' 124 | case 'never-single-line': 125 | if (!opts.isSingleLine) { 126 | return rule.raws.between 127 | } 128 | return '' 129 | case 'always-multi-line': 130 | if (opts.isSingleLine || rule.raws.between.match(/ {/)) { 131 | return rule.raws.between 132 | } 133 | return ' ' 134 | case 'never-multi-line': 135 | if (opts.isSingleLine) { 136 | return rule.raws.between 137 | } 138 | return '' 139 | default: 140 | return ' ' 141 | } 142 | } 143 | 144 | function blockOpeningBraceNewlineBefore (rule, opts) { 145 | if (isIgnoreRule(opts.stylelint, rule)) { 146 | return rule.raws.between 147 | } 148 | switch (getProperty(opts.stylelint, 'block-opening-brace-newline-before')) { 149 | case 'always': 150 | return '\n' + opts.indentation 151 | case 'always-single-line': 152 | if (opts.isSingleLine) { 153 | return rule.raws.between 154 | } 155 | return '\n' 156 | case 'never-single-line': 157 | if (opts.isSingleLine) { 158 | return '' 159 | } 160 | return rule.raws.between 161 | case 'always-multi-line': 162 | if (opts.isSingleLine) { 163 | return rule.raws.between 164 | } 165 | return ' ' 166 | case 'never-multi-line': 167 | if (opts.isSingleLine) { 168 | return rule.raws.between 169 | } 170 | return '' 171 | default: 172 | return rule.raws.between 173 | } 174 | } 175 | 176 | function isIgnoreRule (stylelint, css) { 177 | if (!stylelint.ignoreAtRules) { 178 | return false 179 | } 180 | return stylelint.ignoreAtRules.some(function (ignoreRules) { 181 | return css.match(new RegExp(ignoreRules, 'g')) 182 | }) 183 | } 184 | 185 | module.exports = formatRules 186 | -------------------------------------------------------------------------------- /lib/formatSassVariables.js: -------------------------------------------------------------------------------- 1 | var formatTransforms = require('./formatTransforms') 2 | var formatColors = require('./formatColors') 3 | var formatZeros = require('./formatZeros') 4 | 5 | function formatSassVariables (root, params) { 6 | var stylelint = params.stylelint 7 | 8 | root.walkDecls(function (decl) { 9 | if (isSassVariable(decl)) { 10 | if (isSassMaps(decl)) { 11 | return 12 | } 13 | var isFunctionCall = (/\w+\(.+\)/).test(decl.value) 14 | 15 | // format math operators before `$` or `(`. 16 | decl.value = decl.value.trim().replace(/(?!^)[+\-*/%](?=\$|\()/g, ' $& ') 17 | 18 | if (!isFunctionCall) { 19 | // format "+", "*" and "%" before a number 20 | decl.value = decl.value.replace(/(?!^)[+*%](?=\d)/g, ' $& ') 21 | 22 | // don't format minus sign (-) before a number 23 | // because we don't know if it is 24 | // part of a Sass variable name (e.g. $my-var-1-2). 25 | var hasVariableWithDash = (/\$\w+-\w+/).test(decl.value) 26 | 27 | if (!hasVariableWithDash) { 28 | // format minus sign between numbers if safe 29 | decl.value = decl.value.replace(/\d+-(?=\d)/g, function (value) { 30 | return value.replace(/-/g, ' $& ') 31 | }) 32 | } 33 | 34 | // "/" can not be formatted if it's not inside parens, 35 | // because we don't know if it's used as CSS "font" shorthand property. 36 | var isDivideInParens = (/\(.+\/.+\)/).test(decl.value) 37 | if (isDivideInParens) { 38 | decl.value = decl.value.replace(/\/(?=\d)/g, ' $& ') 39 | } 40 | } 41 | 42 | var isDataUrl = (/data:.+\/(.+);base64,(.*)/).test(decl.value) 43 | 44 | if (!isDataUrl) { 45 | // Remove spaces before commas and keep only one space after. 46 | decl.value = decl.value.trim().replace(/(\s+)?,(\s)*/g, ', ') 47 | } 48 | 49 | decl.value = formatZeros(decl.value, stylelint) 50 | decl.value = formatColors(decl.value, stylelint) 51 | decl.value = formatTransforms(decl.value) 52 | 53 | if (decl.prev()) { 54 | decl.raws.before = '\n' 55 | } 56 | 57 | decl.raws.between = ': ' 58 | } 59 | }) 60 | } 61 | 62 | function isSassVariable (decl) { 63 | return decl.parent.type === 'root' && decl.prop.match(/^\$/) 64 | } 65 | 66 | function isSassMaps (decl) { 67 | return decl.prop.match(/^\$/) && decl.value.match(/^\(\s*\w+:\s*/) 68 | } 69 | 70 | module.exports = formatSassVariables 71 | -------------------------------------------------------------------------------- /lib/formatSelectors.js: -------------------------------------------------------------------------------- 1 | var getProperty = require('./util').getProperty 2 | function formatSelectors (rule, indentation, stylelint) { 3 | var tmp = [] 4 | var isSingleLine = false 5 | 6 | rule.selectors.forEach(function (selector, i) { 7 | // don't add extra spaces to :nth-child(5n+1) etc. 8 | if (!hasPlusInsideParens(selector) && !isAttrSelector(selector)) { 9 | selector = selector.replace(/\s*([+~>])\s*/g, " $1 ") 10 | } 11 | 12 | if (isAttrSelector(selector)) { 13 | selector = selector.replace(/\[\s*(\S+)\s*\]/g, "[$1]") 14 | } 15 | 16 | selector = selectorCombinatorSpaceBefore(stylelint, selector) 17 | selector = selectorCombinatorSpaceAfter(stylelint, selector) 18 | 19 | tmp.push(selector) 20 | if (i > 0 && !tmp[1].match('\n') && !isSingleLine) { 21 | isSingleLine = true 22 | } 23 | }) 24 | 25 | var separator = selectorListCommaSpaceBefore(stylelint, isSingleLine, indentation) 26 | + selectorListCommaNewlineBefore(stylelint, isSingleLine, indentation) 27 | + ',' 28 | if (getProperty(stylelint, 'selector-list-comma-space-after')) { 29 | separator += selectorListCommaSpaceAfter(stylelint, isSingleLine) 30 | } else { 31 | separator += selectorListCommaNewlineAfter(stylelint, isSingleLine) 32 | switch (isSingleLine) { 33 | case /\n,/.test(separator): 34 | separator = separator.replace('\n,', indentation + '\n,') 35 | break 36 | case /,\n/.test(separator): 37 | separator = separator.replace(',\n', ',\n' + indentation) 38 | break 39 | } 40 | } 41 | rule.selector = tmp.join(separator) 42 | 43 | return rule 44 | } 45 | 46 | function selectorCombinatorSpaceBefore (stylelint, selector) { 47 | switch (getProperty(stylelint, 'selector-combinator-space-before')) { 48 | case 'never': 49 | return selector.replace(/\s+(?=[+~>])/g, "") 50 | default: 51 | return selector.replace(/^\s*([+~>])/g, " $1") 52 | } 53 | } 54 | 55 | function selectorCombinatorSpaceAfter (stylelint, selector) { 56 | switch (getProperty(stylelint, 'selector-combinator-space-after')) { 57 | case 'never': 58 | return selector.replace(/([+~>])\s*/g, "$1") 59 | default: 60 | return selector.replace(/^\s*([+~>])\s*/g, "$1 ") 61 | } 62 | } 63 | 64 | function selectorListCommaNewlineBefore (stylelint, isSingleLine, indentation) { 65 | switch (getProperty(stylelint, 'selector-list-comma-newline-before')) { 66 | case 'always': 67 | return '\n' + indentation 68 | case 'always-multi-line': 69 | if (isSingleLine) { 70 | return '\n' 71 | } 72 | return '' 73 | default: 74 | return '' 75 | } 76 | } 77 | 78 | function selectorListCommaNewlineAfter (stylelint, isSingleLine) { 79 | switch (getProperty(stylelint, 'selector-list-comma-newline-after')) { 80 | case 'always-multi-line': 81 | if (isSingleLine) { 82 | return '\n' 83 | } 84 | return ',' 85 | case 'never-multi-line': 86 | return '' 87 | default: 88 | return '\n' 89 | } 90 | } 91 | 92 | function selectorListCommaSpaceBefore (stylelint, isSingleLine, indentation) { 93 | switch (getProperty(stylelint, 'selector-list-comma-space-before')) { 94 | case 'always': 95 | return ' ' 96 | case 'always-single-line': 97 | if (isSingleLine) { 98 | return ' ' 99 | } 100 | return indentation 101 | case 'never-single-line': 102 | if (isSingleLine) { 103 | return '' 104 | } 105 | return ' ' 106 | default: 107 | return '' 108 | } 109 | } 110 | 111 | function selectorListCommaSpaceAfter (stylelint, isSingleLine) { 112 | switch (getProperty(stylelint, 'selector-list-comma-space-after')) { 113 | case 'never': 114 | return '' 115 | case 'always-single-line': 116 | if (isSingleLine) { 117 | return ' ' 118 | } 119 | return '' 120 | case 'never-single-line': 121 | return '' 122 | default: 123 | return ' ' 124 | } 125 | } 126 | 127 | function hasPlusInsideParens (selector) { 128 | return /\(.+\+.+\)/.test(selector) 129 | } 130 | 131 | function isAttrSelector (selector) { 132 | return /\[.+\]/.test(selector) 133 | } 134 | 135 | module.exports = formatSelectors 136 | -------------------------------------------------------------------------------- /lib/formatShorthand.js: -------------------------------------------------------------------------------- 1 | var valueParser = require('postcss-value-parser') 2 | var getProperty = require('./util').getProperty 3 | 4 | var ignoredCharacters = ["+", "-", "*", "/", "(", ")", "$", "@", "--", "var("] 5 | 6 | var ignoredShorthandProperties = [ 7 | "background", 8 | "font", 9 | "border", 10 | "border-top", 11 | "border-bottom", 12 | "border-left", 13 | "border-right", 14 | "list-style", 15 | "transition", 16 | ] 17 | 18 | var shorthandableProperties = [ 19 | "margin", 20 | "padding", 21 | "border-width", 22 | "border-style", 23 | "border-color", 24 | "border-radius", 25 | ] 26 | 27 | function condense (top, right, bottom, left) { 28 | var lowerTop = top.toLowerCase() 29 | var lowerRight = right.toLowerCase() 30 | var lowerBottom = bottom && bottom.toLowerCase() 31 | var lowerLeft = left && left.toLowerCase() 32 | 33 | if (canCondenseToOneValue(lowerTop, lowerRight, lowerBottom, lowerLeft)) { 34 | return [top] 35 | } else if (canCondenseToTwoValues(lowerTop, lowerRight, lowerBottom, lowerLeft)) { 36 | return [ top, right ] 37 | } else if (canCondenseToThreeValues(lowerTop, lowerRight, lowerBottom, lowerLeft)) { 38 | return [ top, right, bottom ] 39 | } else { 40 | return [ top, right, bottom, left ] 41 | } 42 | } 43 | 44 | function canCondenseToOneValue (top, right, bottom, left) { 45 | if (top !== right) { return false } 46 | 47 | return top === bottom && (bottom === left || !left) || !bottom && !left 48 | } 49 | 50 | function canCondenseToTwoValues (top, right, bottom, left) { 51 | return top === bottom && right === left || top === bottom && !left && top !== right 52 | } 53 | 54 | function canCondenseToThreeValues (top, right, bottom, left) { 55 | return right === left 56 | } 57 | 58 | function hasIgnoredCharacters (value) { 59 | return ignoredCharacters.some(function (char) { 60 | return value.indexOf(char) !== -1 61 | }) 62 | } 63 | 64 | function isIgnoredShorthandProperty (prop) { 65 | return ignoredShorthandProperties.indexOf(prop.toLowerCase()) !== -1 66 | } 67 | 68 | function isShorthandableProperty (prop) { 69 | return shorthandableProperties.indexOf(prop.toLowerCase()) !== -1 70 | } 71 | 72 | 73 | function formatShorthand (decl, stylelint) { 74 | if (getProperty(stylelint, 'shorthand-property-no-redundant-values') === true) { 75 | if ( 76 | hasIgnoredCharacters(decl.value) 77 | || isIgnoredShorthandProperty(decl.prop) 78 | || !isShorthandableProperty(decl.prop) 79 | ) { return decl.value } 80 | 81 | var valuesToShorthand = [] 82 | 83 | valueParser(decl.value).walk(function (valueNode) { 84 | if (valueNode.type !== 'word') { return } 85 | valuesToShorthand.push(valueParser.stringify(valueNode)) 86 | }) 87 | 88 | if (valuesToShorthand.length <= 1 89 | || valuesToShorthand.length > 4 90 | ) { return decl.value } 91 | 92 | var shortestForm = condense( 93 | valuesToShorthand[0], 94 | valuesToShorthand[1], 95 | valuesToShorthand[2] || null, 96 | valuesToShorthand[3] || null 97 | ) 98 | var shortestFormString = shortestForm 99 | .filter(function (val) { return val }) 100 | .join(' ') 101 | 102 | return shortestFormString 103 | } 104 | 105 | return decl.value 106 | } 107 | 108 | module.exports = formatShorthand 109 | -------------------------------------------------------------------------------- /lib/formatTransforms.js: -------------------------------------------------------------------------------- 1 | var transformTypes = [ 2 | 'translate', 3 | 'matrix', 4 | 'rotate', 5 | 'scale', 6 | 'skew' 7 | ] 8 | var transformRegex = new RegExp('(' + transformTypes.join('|') + ')[xyz]?(3d)?\\(', 'ig') 9 | var matrixRegex = /matrix\(/ig 10 | var xyzRegex = /[xyz]{1}(?=\()/g 11 | 12 | function transformsToLowerCase (value) { 13 | return value.replace(transformRegex, function (value) { 14 | if (matrixRegex.test(value)) { 15 | return value.toLowerCase() 16 | } 17 | return value.toLowerCase().replace(xyzRegex, function (value) { 18 | return value.toUpperCase() 19 | }) 20 | }) 21 | } 22 | 23 | function formatTransforms (value) { 24 | return transformsToLowerCase(value) 25 | } 26 | 27 | module.exports = formatTransforms 28 | -------------------------------------------------------------------------------- /lib/formatValues.js: -------------------------------------------------------------------------------- 1 | var formatTransforms = require('./formatTransforms') 2 | var formatColors = require('./formatColors') 3 | var formatZeros = require('./formatZeros') 4 | var formatShorthand = require('./formatShorthand') 5 | var getProperty = require('./util').getProperty 6 | 7 | function formatvalues (decl, stylelint) { 8 | var isDataUrl = /data:.+\/(.+);base64,(.*)/.test(decl.value) 9 | var isVarNotation = /var\s*\(.*\)/.test(decl.value) 10 | var isString = /^("|').*("|')$/.test(decl.value) 11 | var isFunctionCall = /\w+\(.+\)/.test(decl.value) 12 | 13 | if (decl.raws.value) { 14 | decl.raws.value.raw = decl.raws.value.raw.trim() 15 | } 16 | 17 | if (!isString) { 18 | decl.value = decl.value.trim().replace(/\s+/g, ' ') 19 | } 20 | 21 | switch (getProperty(stylelint, 'string-quotes')) { 22 | case 'double': 23 | decl.value = decl.value.replace(/'/g, '"') 24 | break 25 | case 'single': 26 | decl.value = decl.value.replace(/"/g, '\'') 27 | break 28 | } 29 | 30 | if (decl.prop === 'content') { 31 | return decl 32 | } 33 | 34 | if (decl.prop === 'font-family') { 35 | decl.value = decl.value.trim().replace(/\s+,\s/g, ', ') 36 | return decl 37 | } 38 | 39 | if (!isDataUrl) { 40 | // Remove spaces before commas and keep only one space after. 41 | decl.value = decl.value.trim().replace(/(\s+)?,(\s)*/g, ', ') 42 | } 43 | 44 | if (isVarNotation) { 45 | decl.value = decl.value.replace(/var\s*\(\s*/g, 'var(') 46 | decl.value = decl.value.replace(/\s*\)/g, ')') 47 | } 48 | 49 | if (!isFunctionCall) { 50 | // format math operators before `$` or `(`. 51 | decl.value = decl.value.replace(/(?!^)[+\-*%](?=\$|\()/g, ' $& ') 52 | // don't format "/" from a "font" shorthand property. 53 | if (decl.prop !== 'font') { 54 | decl.value = decl.value.replace(/\/(?=\$|\(|\d)/g, ' $& ') 55 | } 56 | // format "-" if it is between numbers 57 | decl.value = decl.value.replace(/\d+-(?=\d)/g, function (value) { 58 | return value.replace(/-/g, ' $& ') 59 | }) 60 | } 61 | 62 | decl.value = decl.value.replace(/\(\s*/g, '(') 63 | decl.value = decl.value.replace(/\s*\)/g, ')') 64 | 65 | decl.value = formatShorthand(decl, stylelint) 66 | decl.value = formatZeros(decl.value, stylelint) 67 | decl.value = formatColors(decl.value, stylelint) 68 | decl.value = formatTransforms(decl.value) 69 | 70 | if (decl.important) { 71 | decl.raws.important = " !important" 72 | } 73 | 74 | return decl 75 | } 76 | 77 | 78 | module.exports = formatvalues 79 | -------------------------------------------------------------------------------- /lib/formatZeros.js: -------------------------------------------------------------------------------- 1 | var zeroWithUnitRegex = /^0[\.0]*(?:px|r?em|ex|ch|vh|vw|cm|mm|in|pt|pc|vmin|vmax)/g 2 | var getProperty = require('./util').getProperty 3 | 4 | function formatZeros (value, stylelint) { 5 | if (getProperty(stylelint, 'length-zero-no-unit') === true) { 6 | value = value.replace(zeroWithUnitRegex, '0') 7 | } 8 | 9 | switch (getProperty(stylelint, 'number-leading-zero')) { 10 | case 'always': 11 | value = value.replace(/([\s:,(]|^)(\.\d+)/g, '$10$2') 12 | break 13 | case 'never': 14 | value = value.replace(/([\s:,(]|^)0(\.\d+)/g, '$1$2') 15 | break 16 | } 17 | 18 | if (getProperty(stylelint, 'number-no-trailing-zeros') === true) { 19 | value = value.replace(/(\d+)(\.\d+)(0+)$/g, '$1$2') 20 | value = value.replace(/([\s:,(]|^)(\d+)(?:(\.[1-9]+)|\.)0+(?=\D|$)/g, '$1$2$3') 21 | } 22 | 23 | return value 24 | } 25 | 26 | module.exports = formatZeros 27 | -------------------------------------------------------------------------------- /lib/getIndent.js: -------------------------------------------------------------------------------- 1 | var util = require('./util') 2 | var getNestedRulesNum = util.getNestedRulesNum 3 | 4 | function getIndent (rule, indentWidth) { 5 | 6 | var nestedRuleNum = getNestedRulesNum(rule) 7 | var indentation = indentWidth.repeat(nestedRuleNum) 8 | 9 | return indentation 10 | } 11 | 12 | 13 | module.exports = getIndent 14 | -------------------------------------------------------------------------------- /lib/hasBlock.js: -------------------------------------------------------------------------------- 1 | function hasBlock (rule) { 2 | return rule.nodes !== undefined 3 | } 4 | 5 | module.exports = hasBlock 6 | -------------------------------------------------------------------------------- /lib/hasDecls.js: -------------------------------------------------------------------------------- 1 | function hasDecls (rule) { 2 | var children = rule.nodes 3 | if (!Array.isArray(children)) { 4 | return false 5 | } 6 | return children.some(function (child) { 7 | return child.type === 'decl' 8 | }) 9 | } 10 | 11 | 12 | module.exports = hasDecls 13 | -------------------------------------------------------------------------------- /lib/hasRules.js: -------------------------------------------------------------------------------- 1 | function hasRules (rule) { 2 | var children = rule.nodes 3 | if (!Array.isArray(children)) { 4 | return false 5 | } 6 | return children.some(function (child) { 7 | return child.type === 'rule' 8 | }) 9 | } 10 | 11 | 12 | module.exports = hasRules 13 | -------------------------------------------------------------------------------- /lib/params.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var path = require('path') 3 | var createStylelint = require('stylelint').createLinter 4 | var editorconfig = require('editorconfig') 5 | var getProperty = require('./util').getProperty 6 | var defaultIndentWidth = ' '.repeat(2) 7 | 8 | function hasScssInDir (wd) { 9 | var dirs = fs.readdirSync(wd) 10 | return dirs.some(function (dir) { 11 | return dir.match(/.*\.scss/) 12 | }) 13 | } 14 | 15 | function getEditorConfig (file) { 16 | 17 | var rules = {} 18 | 19 | function setRuleValue (ruleName, value) { 20 | if (value != null) { 21 | if (Array.isArray(rules[ruleName])) { 22 | rules[ruleName][0] = value 23 | } else { 24 | rules[ruleName] = [value] 25 | } 26 | } 27 | } 28 | 29 | return editorconfig.parse(file).then(function (editorconfig) { 30 | if (editorconfig) { 31 | if (editorconfig.indent_style) { 32 | setRuleValue('indentation', /^space$/i.test(editorconfig.indent_style) ? +editorconfig.indent_size || 2 : 'tab') 33 | } 34 | setRuleValue('no-missing-end-of-source-newline', editorconfig.insert_final_newline) 35 | setRuleValue('no-eol-whitespace', editorconfig.trim_trailing_whitespace) 36 | } 37 | return rules 38 | }) 39 | } 40 | 41 | function getIndentationFromStylelintRules (rules) { 42 | var indentation = getProperty(rules, 'indentation') 43 | 44 | switch (typeof indentation) { 45 | case 'string': 46 | return '\t' 47 | case 'number': 48 | return ' '.repeat(indentation) 49 | default: 50 | return defaultIndentWidth 51 | } 52 | } 53 | 54 | function loadConfig (stylelint, file, options) { 55 | return stylelint.isPathIgnored(file).then(function (isIgnored) { 56 | if (isIgnored) { 57 | return null 58 | } 59 | return stylelint.getConfigForFile(file).then(function (stylelintrc) { 60 | return stylelintrc && stylelintrc.config && stylelintrc.config.rules 61 | }) 62 | }).catch(function (err) { 63 | var fileNotFound = err.code === 'ENOENT' && path.resolve(process.cwd(), options.codeFilename) === err.path 64 | if (fileNotFound || /\bNo configuration provided\b/.test(err.message)) { 65 | if (!file) { 66 | var cwd = process.cwd() 67 | file = path.join(cwd, hasScssInDir(cwd) ? '*.scss' : '*.css') 68 | } 69 | 70 | return getEditorConfig(file) 71 | } else { 72 | throw err 73 | } 74 | }).then(function (rules) { 75 | if(rules) { 76 | return { 77 | indentWidth: getIndentationFromStylelintRules(rules), 78 | hasScss: /\.scss$/i.test(file), 79 | stylelint: rules, 80 | } 81 | } 82 | return rules 83 | }) 84 | } 85 | 86 | function params (options) { 87 | options = options || {} 88 | var tailoredOptions = (options.rules) 89 | ? { config: options } 90 | : options 91 | var stylelint = createStylelint(tailoredOptions) 92 | 93 | return function (root, result) { 94 | if (result.stylelint && result.stylelint.ignored) { 95 | return Promise.resolve(null) 96 | } 97 | var file = root.source.input.file || options.from 98 | return loadConfig(stylelint, file, options) 99 | } 100 | } 101 | 102 | module.exports = params 103 | -------------------------------------------------------------------------------- /lib/util.js: -------------------------------------------------------------------------------- 1 | function inAtRule (rule) { 2 | var ret = false 3 | var current = rule.parent 4 | while (current.type !== 'root') { 5 | if (current.type === 'atrule') { 6 | ret = true 7 | break 8 | } 9 | current = current.parent 10 | } 11 | 12 | return ret 13 | } 14 | 15 | function getNestedRulesNum (rule) { 16 | var parent = rule.parent 17 | var num = 0 18 | 19 | while (parent.type !== 'root') { 20 | parent = parent.parent 21 | num++ 22 | } 23 | 24 | return num 25 | } 26 | 27 | function isEmptyObject (obj) { 28 | for (var name in obj) { 29 | return false 30 | } 31 | return true 32 | } 33 | 34 | function getProperty (stylelint, prop) { 35 | var stylelintProperty = null 36 | if (stylelint && stylelint[prop]) { 37 | stylelintProperty = stylelint[prop] 38 | if (typeof stylelintProperty === 'object') { 39 | stylelintProperty = stylelintProperty[0] 40 | } 41 | } 42 | 43 | return stylelintProperty 44 | } 45 | 46 | function getOptions (stylelint, prop, option) { 47 | var stylelintProperty = [] 48 | if (stylelint && stylelint[prop]) { 49 | stylelintProperty = stylelint[prop] 50 | if (typeof stylelintProperty === 'object' && stylelintProperty.length > 1) { 51 | stylelintProperty = stylelintProperty[1][option] 52 | } 53 | } 54 | 55 | return stylelintProperty 56 | } 57 | 58 | 59 | module.exports = { 60 | inAtRule: inAtRule, 61 | getNestedRulesNum: getNestedRulesNum, 62 | isEmptyObject: isEmptyObject, 63 | getProperty: getProperty, 64 | getOptions: getOptions 65 | } 66 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stylefmt", 3 | "version": "6.0.3", 4 | "description": "stylefmt is a tool that automatically formats CSS according to stylelint rules", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "tape test/*.js | faucet && npm run lint", 8 | "lint": "eslint -c .eslintrc.json index.js lib bin" 9 | }, 10 | "bin": { 11 | "stylefmt": "bin/cli.js" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git://github.com/morishitter/stylefmt/git" 16 | }, 17 | "engines": { 18 | "node": ">=4.2.0" 19 | }, 20 | "keywords": [ 21 | "css", 22 | "format", 23 | "formatter", 24 | "code style", 25 | "beautifier", 26 | "postcss-plugin", 27 | "postcss", 28 | "stylelint" 29 | ], 30 | "author": "Masaaki Morishita", 31 | "license": "MIT", 32 | "dependencies": { 33 | "css-color-list": "^0.0.1", 34 | "diff": "^3.2.0", 35 | "editorconfig": "^0.13.2", 36 | "getopts": "^2.1.1", 37 | "colorette": "^1.0.5", 38 | "globby": "^6.1.0", 39 | "postcss": "^6.0.1", 40 | "postcss-scss": "^1.0.0", 41 | "postcss-sorting": "^2.1.0", 42 | "postcss-value-parser": "^3.3.0", 43 | "stdin": "^0.0.1", 44 | "stylelint": "^7.10.1", 45 | "stylelint-order": "^0.4.4" 46 | }, 47 | "devDependencies": { 48 | "each-series": "^1.0.0", 49 | "eslint": "^3.19.0", 50 | "faucet": "^0.0.1", 51 | "klaw": "^1.3.1", 52 | "tape": "^4.6.3" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /test/cli.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var path = require('path') 3 | var spawn = require('child_process').spawn 4 | 5 | var tape = require('tape') 6 | 7 | tape('cli stdin', function (t) { 8 | t.plan(1) 9 | spawnStylefmt([], readFixture('at-media/at-media.css'), function (err, output) { 10 | if (err) { 11 | t.end(err) 12 | return 13 | } 14 | t.equal(output, readFixture('at-media/at-media.out.css')) 15 | t.end() 16 | }) 17 | }) 18 | 19 | tape('cli input file option', function (t) { 20 | t.plan(1) 21 | 22 | var tempFile = fixturesPath('at-media/at-media.copy.css') 23 | fs.writeFileSync(tempFile, readFixture('at-media/at-media.css'), 'utf-8') 24 | 25 | spawnStylefmt([tempFile], null, function (err) { 26 | if (err) { 27 | t.end(err) 28 | return 29 | } 30 | 31 | var output = fs.readFileSync(tempFile, 'utf-8') 32 | t.equal(output, readFixture('at-media/at-media.out.css')) 33 | fs.unlinkSync(tempFile) 34 | t.end() 35 | }) 36 | }) 37 | 38 | tape('cli output file option', function (t) { 39 | t.plan(1) 40 | var tempFile = fixturesPath('at-media/at-media.copy.css') 41 | spawnStylefmt([fixturesPath('at-media/at-media.css'), tempFile], null, function (err) { 42 | if (err) { 43 | t.end(err) 44 | return 45 | } 46 | 47 | try { 48 | fs.statSync(tempFile) 49 | } catch (err) { 50 | t.error(err, 'output file not found') 51 | t.end() 52 | return 53 | } 54 | 55 | var output = fs.readFileSync(tempFile, 'utf-8') 56 | t.equal(output, readFixture('at-media/at-media.out.css')) 57 | fs.unlinkSync(tempFile) 58 | t.end() 59 | }) 60 | }) 61 | 62 | tape('cli diff option', function (t) { 63 | t.plan(1) 64 | 65 | var cssFile = fixturesPath('at-media/at-media.css') 66 | 67 | spawnStylefmt([cssFile, '--diff'], null, function (err, output) { 68 | if (err) { 69 | t.end(err) 70 | return 71 | } 72 | 73 | t.equal(output.trim(), cssFile + '\n' + readFixture('at-media/at-media.out.css').trim()) 74 | t.end() 75 | }) 76 | }) 77 | 78 | tape('cli stdin with diff option', function (t) { 79 | t.plan(1) 80 | 81 | var cssFile = fixturesPath('at-media/at-media.css') 82 | 83 | spawnStylefmt(['--diff'], fs.readFileSync(cssFile, 'utf-8'), function (err, output) { 84 | if (err) { 85 | t.end(err) 86 | return 87 | } 88 | 89 | t.equal(output.trim(), readFixture('at-media/at-media.out.css').trim()) 90 | t.end() 91 | }) 92 | }) 93 | 94 | tape('cli globs option', function (t) { 95 | t.plan(1) 96 | spawnStylefmt(['--recursive', 'test/recursive/**/*.css', '--diff'], null, function (err, output) { 97 | if (err) { 98 | t.end(err) 99 | return 100 | } 101 | t.equal(output.trim(), 'test/recursive/bar.css\nThere is no difference with the original file.\n\ntest/recursive/foo.css\nThere is no difference with the original file.\n\ntest/recursive/foo/foo.css\nThere is no difference with the original file.') 102 | t.end() 103 | }) 104 | }) 105 | 106 | tape('cli ignore option', function (t) { 107 | t.plan(1) 108 | var filename = path.join(__dirname, 'ignore/ignore.css') 109 | var configFile = path.join(__dirname, 'ignore/.stylelintrc') 110 | var code = fs.readFileSync(filename, 'utf-8') 111 | spawnStylefmt(['--stdin-filename', filename, '--config', configFile], code, function (err, output) { 112 | if (err) { 113 | t.end(err) 114 | return 115 | } 116 | 117 | t.equal(output, code) 118 | t.end() 119 | }) 120 | }) 121 | 122 | function fixturesPath (filename) { 123 | return path.join(__dirname, 'fixtures', filename) 124 | } 125 | 126 | function readFixture (filename) { 127 | return fs.readFileSync(fixturesPath(filename), 'utf-8') 128 | } 129 | 130 | function spawnStylefmt (options, input, callback) { 131 | var args = [ 132 | path.join(__dirname, '../bin/cli.js') 133 | ].concat(options).concat('--no-color') 134 | 135 | var child = spawn('node', args, { 136 | stdio: ['pipe', 'pipe', 'pipe'] 137 | }) 138 | 139 | var output = '' 140 | child.stdout.on('data', function (data) { 141 | output += data.toString() 142 | }) 143 | 144 | var error = '' 145 | child.stderr.on('data', function (data) { 146 | error += data.toString() 147 | }) 148 | 149 | child.on('exit', function () { 150 | if (error) { 151 | callback(new Error(error)) 152 | return 153 | } 154 | callback(null, output) 155 | }) 156 | 157 | if (input) { 158 | child.stdin.write(input) 159 | child.stdin.end() 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /test/css-modules/value/value.css: -------------------------------------------------------------------------------- 1 | @value myValue: #fff; 2 | -------------------------------------------------------------------------------- /test/css-modules/value/value.out.css: -------------------------------------------------------------------------------- 1 | @value myValue: #fff; 2 | -------------------------------------------------------------------------------- /test/fixtures/at-apply/at-apply.css: -------------------------------------------------------------------------------- 1 | .toolbar{@apply --toolbar-theme ; 2 | } 3 | -------------------------------------------------------------------------------- /test/fixtures/at-apply/at-apply.out.css: -------------------------------------------------------------------------------- 1 | .toolbar { 2 | @apply --toolbar-theme; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/at-media/at-media.css: -------------------------------------------------------------------------------- 1 | @media ( max-width:600px ) {} 2 | @media ( min-width:700px) and ( orientation: landscape){} 3 | @media (min-width: 700px), handheld and (orientation: landscape) {} 4 | @media not all and ( monochrome ) {} 5 | @media ( not all ) and ( monochrome ) {} 6 | @media ( not ( screen and ( color ) ) ) , print and ( color ){} 7 | @media screen and ( device-aspect-ratio: 16/9 ), screen and (device-aspect-ratio:16/10 ) {} 8 | 9 | @media ( -webkit-min-device-pixel-ratio:2), 10 | (min--moz-device-pixel-ratio: 2 ), 11 | (min-resolution: 2dppx), 12 | (min-resolution: 192dpi ){} 13 | -------------------------------------------------------------------------------- /test/fixtures/at-media/at-media.out.css: -------------------------------------------------------------------------------- 1 | @media (max-width: 600px) { 2 | } 3 | 4 | @media (min-width: 700px) and ( orientation: landscape) { 5 | } 6 | 7 | @media (min-width: 700px), handheld and (orientation: landscape) { 8 | } 9 | 10 | @media not all and (monochrome) { 11 | } 12 | 13 | @media (not all) and ( monochrome) { 14 | } 15 | 16 | @media (not ( screen and ( color))), print and ( color) { 17 | } 18 | 19 | @media screen and (device-aspect-ratio: 16/9), screen and (device-aspect-ratio: 16/10) { 20 | } 21 | 22 | @media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (min-resolution: 2dppx), (min-resolution: 192dpi) { 23 | } 24 | -------------------------------------------------------------------------------- /test/fixtures/attr-selector/attr-selector.css: -------------------------------------------------------------------------------- 1 | [ data-sizes~="m:0" ] { 2 | color:pink; 3 | } 4 | 5 | [ class*="test" ]{ 6 | color: silver} 7 | -------------------------------------------------------------------------------- /test/fixtures/attr-selector/attr-selector.out.css: -------------------------------------------------------------------------------- 1 | [data-sizes~="m:0"] { 2 | color: pink; 3 | } 4 | 5 | [class*="test"] { 6 | color: silver; 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/charset-2/charset-2.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8" ; 2 | -------------------------------------------------------------------------------- /test/fixtures/charset-2/charset-2.out.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | -------------------------------------------------------------------------------- /test/fixtures/charset/charset.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | -------------------------------------------------------------------------------- /test/fixtures/charset/charset.out.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | -------------------------------------------------------------------------------- /test/fixtures/color-hex-lowercase/color-hex-lowercase.css: -------------------------------------------------------------------------------- 1 | .foo{color:#ABCDEF} 2 | -------------------------------------------------------------------------------- /test/fixtures/color-hex-lowercase/color-hex-lowercase.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | color: #abcdef; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/comment-in-rules/comment-in-rules.css: -------------------------------------------------------------------------------- 1 | .class 2 | {display: inline-block; 3 | /* comment */ 4 | float: left;} 5 | 6 | #id { 7 | font-size: 12px; 8 | 9 | /* colors */ 10 | 11 | color: pink; 12 | background: #fff; 13 | } 14 | -------------------------------------------------------------------------------- /test/fixtures/comment-in-rules/comment-in-rules.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | display: inline-block; 3 | /* comment */ 4 | float: left; 5 | } 6 | 7 | #id { 8 | font-size: 12px; 9 | 10 | /* colors */ 11 | 12 | color: pink; 13 | background: #fff; 14 | } 15 | -------------------------------------------------------------------------------- /test/fixtures/comment/comment.css: -------------------------------------------------------------------------------- 1 | /** 2 | * comment 3 | */ 4 | 5 | .class 6 | { 7 | padding:10px; } 8 | /*comment*/ 9 | 10 | 11 | .foo{color:red 12 | } 13 | 14 | 15 | /* 16 | at rule 17 | */ 18 | 19 | 20 | @media only screen { 21 | /* inner at rule comment */ 22 | .foo { display: none; } 23 | 24 | /* 25 | * another comment 26 | */ 27 | /* in a row */ 28 | 29 | .bar { 30 | color:yellow; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/fixtures/comment/comment.out.css: -------------------------------------------------------------------------------- 1 | /** 2 | * comment 3 | */ 4 | 5 | .class { 6 | padding: 10px; 7 | } 8 | /*comment*/ 9 | 10 | 11 | .foo { 12 | color: red; 13 | } 14 | 15 | 16 | /* 17 | at rule 18 | */ 19 | 20 | 21 | @media only screen { 22 | /* inner at rule comment */ 23 | .foo { 24 | display: none; 25 | } 26 | 27 | /* 28 | * another comment 29 | */ 30 | /* in a row */ 31 | 32 | .bar { 33 | color: yellow; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/fixtures/content/content.css: -------------------------------------------------------------------------------- 1 | div {content: " test 1/2 "; content:' test 1+2'; 2 | } 3 | -------------------------------------------------------------------------------- /test/fixtures/content/content.out.css: -------------------------------------------------------------------------------- 1 | div { 2 | content: " test 1/2 "; 3 | content: ' test 1+2'; 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/cssnext-example/cssnext-example.css: -------------------------------------------------------------------------------- 1 | /* custom properties */ 2 | :root{--fontSize: 1rem; 3 | --mainColor :#12345678; 4 | --highlightColor:hwb(190, 35%, 20%); 5 | } 6 | 7 | /* custom media queries */ 8 | @custom-media 9 | 10 | --viewport-medium(width<=50rem); 11 | 12 | /* some var() & calc() */ 13 | body{color:var(--mainColor); 14 | font-size:var(--fontSize); 15 | line-height: calc(var(--fontSize) * 1.5); 16 | padding: calc((var(--fontSize) / 2) + 1px)} 17 | 18 | /* custom media query usage */ 19 | @media (--viewport-medium) { 20 | body {font-size: calc(var(--fontSize) * 1.2); } 21 | } 22 | /* custom selectors */ 23 | @custom-selector :--heading h1,h2,h3, h4,h5,h6; 24 | :--heading { margin-top:0 } 25 | 26 | /* colors stuff */ 27 | a{ 28 | color:var(--highlightColor); 29 | transition:color 1s; 30 | } 31 | a:hover{color :gray(255,50%) } 32 | a:active{color : rebeccapurple } 33 | a:any-link { color:color(var(--highlightColor) blackness(+20%)) } 34 | 35 | /* font stuff */ 36 | h2 {font-variant-caps:small-caps; 37 | }table{font-variant-numeric: lining-nums; 38 | } 39 | /* filters */ 40 | .blur{filter:blur(4px)}.sepia{ 41 | filter: sepia(.8);} 42 | -------------------------------------------------------------------------------- /test/fixtures/cssnext-example/cssnext-example.out.css: -------------------------------------------------------------------------------- 1 | /* custom properties */ 2 | :root { 3 | --fontSize: 1rem; 4 | --mainColor: #12345678; 5 | --highlightColor: hwb(190, 35%, 20%); 6 | } 7 | 8 | /* custom media queries */ 9 | @custom-media --viewport-medium (width <= 50rem); 10 | 11 | /* some var() & calc() */ 12 | body { 13 | color: var(--mainColor); 14 | font-size: var(--fontSize); 15 | line-height: calc(var(--fontSize) * 1.5); 16 | padding: calc((var(--fontSize) / 2) + 1px); 17 | } 18 | 19 | /* custom media query usage */ 20 | @media (--viewport-medium) { 21 | body { 22 | font-size: calc(var(--fontSize) * 1.2); 23 | } 24 | } 25 | /* custom selectors */ 26 | @custom-selector :--heading h1, h2, h3, h4, h5, h6; 27 | 28 | :--heading { 29 | margin-top: 0; 30 | } 31 | 32 | /* colors stuff */ 33 | a { 34 | color: var(--highlightColor); 35 | transition: color 1s; 36 | } 37 | 38 | a:hover { 39 | color: gray(255, 50%); 40 | } 41 | 42 | a:active { 43 | color: rebeccapurple; 44 | } 45 | 46 | a:any-link { 47 | color: color(var(--highlightColor) blackness(+20%)); 48 | } 49 | 50 | /* font stuff */ 51 | h2 { 52 | font-variant-caps: small-caps; 53 | } 54 | 55 | table { 56 | font-variant-numeric: lining-nums; 57 | } 58 | /* filters */ 59 | .blur { 60 | filter: blur(4px); 61 | } 62 | 63 | .sepia { 64 | filter: sepia(.8); 65 | } 66 | -------------------------------------------------------------------------------- /test/fixtures/custom-media-queries/custom-media-queries.css: -------------------------------------------------------------------------------- 1 | @custom-media --small-viewport ( max-width:30em ) 2 | 3 | 4 | ; 5 | 6 | @media ( --small-viewport ){ 7 | .rule{color:blue;} 8 | } 9 | -------------------------------------------------------------------------------- /test/fixtures/custom-media-queries/custom-media-queries.out.css: -------------------------------------------------------------------------------- 1 | @custom-media --small-viewport (max-width: 30em); 2 | 3 | @media (--small-viewport) { 4 | .rule { 5 | color: blue; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/custom-properties/custom-properties.css: -------------------------------------------------------------------------------- 1 | :root{--mainColor:#123456} 2 | a{color:var ( --mainColor ) ; } 3 | -------------------------------------------------------------------------------- /test/fixtures/custom-properties/custom-properties.out.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --mainColor: #123456; 3 | } 4 | 5 | a { 6 | color: var(--mainColor); 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/custom-selectors/custom-selectors.css: -------------------------------------------------------------------------------- 1 | @custom-selector :--button button,.button; 2 | @custom-selector :--enter :hover,:focus ; 3 | 4 | :--button {display: inline-block; 5 | }:--button:--enter{ 6 | text-decoration:underline; 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/custom-selectors/custom-selectors.out.css: -------------------------------------------------------------------------------- 1 | @custom-selector :--button button, .button; 2 | 3 | @custom-selector :--enter :hover, :focus; 4 | 5 | :--button { 6 | display: inline-block; 7 | } 8 | 9 | :--button:--enter { 10 | text-decoration: underline; 11 | } 12 | -------------------------------------------------------------------------------- /test/fixtures/data-url/data-url.css: -------------------------------------------------------------------------------- 1 | div { 2 | background-image: url(data:image/png;base64,iVBORw0KGg); 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/data-url/data-url.out.css: -------------------------------------------------------------------------------- 1 | div { 2 | background-image: url(data:image/png;base64,iVBORw0KGg); 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/font-face/font-face.css: -------------------------------------------------------------------------------- 1 | @font-face {font-family:'HelveticaNeueW02-45Ligh';src:url("/fonts/pictos-web.eot");src:local("☺"),url("/fonts/pictos-web.woff") format("woff"),url("/fonts/pictos-web.ttf") format("truetype"),url("/fonts/pictos-web.svg#webfontIyfZbseF") format("svg");font-weight:normal;font-style:normal;} 2 | -------------------------------------------------------------------------------- /test/fixtures/font-face/font-face.out.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'HelveticaNeueW02-45Ligh'; 3 | src: url("/fonts/pictos-web.eot"); 4 | src: local("☺"), url("/fonts/pictos-web.woff") format("woff"), url("/fonts/pictos-web.ttf") format("truetype"), url("/fonts/pictos-web.svg#webfontIyfZbseF") format("svg"); 5 | font-weight: normal; 6 | font-style: normal; 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/font-shorthand/font-shorthand.css: -------------------------------------------------------------------------------- 1 | .class { 2 | font: normal normal 24px/1 "myfont";font: normal normal normal 12px/20px myfont; 3 | font:normal 300 0.875em/1.3 "myfont", sans-serif; 4 | } 5 | -------------------------------------------------------------------------------- /test/fixtures/font-shorthand/font-shorthand.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | font: normal normal 24px/1 "myfont"; 3 | font: normal normal normal 12px/20px myfont; 4 | font: normal 300 0.875em/1.3 "myfont", sans-serif; 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/ie-hacks/ie-hacks.css: -------------------------------------------------------------------------------- 1 | * html p {font-size: 5em; } 2 | .class { 3 | *zoom: 1;_width: 200px; 4 | +color:red; 5 | *+color:red; 6 | color:red\9; 7 | color:red\0; 8 | color:red\9\0; 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/ie-hacks/ie-hacks.out.css: -------------------------------------------------------------------------------- 1 | * html p { 2 | font-size: 5em; 3 | } 4 | 5 | .class { 6 | *zoom: 1; 7 | _width: 200px; 8 | +color: red; 9 | *+color: red; 10 | color: red\9; 11 | color: red\0; 12 | color: red\9\0; 13 | } 14 | -------------------------------------------------------------------------------- /test/fixtures/import/import.css: -------------------------------------------------------------------------------- 1 | @import "./settings" ; 2 | 3 | 4 | @import "./components" ;@import "./themes"; 5 | .class{float: left; 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/import/import.out.css: -------------------------------------------------------------------------------- 1 | @import "./settings"; 2 | @import "./components"; 3 | @import "./themes"; 4 | 5 | .class { 6 | float: left; 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/important/important.css: -------------------------------------------------------------------------------- 1 | .class { 2 | color: red ! important; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/important/important.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | color: red !important; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/inline-comment/inline-comment.css: -------------------------------------------------------------------------------- 1 | 2 | // inline comments 3 | 4 | 5 | 6 | .class {color: red;} 7 | -------------------------------------------------------------------------------- /test/fixtures/inline-comment/inline-comment.out.css: -------------------------------------------------------------------------------- 1 | 2 | // inline comments 3 | 4 | 5 | 6 | .class { 7 | color: red; 8 | } 9 | -------------------------------------------------------------------------------- /test/fixtures/lowercase/lowercase.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | 3 | $myVar: TRANSLATEX(0); 4 | $myVar2: RGB(255,255,255); 5 | $myVar3: MAROON; 6 | $myVar4: HSLA(120,100%,50%,0.3); 7 | $myVar5: RGBA(0,0,0,0.5); 8 | $myVar6: HSL(120,100%,50%); 9 | $myVar7: linear-gradient(to right, RGBA(0,0,0,0.5), RGB(255,255,255)); 10 | 11 | .class-1 { 12 | BACKGROUND: HSL(120, 100%, 50%); 13 | BACKGROUND: linear-gradient(to right, $myVar2, RGB(255,255,255)); 14 | COLOR: RGB(0, 0, 0); 15 | TRANSFORM: TRANSLATE(0,0) TRANSLATEX(0) TRANSLATEY(0) TRANSLATEZ(0) TRANSLATE3D(0,0,0) MATRIX(1,1,1,1); 16 | TRANSFORM: TRANSLATE(0,0); 17 | TRANSFORM: TRANSLATEX(0); 18 | TRANSFORM: TRANSLATEY(0); 19 | TRANSFORM: TRANSLATE3D(0,0,0); 20 | TRANSFORM: MATRIX(1,1,1,1); 21 | transform: translateY(0) $myVar; 22 | animation: textAnimation 0.1s; 23 | animation: tAnimation 0.1s; 24 | } 25 | 26 | .class-2 { 27 | BACKGROUND-COLOR: INDIGO; 28 | BACKGROUND: HSLA(120, 100%, 50%, 0.3); 29 | COLOR: RGBA(0, 0, 0, 0.5); 30 | TRANSFORM: ROTATE(1deg) ROTATEX(1deg) ROTATEY(1deg) ROTATEZ(1deg) ROTATE3D(0,0,1,1deg) SKEW(1deg) SKEWX(1deg) SKEWY(1deg) SCALE(1, 1) SCALEX(1) SCALEY(1); 31 | TRANSFORM: ROTATE(1deg); 32 | TRANSFORM: ROTATEX(1deg); 33 | TRANSFORM: ROTATEY(1deg); 34 | TRANSFORM: ROTATEZ(1deg); 35 | TRANSFORM: ROTATE3D(0,0,1,1deg); 36 | TRANSFORM: SKEW(1deg); 37 | TRANSFORM: SKEWX(1deg); 38 | TRANSFORM: SKEWY(1deg); 39 | TRANSFORM: SCALE(1, 1); 40 | TRANSFORM: SCALEX(1); 41 | TRANSFORM: SCALEY(1); 42 | } 43 | -------------------------------------------------------------------------------- /test/fixtures/lowercase/lowercase.out.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | $myVar: translateX(0); 3 | $myVar2: rgb(255, 255, 255); 4 | $myVar3: maroon; 5 | $myVar4: hsla(120, 100%, 50%, 0.3); 6 | $myVar5: rgba(0, 0, 0, 0.5); 7 | $myVar6: hsl(120, 100%, 50%); 8 | $myVar7: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgb(255, 255, 255)); 9 | 10 | .class-1 { 11 | background: hsl(120, 100%, 50%); 12 | background: linear-gradient(to right, $myVar2, rgb(255, 255, 255)); 13 | color: rgb(0, 0, 0); 14 | transform: translate(0, 0) translateX(0) translateY(0) translateZ(0) translate3d(0, 0, 0) matrix(1, 1, 1, 1); 15 | transform: translate(0, 0); 16 | transform: translateX(0); 17 | transform: translateY(0); 18 | transform: translate3d(0, 0, 0); 19 | transform: matrix(1, 1, 1, 1); 20 | transform: translateY(0) $myVar; 21 | animation: textAnimation 0.1s; 22 | animation: tAnimation 0.1s; 23 | } 24 | 25 | .class-2 { 26 | background-color: indigo; 27 | background: hsla(120, 100%, 50%, 0.3); 28 | color: rgba(0, 0, 0, 0.5); 29 | transform: rotate(1deg) rotateX(1deg) rotateY(1deg) rotateZ(1deg) rotate3d(0, 0, 1, 1deg) skew(1deg) skewX(1deg) skewY(1deg) scale(1, 1) scaleX(1) scaleY(1); 30 | transform: rotate(1deg); 31 | transform: rotateX(1deg); 32 | transform: rotateY(1deg); 33 | transform: rotateZ(1deg); 34 | transform: rotate3d(0, 0, 1, 1deg); 35 | transform: skew(1deg); 36 | transform: skewX(1deg); 37 | transform: skewY(1deg); 38 | transform: scale(1, 1); 39 | transform: scaleX(1); 40 | transform: scaleY(1); 41 | } 42 | -------------------------------------------------------------------------------- /test/fixtures/media-indent-with-import/media-indent-with-import.css: -------------------------------------------------------------------------------- 1 | @import "foo";@import "bar"; 2 | .wrapper { 3 | @media (min-width: 1025px) { 4 | max-width: 600px; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/media-indent-with-import/media-indent-with-import.out.css: -------------------------------------------------------------------------------- 1 | @import "foo"; 2 | @import "bar"; 3 | 4 | .wrapper { 5 | @media (min-width: 1025px) { 6 | max-width: 600px; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/fixtures/media-indent/media-indent.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | @media(max-width:1000px) 3 | { 4 | display: none; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/media-indent/media-indent.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | @media (max-width: 1000px) { 3 | display: none; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/media-queries-ranges/media-queries-ranges.css: -------------------------------------------------------------------------------- 1 | @media (width >= 500px) and (width <= 1200px) { 2 | .rule {color:red;} 3 | } 4 | @custom-media --only-medium-screen ( width >=500px ) and (width<= 1200px ) ; 5 | @media ( --only-medium-screen ){ 6 | .rule{color:blue;}} 7 | -------------------------------------------------------------------------------- /test/fixtures/media-queries-ranges/media-queries-ranges.out.css: -------------------------------------------------------------------------------- 1 | @media (width >= 500px) and (width <= 1200px) { 2 | .rule { 3 | color: red; 4 | } 5 | } 6 | 7 | @custom-media --only-medium-screen (width >= 500px) and (width <= 1200px); 8 | 9 | @media (--only-medium-screen) { 10 | .rule { 11 | color: blue; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/fixtures/nested-2/nested-2.css: -------------------------------------------------------------------------------- 1 | .btn {&:hover { 2 | color: red; 3 | }&:active { 4 | color:blue;} &:nth-child(5n+1) { 5 | color:blue; 6 | } 7 | &:nth-child(-n+3) { color: green;} 8 | > li > a { color: red} >li>li { 9 | color: blue; 10 | } 11 | > p + p { 12 | color: green; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/fixtures/nested-2/nested-2.out.css: -------------------------------------------------------------------------------- 1 | .btn { 2 | &:hover { 3 | color: red; 4 | } 5 | 6 | &:active { 7 | color: blue; 8 | } 9 | 10 | &:nth-child(5n+1) { 11 | color: blue; 12 | } 13 | 14 | &:nth-child(-n+3) { 15 | color: green; 16 | } 17 | 18 | > li > a { 19 | color: red; 20 | } 21 | 22 | > li > li { 23 | color: blue; 24 | } 25 | 26 | > p + p { 27 | color: green; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/fixtures/nested-atrule/nested-atrule.css: -------------------------------------------------------------------------------- 1 | @media (min-width: 992px){@media (max-width: 1200px) { 2 | .container 3 | 4 | {position: absolute 5 | }} 6 | } 7 | -------------------------------------------------------------------------------- /test/fixtures/nested-atrule/nested-atrule.out.css: -------------------------------------------------------------------------------- 1 | @media (min-width: 992px) { 2 | @media (max-width: 1200px) { 3 | .container { 4 | position: absolute; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/fixtures/nested-indention-2/nested-indention-2.css: -------------------------------------------------------------------------------- 1 | .y-photo-grid{ 2 | display: flex; 3 | width: 100%; 4 | margin: 0; 5 | padding: 0; 6 | flex-direction: column; 7 | align-items: stretch; 8 | justify-content: flex-start; 9 | 10 | &__row, &__item, &__link, &__image{ 11 | display: flex; 12 | width: 100%; 13 | margin: 0; 14 | padding: 0; 15 | flex-direction: row; 16 | align-items: center; 17 | justify-content: flex-start; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/fixtures/nested-indention-2/nested-indention-2.out.css: -------------------------------------------------------------------------------- 1 | .y-photo-grid { 2 | display: flex; 3 | width: 100%; 4 | margin: 0; 5 | padding: 0; 6 | flex-direction: column; 7 | align-items: stretch; 8 | justify-content: flex-start; 9 | 10 | &__row 11 | , 12 | &__item 13 | , 14 | &__link 15 | , 16 | &__image { 17 | display: flex; 18 | width: 100%; 19 | margin: 0; 20 | padding: 0; 21 | flex-direction: row; 22 | align-items: center; 23 | justify-content: flex-start; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/fixtures/nested-indention-2/stylelint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | 'selector-list-comma-newline-before': 'always', 4 | 'indentation': 4 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /test/fixtures/nested-indention/nested-indention.css: -------------------------------------------------------------------------------- 1 | .y-photo-grid 2 | { 3 | display: flex; 4 | width: 100%; 5 | margin: 0; 6 | padding: 0; 7 | flex-direction: column; 8 | align-items: stretch; 9 | justify-content: flex-start; 10 | 11 | &__row 12 | { 13 | display: flex; 14 | width: 100%; 15 | margin: 0; 16 | padding: 0; 17 | flex-direction: row; 18 | align-items: center; 19 | justify-content: flex-start; 20 | } 21 | 22 | &__item 23 | { 24 | display: block; 25 | margin: 0; 26 | background: #eee; 27 | 28 | &:first-child 29 | { 30 | margin-left: 0; 31 | } 32 | } 33 | 34 | &__link 35 | { 36 | display: block; 37 | height: 100%; 38 | width: 100%; 39 | } 40 | 41 | &__image 42 | { 43 | width: 100%; 44 | height: 100%; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/fixtures/nested-indention/nested-indention.out.css: -------------------------------------------------------------------------------- 1 | .y-photo-grid 2 | { 3 | display: flex; 4 | width: 100%; 5 | margin: 0; 6 | padding: 0; 7 | flex-direction: column; 8 | align-items: stretch; 9 | justify-content: flex-start; 10 | 11 | &__row 12 | { 13 | display: flex; 14 | width: 100%; 15 | margin: 0; 16 | padding: 0; 17 | flex-direction: row; 18 | align-items: center; 19 | justify-content: flex-start; 20 | } 21 | 22 | &__item 23 | { 24 | display: block; 25 | margin: 0; 26 | background: #eee; 27 | 28 | &:first-child 29 | { 30 | margin-left: 0; 31 | } 32 | } 33 | 34 | &__link 35 | { 36 | display: block; 37 | height: 100%; 38 | width: 100%; 39 | } 40 | 41 | &__image 42 | { 43 | width: 100%; 44 | height: 100%; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/fixtures/nested-indention/stylelint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | 'block-opening-brace-newline-before': 'always', 4 | 'block-opening-brace-newline-after': 'always', 5 | 'indentation': 4 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /test/fixtures/nested-mixin-2/nested-mixin-2.css: -------------------------------------------------------------------------------- 1 | @mixin test() { 2 | $values: blue red; 3 | @each $val in $values { 4 | color : $val; 5 | @for $i from 2 through 10 { 6 | background: $i; 7 | } 8 | } 9 | @for $i from 2 through 10 { 10 | color: $i; 11 | } 12 | @while $k > 0 { 13 | color: $k; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /test/fixtures/nested-mixin-2/nested-mixin-2.out.css: -------------------------------------------------------------------------------- 1 | @mixin test() { 2 | $values: blue red; 3 | 4 | @each $val in $values { 5 | color: $val; 6 | 7 | @for $i from 2 through 10 { 8 | background: $i; 9 | } 10 | } 11 | 12 | @for $i from 2 through 10 { 13 | color: $i; 14 | } 15 | 16 | @while $k > 0 { 17 | color: $k; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/fixtures/nested-mixin/nested-mixin.css: -------------------------------------------------------------------------------- 1 | @mixin test() { 2 | $values: blue red; 3 | @each $val in $values { 4 | color: $val; 5 | @for $i from 2 through 10 { 6 | background: $i; 7 | } 8 | } 9 | @for $i from 2 through 10 { 10 | color: $i; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/fixtures/nested-mixin/nested-mixin.out.css: -------------------------------------------------------------------------------- 1 | @mixin test() { 2 | $values: blue red; 3 | 4 | @each $val in $values { 5 | color: $val; 6 | 7 | @for $i from 2 through 10 { 8 | background: $i; 9 | } 10 | } 11 | 12 | @for $i from 2 through 10 { 13 | color: $i; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/fixtures/nested/nested.css: -------------------------------------------------------------------------------- 1 | .foo {font-size :12px ; 2 | 3 | 4 | >.nested-1 5 | 6 | { 7 | padding: 10px; .nested-2-1{ 8 | color : red ; 9 | } 10 | + .nested-2-2 { 11 | color:blue; }} 12 | 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/fixtures/nested/nested.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | font-size: 12px; 3 | 4 | > .nested-1 { 5 | padding: 10px; 6 | 7 | .nested-2-1 { 8 | color: red; 9 | } 10 | 11 | + .nested-2-2 { 12 | color: blue; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/fixtures/non-nested-combinator/non-nested-combinator.css: -------------------------------------------------------------------------------- 1 | .card-meta { 2 | @include padding(null 1rem 1rem);background-color: $card-base-background-color; 3 | color: $meta-font-color; 4 | .card-content--with-image+& 5 | {padding-top: 1rem; 6 | }a { 7 | color: inherit; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/non-nested-combinator/non-nested-combinator.out.css: -------------------------------------------------------------------------------- 1 | .card-meta { 2 | @include padding(null 1rem 1rem); 3 | background-color: $card-base-background-color; 4 | color: $meta-font-color; 5 | 6 | .card-content--with-image + & { 7 | padding-top: 1rem; 8 | } 9 | 10 | a { 11 | color: inherit; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/fixtures/pseudo-element/pseudo-element.css: -------------------------------------------------------------------------------- 1 | a:after { content:"" } 2 | a::before { content:"" } 3 | 4 | -------------------------------------------------------------------------------- /test/fixtures/pseudo-element/pseudo-element.out.css: -------------------------------------------------------------------------------- 1 | a:after { 2 | content: ""; 3 | } 4 | 5 | a::before { 6 | content: ""; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /test/fixtures/readme/readme.css: -------------------------------------------------------------------------------- 1 | // mixin for clearfix 2 | @mixin clearfix () { &:before, 3 | &:after { 4 | content:" "; 5 | display : table; } 6 | 7 | &:after {clear: both;} 8 | }.class 9 | { 10 | padding:10px;@include clearfix();} 11 | .base { color: red; } // placeholder 12 | 13 | %base 14 | { 15 | 16 | 17 | padding: 12px 18 | } 19 | 20 | .foo{ 21 | @extend .base;} 22 | 23 | .bar 24 | { @extend %base; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /test/fixtures/readme/readme.out.css: -------------------------------------------------------------------------------- 1 | // mixin for clearfix 2 | @mixin clearfix() { 3 | &:before, 4 | &:after { 5 | content: " "; 6 | display: table; 7 | } 8 | 9 | &:after { 10 | clear: both; 11 | } 12 | } 13 | 14 | .class { 15 | padding: 10px; 16 | @include clearfix(); 17 | } 18 | 19 | .base { 20 | color: red; 21 | } // placeholder 22 | 23 | %base { 24 | padding: 12px; 25 | } 26 | 27 | .foo { 28 | @extend .base; 29 | } 30 | 31 | .bar { 32 | @extend %base; 33 | } 34 | -------------------------------------------------------------------------------- /test/fixtures/shorthand-with-sass-variables/shorthand-with-sass-variables.css: -------------------------------------------------------------------------------- 1 | .class{border:1px solid $color; 2 | } 3 | -------------------------------------------------------------------------------- /test/fixtures/shorthand-with-sass-variables/shorthand-with-sass-variables.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | border: 1px solid $color; 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/values/values.css: -------------------------------------------------------------------------------- 1 | .class { 2 | background:linear-gradient(to bottom right,white,hsla(0,0%,100%,.8)); 3 | border: 1px solid rgba(0,0,0,.3); 4 | font-family: Arial , sans-serif; 5 | color: rgba(0, 0, 0, 1); 6 | margin: 0 20px 0 -24px; 7 | background-position:20% -26px; 8 | transform-style: preserve-3d; 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/values/values.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | background: linear-gradient(to bottom right, white, hsla(0, 0%, 100%, .8)); 3 | border: 1px solid rgba(0, 0, 0, .3); 4 | font-family: Arial, sans-serif; 5 | color: rgba(0, 0, 0, 1); 6 | margin: 0 20px 0 -24px; 7 | background-position: 20% -26px; 8 | transform-style: preserve-3d; 9 | } 10 | -------------------------------------------------------------------------------- /test/fixtures/var-notation/var-notation.css: -------------------------------------------------------------------------------- 1 | .foo {margin:var ( --n-gutterSize) 0 var ( --gutterSize ) var( --n-gutterSize ); 2 | } 3 | -------------------------------------------------------------------------------- /test/fixtures/var-notation/var-notation.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | margin: var(--n-gutterSize) 0 var(--gutterSize) var(--n-gutterSize); 3 | } 4 | -------------------------------------------------------------------------------- /test/fixtures/vendor-prefix/vendor-prefix.css: -------------------------------------------------------------------------------- 1 | .class 2 | {-webkit-box-sizing:border-box;box-sizing:border-box 3 | 4 | 5 | } 6 | -------------------------------------------------------------------------------- /test/fixtures/vendor-prefix/vendor-prefix.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | -webkit-box-sizing: border-box; 3 | box-sizing: border-box; 4 | } 5 | -------------------------------------------------------------------------------- /test/ignore/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "ignoreFiles": "*", 3 | "extends": "./extend-stylelint.js" 4 | } 5 | -------------------------------------------------------------------------------- /test/ignore/extend-stylelint.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "rules": { 3 | "at-rule-empty-line-before": [ "always", { 4 | except: [ "blockless-group" ] 5 | } ], 6 | "at-rule-name-case": "lower", 7 | "at-rule-name-space-after": "always-single-line", 8 | "at-rule-semicolon-newline-after": "always", 9 | "block-closing-brace-newline-after": "always", 10 | "block-closing-brace-newline-before": "always-multi-line", 11 | "block-closing-brace-space-before": "always-single-line", 12 | "block-no-empty": true, 13 | "block-opening-brace-newline-after": "always-multi-line", 14 | "block-opening-brace-space-after": "always-single-line", 15 | "block-opening-brace-space-before": "always", 16 | "color-hex-case": "lower", 17 | "color-hex-length": "short", 18 | "color-no-invalid-hex": true, 19 | "comment-empty-line-before": [ "always", { 20 | except: ["first-nested"], 21 | ignore: ["stylelint-commands"], 22 | } ], 23 | "comment-whitespace-inside": "always", 24 | "declaration-bang-space-after": "never", 25 | "declaration-bang-space-before": "always", 26 | "declaration-block-no-ignored-properties": true, 27 | "declaration-block-no-shorthand-property-overrides": true, 28 | "declaration-block-semicolon-newline-after": "always-multi-line", 29 | "declaration-block-semicolon-space-after": "always-single-line", 30 | "declaration-block-semicolon-space-before": "never", 31 | "declaration-block-single-line-max-declarations": 1, 32 | "declaration-block-trailing-semicolon": "always", 33 | "declaration-colon-newline-after": "always-multi-line", 34 | "declaration-colon-space-after": "always-single-line", 35 | "declaration-colon-space-before": "never", 36 | "function-calc-no-unspaced-operator": true, 37 | "function-comma-newline-after": "always-multi-line", 38 | "function-comma-space-after": "always-single-line", 39 | "function-comma-space-before": "never", 40 | "function-linear-gradient-no-nonstandard-direction": true, 41 | "function-max-empty-lines": 0, 42 | "function-name-case": "lower", 43 | "function-parentheses-newline-inside": "always-multi-line", 44 | "function-parentheses-space-inside": "never-single-line", 45 | "function-whitespace-after": "always", 46 | "indentation": 2, 47 | "max-empty-lines": 1, 48 | "media-feature-colon-space-after": "always", 49 | "media-feature-colon-space-before": "never", 50 | "media-feature-no-missing-punctuation": true, 51 | "media-feature-range-operator-space-after": "always", 52 | "media-feature-range-operator-space-before": "always", 53 | "media-query-list-comma-newline-after": "always-multi-line", 54 | "media-query-list-comma-space-after": "always-single-line", 55 | "media-query-list-comma-space-before": "never", 56 | "media-feature-parentheses-space-inside": "never", 57 | "no-eol-whitespace": true, 58 | "no-extra-semicolons": true, 59 | "no-invalid-double-slash-comments": true, 60 | "no-missing-end-of-source-newline": true, 61 | "number-leading-zero": "always", 62 | "number-no-trailing-zeros": true, 63 | "length-zero-no-unit": true, 64 | "property-case": "lower", 65 | "rule-non-nested-empty-line-before": [ "always-multi-line", { 66 | ignore: ["after-comment"], 67 | } ], 68 | "selector-attribute-brackets-space-inside": "never", 69 | "selector-attribute-operator-space-after": "never", 70 | "selector-attribute-operator-space-before": "never", 71 | "selector-combinator-space-after": "always", 72 | "selector-combinator-space-before": "always", 73 | "selector-list-comma-newline-after": "always", 74 | "selector-list-comma-space-before": "never", 75 | "selector-max-empty-lines": 0, 76 | "selector-pseudo-class-case": "lower", 77 | "selector-pseudo-class-parentheses-space-inside": "never", 78 | "selector-pseudo-element-case": "lower", 79 | "selector-pseudo-element-colon-notation": "double", 80 | "selector-pseudo-element-no-unknown": true, 81 | "selector-type-case": "lower", 82 | "shorthand-property-no-redundant-values": true, 83 | "string-no-newline": true, 84 | "unit-case": "lower", 85 | "unit-no-unknown": true, 86 | "value-list-comma-newline-after": "always-multi-line", 87 | "value-list-comma-space-after": "always-single-line", 88 | "value-list-comma-space-before": "never", 89 | }, 90 | } 91 | -------------------------------------------------------------------------------- /test/ignore/ignore.css: -------------------------------------------------------------------------------- 1 | a{color: #zzzzzz;} 2 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var path = require('path') 3 | 4 | var tape = require('tape') 5 | 6 | var postcss = require('postcss') 7 | var scss = require('postcss-scss') 8 | var each = require('each-series') 9 | var klaw = require('klaw') 10 | 11 | var stylefmt = require('..') 12 | 13 | var cwd = process.cwd() 14 | var testBaseDirPaths = [ 15 | path.join(cwd, 'test/fixtures'), 16 | path.join(cwd, 'test/sass'), 17 | path.join(cwd, 'test/css-modules'), 18 | path.join(cwd, 'test/stylelint') 19 | ] 20 | 21 | ;(function main () { 22 | walkDirs(testBaseDirPaths).then(function (testDirPaths) { 23 | each(testDirPaths, test) 24 | }).catch(function (err) { 25 | console.trace(err) 26 | }) 27 | })() 28 | 29 | function walkDirs (basePaths) { 30 | var items = [] 31 | var promises = [] 32 | basePaths.forEach(function (basePath) { 33 | var p = new Promise(function (resolve, reject) { 34 | klaw(basePath) 35 | .on('data', function (item) { 36 | if (!fs.statSync(item.path).isDirectory() || basePath === item.path) return 37 | items.push(item.path) 38 | }) 39 | .on('end', resolve) 40 | .on('error', reject) 41 | }) 42 | promises.push(p) 43 | }) 44 | return Promise.all(promises).then(function () { 45 | return items 46 | }) 47 | } 48 | 49 | function test (testDirPath, index, nextTest) { 50 | var testName = path.basename(testDirPath) 51 | var input = fs.readFileSync(path.join(testDirPath, testName + '.css'), 'utf-8') 52 | var expected = fs.readFileSync(path.join(testDirPath, testName + '.out.css'), 'utf-8') 53 | tape(testName, function (t) { 54 | t.plan(1) 55 | process.chdir(testDirPath) 56 | postcss([stylefmt]).process(input, { 57 | syntax: scss 58 | }).then(function (result) { 59 | t.equal(result.css, expected) 60 | t.end() 61 | }).catch(function (err) { 62 | t.end(err) 63 | }) 64 | }).on('end', nextTest) 65 | } 66 | -------------------------------------------------------------------------------- /test/recursive/bar.css: -------------------------------------------------------------------------------- 1 | .bar { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /test/recursive/foo.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | padding: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /test/recursive/foo/foo.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | padding: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /test/recursive/foo/foo.js: -------------------------------------------------------------------------------- 1 | alert(1) 2 | -------------------------------------------------------------------------------- /test/sass/media-indent-with-import/media-indent-with-import.css: -------------------------------------------------------------------------------- 1 | @import "foo";@import "bar"; 2 | .wrapper { 3 | @media (min-width: 1025px) { 4 | max-width: 600px; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/sass/media-indent-with-import/media-indent-with-import.out.css: -------------------------------------------------------------------------------- 1 | @import "foo"; 2 | @import "bar"; 3 | 4 | .wrapper { 5 | @media (min-width: 1025px) { 6 | max-width: 600px; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/sass/media-indent/media-indent.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | @media(max-width:1000px) 3 | { 4 | display: none; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/sass/media-indent/media-indent.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | @media (max-width: 1000px) { 3 | display: none; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/sass/sass-at-root/sass-at-root.css: -------------------------------------------------------------------------------- 1 | @at-root {@-ms-viewport { 2 | width: device-width; 3 | }} 4 | -------------------------------------------------------------------------------- /test/sass/sass-at-root/sass-at-root.out.css: -------------------------------------------------------------------------------- 1 | @at-root { 2 | @-ms-viewport { 3 | width: device-width; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/sass/sass-comment/sass-comment.css: -------------------------------------------------------------------------------- 1 | // foo rule 2 | .foo { 3 | 4 | //red! 5 | color: red; } 6 | 7 | /* comment */ 8 | //multi line 9 | 10 | 11 | 12 | //comment 13 | 14 | 15 | 16 | .bar { 17 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit 18 | // Donec a diam lectus. Sed sit amet ipsum mauris 19 | display: none; 20 | //bar 21 | margin:auto; 22 | } 23 | 24 | @include something; // comment 25 | @extend .something;// comment 26 | -------------------------------------------------------------------------------- /test/sass/sass-comment/sass-comment.out.css: -------------------------------------------------------------------------------- 1 | // foo rule 2 | .foo { 3 | 4 | //red! 5 | color: red; 6 | } 7 | 8 | /* comment */ 9 | //multi line 10 | 11 | 12 | 13 | //comment 14 | 15 | 16 | 17 | .bar { 18 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit 19 | // Donec a diam lectus. Sed sit amet ipsum mauris 20 | display: none; 21 | //bar 22 | margin: auto; 23 | } 24 | 25 | @include something; // comment 26 | @extend .something;// comment 27 | -------------------------------------------------------------------------------- /test/sass/sass-content/sass-content.css: -------------------------------------------------------------------------------- 1 | @mixin apply-to-ie6-only { 2 | * html { @content ;} 3 | } 4 | 5 | @include apply-to-ie6-only { 6 | #logo { background-image: url(/logo.gif); } 7 | } 8 | 9 | 10 | @mixin media($width) { 11 | @media only screen and (max-width: $width) { @content; } 12 | } 13 | 14 | 15 | @include media(320px) { 16 | background: red; 17 | } 18 | -------------------------------------------------------------------------------- /test/sass/sass-content/sass-content.out.css: -------------------------------------------------------------------------------- 1 | @mixin apply-to-ie6-only { 2 | * html { 3 | @content; 4 | } 5 | } 6 | 7 | @include apply-to-ie6-only { 8 | #logo { 9 | background-image: url(/logo.gif); 10 | } 11 | } 12 | 13 | @mixin media($width) { 14 | @media only screen and (max-width: $width) { 15 | @content; 16 | } 17 | } 18 | 19 | @include media(320px) { 20 | background: red; 21 | } 22 | -------------------------------------------------------------------------------- /test/sass/sass-extend/sass-extend.css: -------------------------------------------------------------------------------- 1 | .base { color: red; } 2 | 3 | %base 4 | { 5 | 6 | 7 | padding: 12px 8 | } 9 | 10 | .class { @extend .base;} 11 | 12 | .class { @extend %base;} 13 | -------------------------------------------------------------------------------- /test/sass/sass-extend/sass-extend.out.css: -------------------------------------------------------------------------------- 1 | .base { 2 | color: red; 3 | } 4 | 5 | %base { 6 | padding: 12px; 7 | } 8 | 9 | .class { 10 | @extend .base; 11 | } 12 | 13 | .class { 14 | @extend %base; 15 | } 16 | -------------------------------------------------------------------------------- /test/sass/sass-function-2/sass-function-2.css: -------------------------------------------------------------------------------- 1 | div { 2 | color: blue; 3 | } 4 | @function myFn($var-1,$var-2,$var-3,$var-4,$var-5,$var-6) { 5 | @return $var-1*$var-2/$var-3-($var-4+$var-5)%$var-6; 6 | } 7 | -------------------------------------------------------------------------------- /test/sass/sass-function-2/sass-function-2.out.css: -------------------------------------------------------------------------------- 1 | div { 2 | color: blue; 3 | } 4 | 5 | @function myFn($var-1, $var-2, $var-3, $var-4, $var-5, $var-6) { 6 | @return $var-1 * $var-2 / $var-3 - ($var-4 + $var-5) % $var-6; 7 | } 8 | -------------------------------------------------------------------------------- /test/sass/sass-function/sass-function.css: -------------------------------------------------------------------------------- 1 | @function func($value){@return $value;} 2 | -------------------------------------------------------------------------------- /test/sass/sass-function/sass-function.out.css: -------------------------------------------------------------------------------- 1 | @function func($value) { 2 | @return $value; 3 | } 4 | -------------------------------------------------------------------------------- /test/sass/sass-if-else-2/sass-if-else-2.css: -------------------------------------------------------------------------------- 1 | div { 2 | &:nth-child(1) { 3 | // comment 4 | @if true or ceil (1.2)< 2 or 2>1 or 1<=1 or 2>=2 { 5 | color: blue; 6 | } @else if $i < 0{ 7 | color: red; 8 | }@else if $type==matador { 9 | color: blue; 10 | } @else if $type!=matador { 11 | color: red; 12 | } @else if 2*2+(1-1) { 13 | color: green; 14 | }@else if round (0.2) < 0 { 15 | color: black; 16 | }@else if $var-1+$var-2 { 17 | color: black; 18 | } @else{ 19 | color: green; 20 | } 21 | .nested { 22 | color: black; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/sass/sass-if-else-2/sass-if-else-2.out.css: -------------------------------------------------------------------------------- 1 | div { 2 | &:nth-child(1) { 3 | // comment 4 | @if true or ceil(1.2) < 2 or 2 > 1 or 1 <= 1 or 2 >= 2 { 5 | color: blue; 6 | } @else if $i < 0 { 7 | color: red; 8 | } @else if $type == matador { 9 | color: blue; 10 | } @else if $type != matador { 11 | color: red; 12 | } @else if 2 * 2 + (1 - 1) { 13 | color: green; 14 | } @else if round(0.2) < 0 { 15 | color: black; 16 | } @else if $var-1 + $var-2 { 17 | color: black; 18 | } @else { 19 | color: green; 20 | } 21 | 22 | .nested { 23 | color: black; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/sass/sass-if-else/sass-if-else.css: -------------------------------------------------------------------------------- 1 | @if $i < 1 { color: blue; } 2 | @else{color: red;} 3 | -------------------------------------------------------------------------------- /test/sass/sass-if-else/sass-if-else.out.css: -------------------------------------------------------------------------------- 1 | @if $i < 1 { 2 | color: blue; 3 | } @else { 4 | color: red; 5 | } 6 | -------------------------------------------------------------------------------- /test/sass/sass-include-2/sass-include-2.css: -------------------------------------------------------------------------------- 1 | @include font-face("Pictos", "../fonts/pictos-web"); 2 | 3 | @include transform(translateZ(0) translateY(20px)); 4 | @include transform(translateZ(0) translateX(0)); 5 | @include transform(translateZ(0) translateX(0)); 6 | 7 | 8 | 9 | @include transform(translateZ(0),translateX(0)); 10 | @include transform( translateZ(0), translateX(0) ); 11 | div { 12 | color: blue; 13 | @extend %class; 14 | 15 | @include mixin(); 16 | @include mixin-2(); 17 | 18 | 19 | @include mixin-3(); 20 | &:after { 21 | @include retina { transform: rotate(135deg) scaleY(0.75) } 22 | } 23 | } 24 | @include mixin(); 25 | @function func( $value ) {@return $value;} 26 | @include mixin(); 27 | @mixin mix( ) { color:blue} 28 | @include mixin(); 29 | @if true { color: red} @else {color:blue} 30 | @include mixin(); 31 | @include apply-to-ie6-only {#logo {background-image: url(/logo.gif);}} 32 | -------------------------------------------------------------------------------- /test/sass/sass-include-2/sass-include-2.out.css: -------------------------------------------------------------------------------- 1 | @include font-face("Pictos", "../fonts/pictos-web"); 2 | 3 | @include transform(translateZ(0) translateY(20px)); 4 | @include transform(translateZ(0) translateX(0)); 5 | @include transform(translateZ(0) translateX(0)); 6 | 7 | @include transform(translateZ(0), translateX(0)); 8 | @include transform(translateZ(0), translateX(0)); 9 | 10 | div { 11 | color: blue; 12 | @extend %class; 13 | 14 | @include mixin(); 15 | @include mixin-2(); 16 | 17 | @include mixin-3(); 18 | 19 | &:after { 20 | @include retina { 21 | transform: rotate(135deg) scaleY(0.75); 22 | } 23 | } 24 | } 25 | 26 | @include mixin(); 27 | 28 | @function func($value) { 29 | @return $value; 30 | } 31 | 32 | @include mixin(); 33 | 34 | @mixin mix() { 35 | color: blue; 36 | } 37 | 38 | @include mixin(); 39 | 40 | @if true { 41 | color: red; 42 | } @else { 43 | color: blue; 44 | } 45 | 46 | @include mixin(); 47 | @include apply-to-ie6-only { 48 | #logo { 49 | background-image: url(/logo.gif); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /test/sass/sass-include/sass-include.css: -------------------------------------------------------------------------------- 1 | .class 2 | { 3 | padding:10px;@include clearfix();} 4 | 5 | 6 | .class 7 | {@include rounded ( top,left, 5px); 8 | padding:10px;@include clearfix ();} 9 | 10 | .class 11 | { 12 | padding:10px;@include horizontal-line---foo__bar ( 1px solid #ccc ) ; } 13 | -------------------------------------------------------------------------------- /test/sass/sass-include/sass-include.out.css: -------------------------------------------------------------------------------- 1 | .class { 2 | padding: 10px; 3 | @include clearfix(); 4 | } 5 | 6 | .class { 7 | @include rounded(top, left, 5px); 8 | padding: 10px; 9 | @include clearfix(); 10 | } 11 | 12 | .class { 13 | padding: 10px; 14 | @include horizontal-line---foo__bar(1px solid #ccc); 15 | } 16 | -------------------------------------------------------------------------------- /test/sass/sass-indent/sass-indent.css: -------------------------------------------------------------------------------- 1 | .class-1 { 2 | @for $i from 1 through 10 {color: green; 3 | div { color: blue; 4 | } 5 | } 6 | color: white; 7 | } 8 | .class-2 { 9 | div { 10 | color: green; 11 | div { 12 | color: blue; 13 | } 14 | }color: white; 15 | } 16 | -------------------------------------------------------------------------------- /test/sass/sass-indent/sass-indent.out.css: -------------------------------------------------------------------------------- 1 | .class-1 { 2 | @for $i from 1 through 10 { 3 | color: green; 4 | 5 | div { 6 | color: blue; 7 | } 8 | } 9 | color: white; 10 | } 11 | 12 | .class-2 { 13 | div { 14 | color: green; 15 | 16 | div { 17 | color: blue; 18 | } 19 | } 20 | color: white; 21 | } 22 | -------------------------------------------------------------------------------- /test/sass/sass-inline-comment/sass-inline-comment.css: -------------------------------------------------------------------------------- 1 | // comment 2 | div { 3 | //========= 4 | // comment 5 | //========= 6 | $var-1: blue;// comment 7 | color: blue; // comment 8 | /// comment 9 | } 10 | // comment 11 | -------------------------------------------------------------------------------- /test/sass/sass-inline-comment/sass-inline-comment.out.css: -------------------------------------------------------------------------------- 1 | // comment 2 | div { 3 | //========= 4 | // comment 5 | //========= 6 | $var-1: blue;// comment 7 | color: blue; // comment 8 | /// comment 9 | } 10 | // comment 11 | -------------------------------------------------------------------------------- /test/sass/sass-map-function/sass-map-function.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | @each $category in map-keys($category-background-color) { 3 | &-#{$category} { 4 | @extend %adventCalendarRankingCategoryCardTitle; 5 | background-color: map-get($category-background-color, $category); 6 | color: map-get($category-color, $category); 7 | 8 | a { 9 | color: map-get($category-color, $category); 10 | opacity: .7; 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/sass/sass-map-function/sass-map-function.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | @each $category in map-keys($category-background-color) { 3 | &-#{$category} { 4 | @extend %adventCalendarRankingCategoryCardTitle; 5 | background-color: map-get($category-background-color, $category); 6 | color: map-get($category-color, $category); 7 | 8 | a { 9 | color: map-get($category-color, $category); 10 | opacity: .7; 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /test/sass/sass-maps/sass-maps.css: -------------------------------------------------------------------------------- 1 | $map: ( 2 | grey: ( 3 | dark: darken(rgb(128, 128, 128), 10%), 4 | base: rgb(128, 128, 128), 5 | light: lighten(rgb(128, 128, 128), 10%) 6 | ) 7 | ); 8 | 9 | $color: ( 10 | hoge: #fff, 11 | fuga: #000 12 | ); -------------------------------------------------------------------------------- /test/sass/sass-maps/sass-maps.out.css: -------------------------------------------------------------------------------- 1 | $map: ( 2 | grey: ( 3 | dark: darken(rgb(128, 128, 128), 10%), 4 | base: rgb(128, 128, 128), 5 | light: lighten(rgb(128, 128, 128), 10%) 6 | ) 7 | ); 8 | 9 | $color: ( 10 | hoge: #fff, 11 | fuga: #000 12 | ); -------------------------------------------------------------------------------- /test/sass/sass-math/sass-math.css: -------------------------------------------------------------------------------- 1 | $numPerRow:4; 2 | $margin:2%; 3 | $var : -((1*5%2)-(2+2-1)); 4 | $my-var:$var-1+$var-2;$var3:-100deg; 5 | $var4:-$var3; 6 | $var5 : +$var3; 7 | $var6:0 20px 0 -24px; 8 | $var7:0 20px 0em -1px; 9 | $var8: preserve-3d; 10 | $var9:-($height/2); 11 | $var10: -($height+$width);$var11: -($height-$width); 12 | $var12: normal normal normal 12px/20px myfont; 13 | $height: em(240/2); 14 | $easing : cubic-bezier(.35,0,.765,-0.120); 15 | $width:((100%-($numPerRow*$margin))/$numPerRow); 16 | div { 17 | width:((100%-($numPerRow*$margin))/$numPerRow); 18 | transform: translateX(-$pos); transform: translateX( +$pos ); 19 | transform: translateX($pos -3); 20 | transform: translateX( 3-1); 21 | font-size:percentage(12/16); 22 | margin-top: -($height/2);top: $height * -0.1; 23 | }@function myFn() { 24 | @return -((1*5%2)-(2+2-1)); 25 | } 26 | -------------------------------------------------------------------------------- /test/sass/sass-math/sass-math.out.css: -------------------------------------------------------------------------------- 1 | $numPerRow: 4; 2 | $margin: 2%; 3 | $var: -((1 * 5 % 2) - (2 + 2 - 1)); 4 | $my-var: $var-1 + $var-2; 5 | $var3: -100deg; 6 | $var4: -$var3; 7 | $var5: +$var3; 8 | $var6: 0 20px 0 -24px; 9 | $var7: 0 20px 0em -1px; 10 | $var8: preserve-3d; 11 | $var9: -($height / 2); 12 | $var10: -($height + $width); 13 | $var11: -($height - $width); 14 | $var12: normal normal normal 12px/20px myfont; 15 | $height: em(240/2); 16 | $easing: cubic-bezier(.35, 0, .765, -0.120); 17 | $width: ((100% - ($numPerRow * $margin)) / $numPerRow); 18 | 19 | div { 20 | width: ((100% - ($numPerRow * $margin)) / $numPerRow); 21 | transform: translateX(-$pos); 22 | transform: translateX(+$pos); 23 | transform: translateX($pos -3); 24 | transform: translateX(3-1); 25 | font-size: percentage(12/16); 26 | margin-top: -($height / 2); 27 | top: $height * -0.1; 28 | } 29 | 30 | @function myFn() { 31 | @return -((1 * 5 % 2) - (2 + 2 - 1)); 32 | } 33 | -------------------------------------------------------------------------------- /test/sass/sass-mixin-2/sass-mixin-2.css: -------------------------------------------------------------------------------- 1 | @mixin headline ($size, $color:red ) { 2 | color: $color;font-size: $size; 3 | } 4 | -------------------------------------------------------------------------------- /test/sass/sass-mixin-2/sass-mixin-2.out.css: -------------------------------------------------------------------------------- 1 | @mixin headline($size, $color: red) { 2 | color: $color; 3 | font-size: $size; 4 | } 5 | -------------------------------------------------------------------------------- /test/sass/sass-mixin/sass-mixin.css: -------------------------------------------------------------------------------- 1 | @mixin horizontal-line ( $border: 1px dashed #ccc, $padding:10px ) { 2 | border-bottom:$border; 3 | } 4 | @mixin clearfix { 5 | *zoom: 1; 6 | &:before,&:after { 7 | display: table; 8 | content: ""; 9 | } &:after { 10 | clear: both; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/sass/sass-mixin/sass-mixin.out.css: -------------------------------------------------------------------------------- 1 | @mixin horizontal-line($border: 1px dashed #ccc, $padding: 10px) { 2 | border-bottom: $border; 3 | } 4 | 5 | @mixin clearfix { 6 | *zoom: 1; 7 | 8 | &:before, 9 | &:after { 10 | display: table; 11 | content: ""; 12 | } 13 | 14 | &:after { 15 | clear: both; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/sass/sass-single-at-rule/sass-single-at-rule.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | position: absolute; @debug 10px + 20px ; 3 | display: inline-block; 4 | @error ' Sorry, but `#{$variable}` is not a valid value for $variable. '; 5 | } 6 | 7 | 8 | @debug 10px + 20px; $wrn:20px; 9 | 10 | 11 | @warn 12 | " The `border-radius()` 13 | mixin will be deprecated in version 2.0. "; 14 | 15 | 16 | .bar { 17 | position: absolute; 18 | $wrn: 20px; @warn ' #{$wrn} '; display: inline-block; 19 | } 20 | 21 | /* http://www.sitepoint.com/using-sasss-error-warn-and-debug-directives/ */ 22 | @if unit($input) == 'px' { 23 | @warn 24 | "Please remember to use rem values in the `do-math()` function."; 25 | // do px math and @return a value; 26 | } 27 | -------------------------------------------------------------------------------- /test/sass/sass-single-at-rule/sass-single-at-rule.out.css: -------------------------------------------------------------------------------- 1 | .foo { 2 | position: absolute; 3 | @debug 10px + 20px; 4 | display: inline-block; 5 | @error "Sorry, but `#{$variable}` is not a valid value for $variable."; 6 | } 7 | @debug 10px + 20px; 8 | $wrn: 20px; 9 | @warn "The `border-radius()` mixin will be deprecated in version 2.0."; 10 | 11 | .bar { 12 | position: absolute; 13 | $wrn: 20px; 14 | @warn "#{$wrn}"; 15 | display: inline-block; 16 | } 17 | 18 | /* http://www.sitepoint.com/using-sasss-error-warn-and-debug-directives/ */ 19 | @if unit($input) == 'px' { 20 | @warn "Please remember to use rem values in the `do-math()` function."; 21 | // do px math and @return a value; 22 | } 23 | -------------------------------------------------------------------------------- /test/sass/sass-variables/sass-variables.css: -------------------------------------------------------------------------------- 1 | $fontSmall: 10px; 2 | $foo:'fooooo'; 3 | h2 {display: inline-block;} 4 | 5 | .bar { 6 | $fontSmall : 12px; 7 | font-size: $fontSmall; content: $foo; 8 | } 9 | -------------------------------------------------------------------------------- /test/sass/sass-variables/sass-variables.out.css: -------------------------------------------------------------------------------- 1 | $fontSmall: 10px; 2 | $foo: 'fooooo'; 3 | 4 | h2 { 5 | display: inline-block; 6 | } 7 | 8 | .bar { 9 | $fontSmall: 12px; 10 | font-size: $fontSmall; 11 | content: $foo; 12 | } 13 | -------------------------------------------------------------------------------- /test/sass/scss/scss.css: -------------------------------------------------------------------------------- 1 | // mixin for clearfix 2 | @mixin clearfix () { &:before, 3 | &:after { 4 | content:" "; 5 | display : table; } 6 | 7 | &:after {clear: both;} 8 | }.class 9 | { 10 | padding:10px;@include clearfix();} 11 | .base { color: red; } 12 | 13 | // placeholder 14 | %base 15 | { 16 | 17 | 18 | padding: 12px 19 | } 20 | 21 | .foo{ 22 | @extend .base;} 23 | 24 | .bar 25 | { @extend %base; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/sass/scss/scss.out.css: -------------------------------------------------------------------------------- 1 | // mixin for clearfix 2 | @mixin clearfix() { 3 | &:before, 4 | &:after { 5 | content: " "; 6 | display: table; 7 | } 8 | 9 | &:after { 10 | clear: both; 11 | } 12 | } 13 | 14 | .class { 15 | padding: 10px; 16 | @include clearfix(); 17 | } 18 | 19 | .base { 20 | color: red; 21 | } 22 | 23 | // placeholder 24 | %base { 25 | padding: 12px; 26 | } 27 | 28 | .foo { 29 | @extend .base; 30 | } 31 | 32 | .bar { 33 | @extend %base; 34 | } 35 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-all-nested/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | except: ["all-nested"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-all-nested/at-rule-empty-line-before-always-except-all-nested.css: -------------------------------------------------------------------------------- 1 | b { 2 | color: pink; 3 | 4 | @extend foo; 5 | @custom bar; 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-all-nested/at-rule-empty-line-before-always-except-all-nested.out.css: -------------------------------------------------------------------------------- 1 | b { 2 | color: pink; 3 | @extend foo; 4 | @custom bar; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-blockless-after-same-name-blockless/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | except: ["blockless-after-same-name-blockless"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-blockless-after-same-name-blockless/at-rule-empty-line-before-always-except-blockless-after-same-name-blockless.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | @import url(x.css); 3 | @import url(y.css); 4 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-blockless-after-same-name-blockless/at-rule-empty-line-before-always-except-blockless-after-same-name-blockless.out.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | @import url(x.css); 4 | @import url(y.css); 5 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-blockless-group/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | except: ["blockless-group"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-blockless-group/at-rule-empty-line-before-always-except-blockless-group.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | @import url("x.css"); 3 | .test { display: block; } 4 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-blockless-group/at-rule-empty-line-before-always-except-blockless-group.out.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | @import url("x.css"); 3 | 4 | .test { 5 | display: block; 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-first-nested/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | except: ["first-nested"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-first-nested/at-rule-empty-line-before-always-except-first-nested.css: -------------------------------------------------------------------------------- 1 | a { 2 | 3 | @extend foo; 4 | color: pink; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-first-nested/at-rule-empty-line-before-always-except-first-nested.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | @extend foo; 3 | color: pink; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-inside-block/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | except: ["inside-block"] 5 | }] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-inside-block/at-rule-empty-line-before-always-except-inside-block.css: -------------------------------------------------------------------------------- 1 | b { 2 | color: pink; 3 | 4 | @extend foo; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-except-inside-block/at-rule-empty-line-before-always-except-inside-block.out.css: -------------------------------------------------------------------------------- 1 | b { 2 | color: pink; 3 | @extend foo; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-after-comment/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | ignore: ["after-comment"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-after-comment/at-rule-empty-line-before-always-ignore-after-comment.css: -------------------------------------------------------------------------------- 1 | /* comment */ 2 | @import url(x.css); 3 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-after-comment/at-rule-empty-line-before-always-ignore-after-comment.out.css: -------------------------------------------------------------------------------- 1 | /* comment */ 2 | @import url(x.css); 3 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-all-nested/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | ignore: ["all-nested"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-all-nested/at-rule-empty-line-before-always-ignore-all-nested.css: -------------------------------------------------------------------------------- 1 | a { 2 | @extend foo; 3 | color: pink; 4 | } 5 | 6 | a { 7 | 8 | @extend foo; 9 | color: pink; 10 | } 11 | 12 | b { 13 | color: pink; 14 | @extend foo; 15 | } 16 | 17 | b { 18 | color: pink; 19 | 20 | @extend foo; 21 | } 22 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-all-nested/at-rule-empty-line-before-always-ignore-all-nested.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | @extend foo; 3 | color: pink; 4 | } 5 | 6 | a { 7 | 8 | @extend foo; 9 | color: pink; 10 | } 11 | 12 | b { 13 | color: pink; 14 | @extend foo; 15 | } 16 | 17 | b { 18 | color: pink; 19 | 20 | @extend foo; 21 | } 22 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | ignore: ["blockless-after-same-name-blockless"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless/at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | @import url(x.css); 4 | @import url(y.css); 5 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless/at-rule-empty-line-before-always-ignore-blockless-after-same-name-blockless.out.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | @import url(x.css); 4 | @import url(y.css); 5 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-blockless-group/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["always", { 4 | ignore: ["blockless-group"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-blockless-group/at-rule-empty-line-before-always-ignore-blockless-group.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | @import url(x.css); 4 | 5 | @import url(y.css); 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always-ignore-blockless-group/at-rule-empty-line-before-always-ignore-blockless-group.out.css: -------------------------------------------------------------------------------- 1 | @charset "utf-8"; 2 | 3 | @import url(x.css); 4 | 5 | @import url(y.css); 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": "always", 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always/at-rule-empty-line-before-always.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | @import url("x.css"); 3 | .test { display: block; } 4 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-always/at-rule-empty-line-before-always.out.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | 3 | @import url("x.css"); 4 | 5 | .test { 6 | display: block; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never-except-blockless-group/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["never", { 4 | except: ["blockless-group"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never-except-blockless-group/at-rule-empty-line-before-never-except-blockless-group.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | @import url("x.css"); 3 | .test { display: block; } 4 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never-except-blockless-group/at-rule-empty-line-before-never-except-blockless-group.out.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | 3 | @import url("x.css"); 4 | 5 | .test { 6 | display: block; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never-except-first-nested/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": ["never", { 4 | except: ["first-nested"] 5 | }], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never-except-first-nested/at-rule-empty-line-before-never-except-first-nested.css: -------------------------------------------------------------------------------- 1 | a { 2 | 3 | @extend foo; 4 | color: pink; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never-except-first-nested/at-rule-empty-line-before-never-except-first-nested.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | 3 | @extend foo; 4 | color: pink; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never/at-rule-empty-line-before-never.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | 3 | @import url("x.css"); 4 | 5 | .test { display: block; } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-empty-line-before-never/at-rule-empty-line-before-never.out.css: -------------------------------------------------------------------------------- 1 | @import url("y.css"); 2 | @import url("x.css"); 3 | 4 | .test { 5 | display: block; 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-semicolon-newline-after-always-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-semicolon-newline-after": [ "always", { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-semicolon-newline-after-always-severity/at-rule-semicolon-newline-after-always-severity.css: -------------------------------------------------------------------------------- 1 | @import url("x.css"); @import url("y.css"); 2 | 3 | @import url("x.css"); a {}; 4 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-semicolon-newline-after-always-severity/at-rule-semicolon-newline-after-always-severity.out.css: -------------------------------------------------------------------------------- 1 | @import url("x.css"); 2 | @import url("y.css"); 3 | @import url("x.css"); 4 | 5 | a { 6 | }; 7 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-semicolon-newline-after-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-semicolon-newline-after": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-semicolon-newline-after-always/at-rule-semicolon-newline-after-always.css: -------------------------------------------------------------------------------- 1 | @import url("x.css"); @import url("y.css"); 2 | 3 | @import url("x.css"); a {}; 4 | -------------------------------------------------------------------------------- /test/stylelint/at-rule-semicolon-newline-after-always/at-rule-semicolon-newline-after-always.out.css: -------------------------------------------------------------------------------- 1 | @import url("x.css"); 2 | @import url("y.css"); 3 | @import url("x.css"); 4 | 5 | a { 6 | }; 7 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": "always-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-multi-line/block-closing-brace-newline-after-always-multi-line.css: -------------------------------------------------------------------------------- 1 | a { color: pink; 2 | }b { color: red; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-multi-line/block-closing-brace-newline-after-always-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | b { 6 | color: red; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": [ "always", { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-severity/block-closing-brace-newline-after-always-severity.css: -------------------------------------------------------------------------------- 1 | a { color: pink; }b { color: red; } 2 | 3 | a { color: pink; 4 | } b { color: red; } 5 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-severity/block-closing-brace-newline-after-always-severity.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | b { 6 | color: red; 7 | } 8 | 9 | a { 10 | color: pink; 11 | } 12 | 13 | b { 14 | color: red; 15 | } 16 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": "always-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-single-line/block-closing-brace-newline-after-always-single-line.css: -------------------------------------------------------------------------------- 1 | a { color: pink; } b { color: red; } 2 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always-single-line/block-closing-brace-newline-after-always-single-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | b { 6 | color: red; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always/block-closing-brace-newline-after-always.css: -------------------------------------------------------------------------------- 1 | a { color: pink; }b { color: red; } 2 | 3 | a { color: pink; 4 | } b { color: red; } 5 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-always/block-closing-brace-newline-after-always.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | b { 6 | color: red; 7 | } 8 | 9 | a { 10 | color: pink; 11 | } 12 | 13 | b { 14 | color: red; 15 | } 16 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-multi-line-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": [ "never-multi-line", { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-multi-line-severity/block-closing-brace-newline-after-never-multi-line-severity.css: -------------------------------------------------------------------------------- 1 | a { color: pink; 2 | } b { color: red; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-multi-line-severity/block-closing-brace-newline-after-never-multi-line-severity.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | }b { 4 | color: red; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": "never-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-multi-line/block-closing-brace-newline-after-never-multi-line.css: -------------------------------------------------------------------------------- 1 | a { color: pink; 2 | } b { color: red; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-multi-line/block-closing-brace-newline-after-never-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | }b { 4 | color: red; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-closing-brace-newline-after": "never-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-single-line/block-closing-brace-newline-after-never-single-line.css: -------------------------------------------------------------------------------- 1 | a { color: pink; } b { color: red; } 2 | -------------------------------------------------------------------------------- /test/stylelint/block-closing-brace-newline-after-never-single-line/block-closing-brace-newline-after-never-single-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | b { 6 | color: red; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-newline-before": "always-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always-multi-line/block-opening-brace-newline-before-always-multi-line.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always-multi-line/block-opening-brace-newline-before-always-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-newline-before": "always-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always-single-line/block-opening-brace-newline-before-always-single-line.css: -------------------------------------------------------------------------------- 1 | a{ color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always-single-line/block-opening-brace-newline-before-always-single-line.out.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-newline-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always/block-opening-brace-newline-before-always.css: -------------------------------------------------------------------------------- 1 | a{ color: pink; } 2 | 3 | a{ color: pink; 4 | } 5 | 6 | @media (max-width: 980px){a{font-size:12px;}} 7 | 8 | @keyframes spin { 9 | 0%{ 10 | transform: translateZ(0) rotate(0); 11 | } 12 | 100% 13 | { 14 | transform: translateZ(0) rotate(360deg);} 15 | } 16 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-always/block-opening-brace-newline-before-always.out.css: -------------------------------------------------------------------------------- 1 | a 2 | { 3 | color: pink; 4 | } 5 | 6 | a 7 | { 8 | color: pink; 9 | } 10 | 11 | @media (max-width: 980px) 12 | { 13 | a 14 | { 15 | font-size: 12px; 16 | } 17 | } 18 | 19 | @keyframes spin 20 | { 21 | 0% 22 | { 23 | transform: translateZ(0) rotate(0); 24 | } 25 | 26 | 100% 27 | { 28 | transform: translateZ(0) rotate(360deg); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-never-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-newline-before": "never-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-never-multi-line/block-opening-brace-newline-before-never-multi-line.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-never-multi-line/block-opening-brace-newline-before-never-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-never-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-newline-before": "never-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-never-single-line/block-opening-brace-newline-before-never-single-line.css: -------------------------------------------------------------------------------- 1 | a { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-newline-before-never-single-line/block-opening-brace-newline-before-never-single-line.out.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-space-before": "always-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always-multi-line/block-opening-brace-space-before-always-multi-line.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always-multi-line/block-opening-brace-space-before-always-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-space-before": "always-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always-single-line/block-opening-brace-space-before-always-single-line.css: -------------------------------------------------------------------------------- 1 | a{ color: pink; } 2 | 3 | a 4 | { color: pink; } 5 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always-single-line/block-opening-brace-space-before-always-single-line.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | a 6 | { 7 | color: pink; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-space-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always/block-opening-brace-space-before-always.css: -------------------------------------------------------------------------------- 1 | a{ color: pink; } 2 | 3 | a 4 | { color: pink; } 5 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-always/block-opening-brace-space-before-always.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; 3 | } 4 | 5 | a { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-space-before": "never-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never-multi-line/block-opening-brace-space-before-never-multi-line.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: pink; } 3 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never-multi-line/block-opening-brace-space-before-never-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-space-before": "never-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never-single-line/block-opening-brace-space-before-never-single-line.css: -------------------------------------------------------------------------------- 1 | a { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never-single-line/block-opening-brace-space-before-never-single-line.out.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "block-opening-brace-space-before": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never/block-opening-brace-space-before-never.css: -------------------------------------------------------------------------------- 1 | a{ color: pink; } 2 | 3 | a 4 | { color: pink; } 5 | -------------------------------------------------------------------------------- /test/stylelint/block-opening-brace-space-before-never/block-opening-brace-space-before-never.out.css: -------------------------------------------------------------------------------- 1 | a{ 2 | color: pink; 3 | } 4 | 5 | a{ 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-lower-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "color-hex-case": [ "lower", { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-lower-severity/color-hex-case-lower-severity.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #ABC123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-lower-severity/color-hex-case-lower-severity.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #abc123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-lower/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "color-hex-case": "lower" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-lower/color-hex-case-lower.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #ABC123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-lower/color-hex-case-lower.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #abc123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-upper-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "color-hex-case": [ "upper", { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-upper-severity/color-hex-case-upper-severity.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #abc123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-upper-severity/color-hex-case-upper-severity.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #ABC123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-upper/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "color-hex-case": "upper" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-upper/color-hex-case-upper.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #abc123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-case-upper/color-hex-case-upper.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #ABC123; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-length-long/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "color-hex-length": "long" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-length-long/color-hex-length-long.css: -------------------------------------------------------------------------------- 1 | p { 2 | color: #af3; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-length-long/color-hex-length-long.out.css: -------------------------------------------------------------------------------- 1 | p { 2 | color: #aaff33; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-length-short/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "color-hex-length": "short" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-length-short/color-hex-length-short.css: -------------------------------------------------------------------------------- 1 | p { 2 | color: #aaff33; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/color-hex-length-short/color-hex-length-short.out.css: -------------------------------------------------------------------------------- 1 | p { 2 | color: #af3; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order-groups/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-block-properties-order": [ 4 | { 5 | "properties": [ 6 | "font-size", 7 | "font-weight" 8 | ] 9 | }, 10 | "display", 11 | { 12 | "properties": [ 13 | ] 14 | }, 15 | "width", 16 | { 17 | "object-without-properties-property": true 18 | }, 19 | "height", 20 | "color", 21 | "background", 22 | "opacity" 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order-groups/declaration-block-properties-order-groups.css: -------------------------------------------------------------------------------- 1 | a { 2 | height: 20px; 3 | font-size: 18px; 4 | color: #000; 5 | opacity: .8; 6 | width: 10px; 7 | display: block; 8 | font-weight: normal; 9 | background: #fff; 10 | } 11 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order-groups/declaration-block-properties-order-groups.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | font-size: 18px; 3 | font-weight: normal; 4 | display: block; 5 | width: 10px; 6 | height: 20px; 7 | color: #000; 8 | background: #fff; 9 | opacity: .8; 10 | } 11 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-block-properties-order": [[ 4 | "@atrule", 5 | "display", 6 | "width", 7 | "height", 8 | "color", 9 | "background" 10 | ], { 11 | "severity": "warning" 12 | }] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order-severity/declaration-block-properties-order-severity.css: -------------------------------------------------------------------------------- 1 | a { 2 | height: 20px; 3 | color: #000; 4 | @include "foo"; 5 | width: 10px; 6 | display: block; 7 | background: #fff; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order-severity/declaration-block-properties-order-severity.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | @include "foo"; 3 | display: block; 4 | width: 10px; 5 | height: 20px; 6 | color: #000; 7 | background: #fff; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-block-properties-order": [ 4 | "@atrule", 5 | "display", 6 | "width", 7 | "height", 8 | "color", 9 | "background" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order/declaration-block-properties-order.css: -------------------------------------------------------------------------------- 1 | a { 2 | height: 20px; 3 | color: #000; 4 | @include "foo"; 5 | width: 10px; 6 | display: block; 7 | background: #fff; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/declaration-block-properties-order/declaration-block-properties-order.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | @include "foo"; 3 | display: block; 4 | width: 10px; 5 | height: 20px; 6 | color: #000; 7 | background: #fff; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/declaration-colon-space-after-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-colon-space-after": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-colon-space-after-never/declaration-colon-space-after-never.css: -------------------------------------------------------------------------------- 1 | a { 2 | color : pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/declaration-colon-space-after-never/declaration-colon-space-after-never.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color:pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/declaration-colon-space-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-colon-space-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-colon-space-before-always/declaration-colon-space-before-always.css: -------------------------------------------------------------------------------- 1 | a { color:pink } 2 | -------------------------------------------------------------------------------- /test/stylelint/declaration-colon-space-before-always/declaration-colon-space-before-always.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | color : pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-except/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": ["always", { except: ["after-comment", "after-declaration", "first-nested"] }] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-except/declaration-empty-line-before-always-except.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | 4 | top: 5px; 5 | 6 | } 7 | 8 | a { 9 | 10 | bottom: 15px; 11 | 12 | top: 5px; 13 | } 14 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-except/declaration-empty-line-before-always-except.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | top: 5px; 4 | } 5 | 6 | a { 7 | bottom: 15px; 8 | top: 5px; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-ignore/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": ["always", { ignore: ["after-comment", "after-declaration", "inside-single-line-block"] }] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-ignore/declaration-empty-line-before-always-ignore.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | top: 5px; 4 | } 5 | 6 | a { 7 | 8 | bottom: 15px; 9 | top: 15px; 10 | } 11 | 12 | a { 13 | 14 | bottom: 15px; 15 | 16 | top: 15px; 17 | } 18 | 19 | a { 20 | 21 | color: orange; 22 | text-decoration: none; 23 | 24 | bottom: 15px; 25 | top: 15px; 26 | } 27 | 28 | /* this one doesn't work because we don't support block-closing-brace-newline-before */ 29 | /* a { bottom: 15px; top: 5px; } */ 30 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-ignore/declaration-empty-line-before-always-ignore.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | top: 5px; 4 | } 5 | 6 | a { 7 | 8 | bottom: 15px; 9 | top: 15px; 10 | } 11 | 12 | a { 13 | 14 | bottom: 15px; 15 | 16 | top: 15px; 17 | } 18 | 19 | a { 20 | 21 | color: orange; 22 | text-decoration: none; 23 | 24 | bottom: 15px; 25 | top: 15px; 26 | } 27 | 28 | /* this one doesn't work because we don't support block-closing-brace-newline-before */ 29 | /* a { bottom: 15px; top: 5px; } */ 30 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-standard/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": [ "always", { 4 | except: [ 5 | "after-declaration", 6 | "first-nested", 7 | ], 8 | ignore: [ 9 | "after-comment", 10 | "inside-single-line-block", 11 | ], 12 | } 13 | ], 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-standard/declaration-empty-line-before-always-standard.css: -------------------------------------------------------------------------------- 1 | @media (min-width: $screen-iphone5) and (max-width: ($screen-iphone6 - 1)) { 2 | border-left-color: transparent; 3 | border-left-width: 0; 4 | 5 | a { 6 | padding-left: 0; 7 | padding-right: 0; 8 | } 9 | } 10 | 11 | .article-content { 12 | border-left-color: transparent; 13 | border-left-width: 0; 14 | 15 | a { 16 | padding-left: 0; 17 | padding-right: 0; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always-standard/declaration-empty-line-before-always-standard.out.css: -------------------------------------------------------------------------------- 1 | @media (min-width: $screen-iphone5) and (max-width: ($screen-iphone6 - 1)) { 2 | border-left-color: transparent; 3 | border-left-width: 0; 4 | 5 | a { 6 | padding-left: 0; 7 | padding-right: 0; 8 | } 9 | } 10 | 11 | .article-content { 12 | border-left-color: transparent; 13 | border-left-width: 0; 14 | 15 | a { 16 | padding-left: 0; 17 | padding-right: 0; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always/declaration-empty-line-before-always.css: -------------------------------------------------------------------------------- 1 | a { 2 | --foo: pink; 3 | top: 5px; 4 | } 5 | a { 6 | bottom: 15px; 7 | top: 5px; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-always/declaration-empty-line-before-always.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | 3 | --foo: pink; 4 | 5 | top: 5px; 6 | } 7 | 8 | a { 9 | 10 | bottom: 15px; 11 | 12 | top: 5px; 13 | } 14 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never-except/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": ["never", { except: ["after-comment", "after-declaration", "first-nested"] }] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never-except/declaration-empty-line-before-never-except.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | top: 5px; 4 | } 5 | 6 | a { 7 | bottom: 15px; 8 | top: 5px; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never-except/declaration-empty-line-before-never-except.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | 4 | top: 5px; 5 | } 6 | 7 | a { 8 | 9 | bottom: 15px; 10 | 11 | top: 5px; 12 | } 13 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never-ignore/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": ["never", { "ignore": ["after-comment", "after-declaration", "inside-single-line-block"] }] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never-ignore/declaration-empty-line-before-never-ignore.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | 4 | bottom: 15px; 5 | } 6 | 7 | a { 8 | bottom: 15px; 9 | 10 | top: 15px; 11 | } 12 | 13 | 14 | /* a { bottom: 15px; top: 5px; } */ 15 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never-ignore/declaration-empty-line-before-never-ignore.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | /* comment */ 3 | 4 | bottom: 15px; 5 | } 6 | 7 | a { 8 | bottom: 15px; 9 | 10 | top: 15px; 11 | } 12 | 13 | 14 | /* a { bottom: 15px; top: 5px; } */ 15 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "declaration-empty-line-before": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never/declaration-empty-line-before-never.css: -------------------------------------------------------------------------------- 1 | a { 2 | --foo: pink; 3 | 4 | top: 5px; 5 | } 6 | a { 7 | 8 | bottom: 15px; 9 | 10 | top: 5px; 11 | } 12 | -------------------------------------------------------------------------------- /test/stylelint/declaration-empty-line-before-never/declaration-empty-line-before-never.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | --foo: pink; 3 | top: 5px; 4 | } 5 | 6 | a { 7 | bottom: 15px; 8 | top: 5px; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/extends/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./extend-stylelint.js" 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/extends/extend-stylelint.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "rules": { 3 | "at-rule-empty-line-before": [ "always", { 4 | except: [ "blockless-group" ] 5 | } ], 6 | "at-rule-name-case": "lower", 7 | "at-rule-name-space-after": "always-single-line", 8 | "at-rule-semicolon-newline-after": "always", 9 | "block-closing-brace-newline-after": "always", 10 | "block-closing-brace-newline-before": "always-multi-line", 11 | "block-closing-brace-space-before": "always-single-line", 12 | "block-no-empty": true, 13 | "block-opening-brace-newline-after": "always-multi-line", 14 | "block-opening-brace-space-after": "always-single-line", 15 | "block-opening-brace-space-before": "always", 16 | "color-hex-case": "lower", 17 | "color-hex-length": "short", 18 | "color-no-invalid-hex": true, 19 | "comment-empty-line-before": [ "always", { 20 | except: ["first-nested"], 21 | ignore: ["stylelint-commands"], 22 | } ], 23 | "comment-whitespace-inside": "always", 24 | "declaration-bang-space-after": "never", 25 | "declaration-bang-space-before": "always", 26 | "declaration-block-no-ignored-properties": true, 27 | "declaration-block-no-shorthand-property-overrides": true, 28 | "declaration-block-semicolon-newline-after": "always-multi-line", 29 | "declaration-block-semicolon-space-after": "always-single-line", 30 | "declaration-block-semicolon-space-before": "never", 31 | "declaration-block-single-line-max-declarations": 1, 32 | "declaration-block-trailing-semicolon": "always", 33 | "declaration-colon-newline-after": "always-multi-line", 34 | "declaration-colon-space-after": "always-single-line", 35 | "declaration-colon-space-before": "never", 36 | "function-calc-no-unspaced-operator": true, 37 | "function-comma-newline-after": "always-multi-line", 38 | "function-comma-space-after": "always-single-line", 39 | "function-comma-space-before": "never", 40 | "function-linear-gradient-no-nonstandard-direction": true, 41 | "function-max-empty-lines": 0, 42 | "function-name-case": "lower", 43 | "function-parentheses-newline-inside": "always-multi-line", 44 | "function-parentheses-space-inside": "never-single-line", 45 | "function-whitespace-after": "always", 46 | "indentation": 2, 47 | "max-empty-lines": 1, 48 | "media-feature-colon-space-after": "always", 49 | "media-feature-colon-space-before": "never", 50 | "media-feature-no-missing-punctuation": true, 51 | "media-feature-range-operator-space-after": "always", 52 | "media-feature-range-operator-space-before": "always", 53 | "media-query-list-comma-newline-after": "always-multi-line", 54 | "media-query-list-comma-space-after": "always-single-line", 55 | "media-query-list-comma-space-before": "never", 56 | "media-feature-parentheses-space-inside": "never", 57 | "no-eol-whitespace": true, 58 | "no-extra-semicolons": true, 59 | "no-invalid-double-slash-comments": true, 60 | "no-missing-end-of-source-newline": true, 61 | "number-leading-zero": "always", 62 | "number-no-trailing-zeros": true, 63 | "length-zero-no-unit": true, 64 | "property-case": "lower", 65 | "rule-non-nested-empty-line-before": [ "always-multi-line", { 66 | ignore: ["after-comment"], 67 | } ], 68 | "selector-attribute-brackets-space-inside": "never", 69 | "selector-attribute-operator-space-after": "never", 70 | "selector-attribute-operator-space-before": "never", 71 | "selector-combinator-space-after": "always", 72 | "selector-combinator-space-before": "always", 73 | "selector-list-comma-newline-after": "always", 74 | "selector-list-comma-space-before": "never", 75 | "selector-max-empty-lines": 0, 76 | "selector-pseudo-class-case": "lower", 77 | "selector-pseudo-class-parentheses-space-inside": "never", 78 | "selector-pseudo-element-case": "lower", 79 | "selector-pseudo-element-colon-notation": "double", 80 | "selector-pseudo-element-no-unknown": true, 81 | "selector-type-case": "lower", 82 | "shorthand-property-no-redundant-values": true, 83 | "string-no-newline": true, 84 | "unit-case": "lower", 85 | "unit-no-unknown": true, 86 | "value-list-comma-newline-after": "always-multi-line", 87 | "value-list-comma-space-after": "always-single-line", 88 | "value-list-comma-space-before": "never", 89 | }, 90 | } 91 | -------------------------------------------------------------------------------- /test/stylelint/extends/extends.css: -------------------------------------------------------------------------------- 1 | @import url(x.css); 2 | @import url(y.css); 3 | /** 4 | * Multi-line comment 5 | */ 6 | .selector-1, 7 | .selector-2, 8 | .selector-3[type="text"] { 9 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 10 | box-sizing: border-box; 11 | display: block; 12 | color: #333; 13 | } 14 | .selector-a, 15 | .selector-b:not(:first-child) { 16 | padding: 10px !important; 17 | top: calc(calc(1em * 2) / 3); 18 | } 19 | .selector-x { width: 10%; } 20 | .selector-y { width: 20%; } 21 | .selector-z { width: 30%; } 22 | /* Single-line comment */ 23 | @media (min-width >= 60em) { 24 | .selector { 25 | /* Flush to parent comment */ 26 | transform: translate(1, 1) scale(3); 27 | } 28 | } 29 | @media (min-orientation: portrait), projection and (color) { 30 | .selector-i + .selector-ii { 31 | background: color(rgb(0, 0, 0) lightness(50%)); 32 | font-family: helvetica, "arial black", sans-serif; 33 | } 34 | } 35 | 36 | 37 | /* Flush single line comment */ 38 | @media 39 | screen and (min-resolution: 192dpi), 40 | screen and (min-resolution: 2dppx) { 41 | .selector { 42 | background-image: 43 | repeating-linear-gradient( 44 | -45deg, 45 | transparent, 46 | #fff 25px, 47 | rgba(255, 255, 255, 1) 50px 48 | ); 49 | margin: 10px; 50 | margin-bottom: 5px; 51 | box-shadow: 52 | 0 1px 1px #000, 53 | 0 1px 0 #fff, 54 | 2px 2px 1px 1px #ccc inset; 55 | height: 10rem; 56 | } 57 | /* Flush nested single line comment */ 58 | .selector::after { 59 | content: '→'; 60 | background-image: url(x.svg); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /test/stylelint/extends/extends.out.css: -------------------------------------------------------------------------------- 1 | @import url(x.css); 2 | @import url(y.css); 3 | /** 4 | * Multi-line comment 5 | */ 6 | .selector-1, 7 | .selector-2, 8 | .selector-3[type="text"] { 9 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 10 | box-sizing: border-box; 11 | display: block; 12 | color: #333; 13 | } 14 | 15 | .selector-a, 16 | .selector-b:not(:first-child) { 17 | padding: 10px !important; 18 | top: calc(calc(1em * 2) / 3); 19 | } 20 | 21 | .selector-x { 22 | width: 10%; 23 | } 24 | 25 | .selector-y { 26 | width: 20%; 27 | } 28 | 29 | .selector-z { 30 | width: 30%; 31 | } 32 | /* Single-line comment */ 33 | 34 | @media (min-width >= 60em) { 35 | .selector { 36 | /* Flush to parent comment */ 37 | transform: translate(1, 1) scale(3); 38 | } 39 | } 40 | 41 | @media (min-orientation: portrait), projection and (color) { 42 | .selector-i + .selector-ii { 43 | background: color(rgb(0, 0, 0) lightness(50%)); 44 | font-family: helvetica, "arial black", sans-serif; 45 | } 46 | } 47 | 48 | 49 | /* Flush single line comment */ 50 | 51 | @media screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) { 52 | .selector { 53 | background-image: repeating-linear-gradient(-45deg, transparent, #fff 25px, rgba(255, 255, 255, 1) 50px); 54 | margin: 10px; 55 | margin-bottom: 5px; 56 | box-shadow: 0 1px 1px #000, 0 1px 0 #fff, 2px 2px 1px 1px #ccc inset; 57 | height: 10rem; 58 | } 59 | /* Flush nested single line comment */ 60 | .selector::after { 61 | content: '→'; 62 | background-image: url(x.svg); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /test/stylelint/extends2/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./extend-stylelint.js" 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/extends2/extend-stylelint.js: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./extend-stylelint2.js" 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/extends2/extend-stylelint2.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "rules": { 3 | "at-rule-empty-line-before": [ "always", { 4 | except: [ "blockless-group" ] 5 | } ], 6 | "at-rule-name-case": "lower", 7 | "at-rule-name-space-after": "always-single-line", 8 | "at-rule-semicolon-newline-after": "always", 9 | "block-closing-brace-newline-after": "always", 10 | "block-closing-brace-newline-before": "always-multi-line", 11 | "block-closing-brace-space-before": "always-single-line", 12 | "block-no-empty": true, 13 | "block-opening-brace-newline-after": "always-multi-line", 14 | "block-opening-brace-space-after": "always-single-line", 15 | "block-opening-brace-space-before": "always", 16 | "color-hex-case": "lower", 17 | "color-hex-length": "short", 18 | "color-no-invalid-hex": true, 19 | "comment-empty-line-before": [ "always", { 20 | except: ["first-nested"], 21 | ignore: ["stylelint-commands"], 22 | } ], 23 | "comment-whitespace-inside": "always", 24 | "declaration-bang-space-after": "never", 25 | "declaration-bang-space-before": "always", 26 | "declaration-block-no-ignored-properties": true, 27 | "declaration-block-no-shorthand-property-overrides": true, 28 | "declaration-block-semicolon-newline-after": "always-multi-line", 29 | "declaration-block-semicolon-space-after": "always-single-line", 30 | "declaration-block-semicolon-space-before": "never", 31 | "declaration-block-single-line-max-declarations": 1, 32 | "declaration-block-trailing-semicolon": "always", 33 | "declaration-colon-newline-after": "always-multi-line", 34 | "declaration-colon-space-after": "always-single-line", 35 | "declaration-colon-space-before": "never", 36 | "function-calc-no-unspaced-operator": true, 37 | "function-comma-newline-after": "always-multi-line", 38 | "function-comma-space-after": "always-single-line", 39 | "function-comma-space-before": "never", 40 | "function-linear-gradient-no-nonstandard-direction": true, 41 | "function-max-empty-lines": 0, 42 | "function-name-case": "lower", 43 | "function-parentheses-newline-inside": "always-multi-line", 44 | "function-parentheses-space-inside": "never-single-line", 45 | "function-whitespace-after": "always", 46 | "indentation": 2, 47 | "max-empty-lines": 1, 48 | "media-feature-colon-space-after": "always", 49 | "media-feature-colon-space-before": "never", 50 | "media-feature-no-missing-punctuation": true, 51 | "media-feature-range-operator-space-after": "always", 52 | "media-feature-range-operator-space-before": "always", 53 | "media-query-list-comma-newline-after": "always-multi-line", 54 | "media-query-list-comma-space-after": "always-single-line", 55 | "media-query-list-comma-space-before": "never", 56 | "media-feature-parentheses-space-inside": "never", 57 | "no-eol-whitespace": true, 58 | "no-extra-semicolons": true, 59 | "no-invalid-double-slash-comments": true, 60 | "no-missing-end-of-source-newline": true, 61 | "number-leading-zero": "always", 62 | "number-no-trailing-zeros": true, 63 | "length-zero-no-unit": true, 64 | "property-case": "lower", 65 | "rule-non-nested-empty-line-before": [ "always-multi-line", { 66 | ignore: ["after-comment"], 67 | } ], 68 | "selector-attribute-brackets-space-inside": "never", 69 | "selector-attribute-operator-space-after": "never", 70 | "selector-attribute-operator-space-before": "never", 71 | "selector-combinator-space-after": "always", 72 | "selector-combinator-space-before": "always", 73 | "selector-list-comma-newline-after": "always", 74 | "selector-list-comma-space-before": "never", 75 | "selector-max-empty-lines": 0, 76 | "selector-pseudo-class-case": "lower", 77 | "selector-pseudo-class-parentheses-space-inside": "never", 78 | "selector-pseudo-element-case": "lower", 79 | "selector-pseudo-element-colon-notation": "double", 80 | "selector-pseudo-element-no-unknown": true, 81 | "selector-type-case": "lower", 82 | "shorthand-property-no-redundant-values": true, 83 | "string-no-newline": true, 84 | "unit-case": "lower", 85 | "unit-no-unknown": true, 86 | "value-list-comma-newline-after": "always-multi-line", 87 | "value-list-comma-space-after": "always-single-line", 88 | "value-list-comma-space-before": "never", 89 | }, 90 | } 91 | -------------------------------------------------------------------------------- /test/stylelint/extends2/extends2.css: -------------------------------------------------------------------------------- 1 | @import url(x.css); 2 | @import url(y.css); 3 | /** 4 | * Multi-line comment 5 | */ 6 | .selector-1, 7 | .selector-2, 8 | .selector-3[type="text"] { 9 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 10 | box-sizing: border-box; 11 | display: block; 12 | color: #333; 13 | } 14 | .selector-a, 15 | .selector-b:not(:first-child) { 16 | padding: 10px !important; 17 | top: calc(calc(1em * 2) / 3); 18 | } 19 | .selector-x { width: 10%; } 20 | .selector-y { width: 20%; } 21 | .selector-z { width: 30%; } 22 | /* Single-line comment */ 23 | @media (min-width >= 60em) { 24 | .selector { 25 | /* Flush to parent comment */ 26 | transform: translate(1, 1) scale(3); 27 | } 28 | } 29 | @media (min-orientation: portrait), projection and (color) { 30 | .selector-i + .selector-ii { 31 | background: color(rgb(0, 0, 0) lightness(50%)); 32 | font-family: helvetica, "arial black", sans-serif; 33 | } 34 | } 35 | /* Flush single line comment */ 36 | @media 37 | screen and (min-resolution: 192dpi), 38 | screen and (min-resolution: 2dppx) { 39 | .selector { 40 | background-image: 41 | repeating-linear-gradient( 42 | -45deg, 43 | transparent, 44 | #fff 25px, 45 | rgba(255, 255, 255, 1) 50px 46 | ); 47 | margin: 10px; 48 | margin-bottom: 5px; 49 | box-shadow: 50 | 0 1px 1px #000, 51 | 0 1px 0 #fff, 52 | 2px 2px 1px 1px #ccc inset; 53 | height: 10rem; 54 | } 55 | /* Flush nested single line comment */ 56 | .selector::after { 57 | content: '→'; 58 | background-image: url(x.svg); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /test/stylelint/extends2/extends2.out.css: -------------------------------------------------------------------------------- 1 | @import url(x.css); 2 | @import url(y.css); 3 | /** 4 | * Multi-line comment 5 | */ 6 | .selector-1, 7 | .selector-2, 8 | .selector-3[type="text"] { 9 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 10 | box-sizing: border-box; 11 | display: block; 12 | color: #333; 13 | } 14 | 15 | .selector-a, 16 | .selector-b:not(:first-child) { 17 | padding: 10px !important; 18 | top: calc(calc(1em * 2) / 3); 19 | } 20 | 21 | .selector-x { 22 | width: 10%; 23 | } 24 | 25 | .selector-y { 26 | width: 20%; 27 | } 28 | 29 | .selector-z { 30 | width: 30%; 31 | } 32 | /* Single-line comment */ 33 | 34 | @media (min-width >= 60em) { 35 | .selector { 36 | /* Flush to parent comment */ 37 | transform: translate(1, 1) scale(3); 38 | } 39 | } 40 | 41 | @media (min-orientation: portrait), projection and (color) { 42 | .selector-i + .selector-ii { 43 | background: color(rgb(0, 0, 0) lightness(50%)); 44 | font-family: helvetica, "arial black", sans-serif; 45 | } 46 | } 47 | /* Flush single line comment */ 48 | 49 | @media screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) { 50 | .selector { 51 | background-image: repeating-linear-gradient(-45deg, transparent, #fff 25px, rgba(255, 255, 255, 1) 50px); 52 | margin: 10px; 53 | margin-bottom: 5px; 54 | box-shadow: 0 1px 1px #000, 0 1px 0 #fff, 2px 2px 1px 1px #ccc inset; 55 | height: 10rem; 56 | } 57 | /* Flush nested single line comment */ 58 | .selector::after { 59 | content: '→'; 60 | background-image: url(x.svg); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /test/stylelint/extends3/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./extend-stylelint.js" 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/extends3/extend-stylelint.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "../extends3/extend-stylelint2.js" 3 | }; 4 | -------------------------------------------------------------------------------- /test/stylelint/extends3/extend-stylelint2.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "./extend-stylelint3.js", 3 | "rules": { 4 | "at-rule-empty-line-before": [ "always", { 5 | except: [ "blockless-group" ] 6 | } ], 7 | "at-rule-name-case": "lower", 8 | "at-rule-name-space-after": "always-single-line", 9 | "at-rule-semicolon-newline-after": "always", 10 | "block-closing-brace-newline-after": "always", 11 | "block-closing-brace-newline-before": "always-multi-line", 12 | "block-closing-brace-space-before": "always-single-line", 13 | "block-no-empty": true, 14 | "block-opening-brace-newline-after": "always-multi-line", 15 | "block-opening-brace-space-after": "always-single-line", 16 | "block-opening-brace-space-before": "always", 17 | "color-hex-case": "lower", 18 | "color-hex-length": "short", 19 | "color-no-invalid-hex": true, 20 | "comment-empty-line-before": [ "always", { 21 | except: ["first-nested"], 22 | ignore: ["stylelint-commands"], 23 | } ], 24 | "comment-whitespace-inside": "always", 25 | "declaration-bang-space-after": "never", 26 | "declaration-bang-space-before": "always", 27 | "declaration-block-no-ignored-properties": true, 28 | "declaration-block-no-shorthand-property-overrides": true, 29 | "declaration-block-semicolon-newline-after": "always-multi-line", 30 | "declaration-block-semicolon-space-after": "always-single-line", 31 | "declaration-block-semicolon-space-before": "never", 32 | "declaration-block-single-line-max-declarations": 1, 33 | "declaration-block-trailing-semicolon": "always", 34 | "declaration-colon-newline-after": "always-multi-line", 35 | "declaration-colon-space-after": "always-single-line", 36 | "declaration-colon-space-before": "never", 37 | "function-calc-no-unspaced-operator": true, 38 | "function-comma-newline-after": "always-multi-line", 39 | "function-comma-space-after": "always-single-line", 40 | "function-comma-space-before": "never", 41 | "function-linear-gradient-no-nonstandard-direction": true, 42 | "function-max-empty-lines": 0, 43 | "function-name-case": "lower", 44 | "function-parentheses-newline-inside": "always-multi-line", 45 | "function-parentheses-space-inside": "never-single-line", 46 | "function-whitespace-after": "always", 47 | "indentation": 2, 48 | }, 49 | }; 50 | -------------------------------------------------------------------------------- /test/stylelint/extends3/extend-stylelint3.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "rules": { 3 | "max-empty-lines": 1, 4 | "media-feature-colon-space-after": "always", 5 | "media-feature-colon-space-before": "never", 6 | "media-feature-no-missing-punctuation": true, 7 | "media-feature-range-operator-space-after": "always", 8 | "media-feature-range-operator-space-before": "always", 9 | "media-query-list-comma-newline-after": "always-multi-line", 10 | "media-query-list-comma-space-after": "always-single-line", 11 | "media-query-list-comma-space-before": "never", 12 | "media-feature-parentheses-space-inside": "never", 13 | "no-eol-whitespace": true, 14 | "no-extra-semicolons": true, 15 | "no-invalid-double-slash-comments": true, 16 | "no-missing-end-of-source-newline": true, 17 | "number-leading-zero": "always", 18 | "number-no-trailing-zeros": true, 19 | "length-zero-no-unit": true, 20 | "property-case": "lower", 21 | "rule-non-nested-empty-line-before": [ "always-multi-line", { 22 | ignore: ["after-comment"], 23 | } ], 24 | "selector-attribute-brackets-space-inside": "never", 25 | "selector-attribute-operator-space-after": "never", 26 | "selector-attribute-operator-space-before": "never", 27 | "selector-combinator-space-after": "always", 28 | "selector-combinator-space-before": "always", 29 | "selector-list-comma-newline-after": "always", 30 | "selector-list-comma-space-before": "never", 31 | "selector-max-empty-lines": 0, 32 | "selector-pseudo-class-case": "lower", 33 | "selector-pseudo-class-parentheses-space-inside": "never", 34 | "selector-pseudo-element-case": "lower", 35 | "selector-pseudo-element-colon-notation": "double", 36 | "selector-pseudo-element-no-unknown": true, 37 | "selector-type-case": "lower", 38 | "shorthand-property-no-redundant-values": true, 39 | "string-no-newline": true, 40 | "unit-case": "lower", 41 | "unit-no-unknown": true, 42 | "value-list-comma-newline-after": "always-multi-line", 43 | "value-list-comma-space-after": "always-single-line", 44 | "value-list-comma-space-before": "never", 45 | }, 46 | }; 47 | 48 | -------------------------------------------------------------------------------- /test/stylelint/extends3/extends3.css: -------------------------------------------------------------------------------- 1 | @import url(x.css); 2 | @import url(y.css); 3 | /** 4 | * Multi-line comment 5 | */ 6 | .selector-1, 7 | .selector-2, 8 | .selector-3[type="text"] { 9 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 10 | box-sizing: border-box; 11 | display: block; 12 | color: #333; 13 | } 14 | .selector-a, 15 | .selector-b:not(:first-child) { 16 | padding: 10px !important; 17 | top: calc(calc(1em * 2) / 3); 18 | } 19 | .selector-x { width: 10%; } 20 | .selector-y { width: 20%; } 21 | .selector-z { width: 30%; } 22 | /* Single-line comment */ 23 | @media (min-width >= 60em) { 24 | .selector { 25 | /* Flush to parent comment */ 26 | transform: translate(1, 1) scale(3); 27 | } 28 | } 29 | @media (min-orientation: portrait), projection and (color) { 30 | .selector-i + .selector-ii { 31 | background: color(rgb(0, 0, 0) lightness(50%)); 32 | font-family: helvetica, "arial black", sans-serif; 33 | } 34 | } 35 | /* Flush single line comment */ 36 | @media 37 | screen and (min-resolution: 192dpi), 38 | screen and (min-resolution: 2dppx) { 39 | .selector { 40 | background-image: 41 | repeating-linear-gradient( 42 | -45deg, 43 | transparent, 44 | #fff 25px, 45 | rgba(255, 255, 255, 1) 50px 46 | ); 47 | margin: 10px; 48 | margin-bottom: 5px; 49 | box-shadow: 50 | 0 1px 1px #000, 51 | 0 1px 0 #fff, 52 | 2px 2px 1px 1px #ccc inset; 53 | height: 10rem; 54 | } 55 | /* Flush nested single line comment */ 56 | .selector::after { 57 | content: '→'; 58 | background-image: url(x.svg); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /test/stylelint/extends3/extends3.out.css: -------------------------------------------------------------------------------- 1 | @import url(x.css); 2 | @import url(y.css); 3 | /** 4 | * Multi-line comment 5 | */ 6 | .selector-1, 7 | .selector-2, 8 | .selector-3[type="text"] { 9 | background: linear-gradient(#fff, rgba(0, 0, 0, 0.8)); 10 | box-sizing: border-box; 11 | display: block; 12 | color: #333; 13 | } 14 | 15 | .selector-a, 16 | .selector-b:not(:first-child) { 17 | padding: 10px !important; 18 | top: calc(calc(1em * 2) / 3); 19 | } 20 | 21 | .selector-x { 22 | width: 10%; 23 | } 24 | 25 | .selector-y { 26 | width: 20%; 27 | } 28 | 29 | .selector-z { 30 | width: 30%; 31 | } 32 | /* Single-line comment */ 33 | 34 | @media (min-width >= 60em) { 35 | .selector { 36 | /* Flush to parent comment */ 37 | transform: translate(1, 1) scale(3); 38 | } 39 | } 40 | 41 | @media (min-orientation: portrait), projection and (color) { 42 | .selector-i + .selector-ii { 43 | background: color(rgb(0, 0, 0) lightness(50%)); 44 | font-family: helvetica, "arial black", sans-serif; 45 | } 46 | } 47 | /* Flush single line comment */ 48 | 49 | @media screen and (min-resolution: 192dpi), screen and (min-resolution: 2dppx) { 50 | .selector { 51 | background-image: repeating-linear-gradient(-45deg, transparent, #fff 25px, rgba(255, 255, 255, 1) 50px); 52 | margin: 10px; 53 | margin-bottom: 5px; 54 | box-shadow: 0 1px 1px #000, 0 1px 0 #fff, 2px 2px 1px 1px #ccc inset; 55 | height: 10rem; 56 | } 57 | /* Flush nested single line comment */ 58 | .selector::after { 59 | content: '→'; 60 | background-image: url(x.svg); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /test/stylelint/indentation-2space-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indentation": [ 2, { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-2space-severity/indentation-2space-severity.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, 4 | top right; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/indentation-2space-severity/indentation-2space-severity.out.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, top right; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-2space/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indentation": 2 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-2space/indentation-2space.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, 4 | top right; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/indentation-2space/indentation-2space.out.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, top right; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-4space-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indentation": [ 4, { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-4space-severity/indentation-4space-severity.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, 4 | top right; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/indentation-4space-severity/indentation-4space-severity.out.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, top right; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-4space/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indentation": 4 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-4space/indentation-4space.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, 4 | top right; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/indentation-4space/indentation-4space.out.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, top right; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-tab-severity/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indentation": [ "tab", { "severity": "error" } ] 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-tab-severity/indentation-tab-severity.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, 4 | top right; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/indentation-tab-severity/indentation-tab-severity.out.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, top right; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-tab/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "indentation": "tab" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/indentation-tab/indentation-tab.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, 4 | top right; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/indentation-tab/indentation-tab.out.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | a { 3 | background-position: top left, top right; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/length-zero-no-unit/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "length-zero-no-unit": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/length-zero-no-unit/length-zero-no-unit.css: -------------------------------------------------------------------------------- 1 | $var: 0px 10px; 2 | 3 | div { 4 | height: 0px; 5 | width: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/length-zero-no-unit/length-zero-no-unit.out.css: -------------------------------------------------------------------------------- 1 | $var: 0 10px; 2 | 3 | div { 4 | height: 0; 5 | width: 10px; 6 | } 7 | -------------------------------------------------------------------------------- /test/stylelint/number-leading-zero-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "number-leading-zero": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/number-leading-zero-always/number-leading-zero-always.css: -------------------------------------------------------------------------------- 1 | $var: .5 .8px; 2 | $string-var: ".1"; 3 | 4 | p { 5 | background: url("https://cdn.example.com/v0.0.1/img/background.2x.png"); 6 | transition: .4s cubic-bezier(.23, 1, .32, 1); 7 | opacity: 0.5; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/number-leading-zero-always/number-leading-zero-always.out.css: -------------------------------------------------------------------------------- 1 | $var: 0.5 0.8px; 2 | $string-var: ".1"; 3 | 4 | p { 5 | background: url("https://cdn.example.com/v0.0.1/img/background.2x.png"); 6 | transition: 0.4s cubic-bezier(0.23, 1, 0.32, 1); 7 | opacity: 0.5; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/number-leading-zero-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "number-leading-zero": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/number-leading-zero-never/number-leading-zero-never.css: -------------------------------------------------------------------------------- 1 | $var: 0.5 0.8px; 2 | $string-var: "0.1"; 3 | 4 | p { 5 | background: url("/v0.1/background.jpg"); 6 | line-height: 0.5; 7 | transition: 0.4s cubic-bezier(0.23, 1, 0.32, 1); 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/number-leading-zero-never/number-leading-zero-never.out.css: -------------------------------------------------------------------------------- 1 | $var: .5 .8px; 2 | $string-var: "0.1"; 3 | 4 | p { 5 | background: url("/v0.1/background.jpg"); 6 | line-height: .5; 7 | transition: .4s cubic-bezier(.23, 1, .32, 1); 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/number-no-trailing-zeros/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "number-no-trailing-zeros": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/number-no-trailing-zeros/number-no-trailing-zeros.css: -------------------------------------------------------------------------------- 1 | $var: 1.0 2.0px; 2 | $string-var: "1.0"; 3 | 4 | p { 5 | background: url("/v1.0/background.jpg"); 6 | transition: 0.40s cubic-bezier(0.23, 1, 0.32, 1); 7 | top: 1.0px; 8 | line-height: 1.0; 9 | letter-spacing: 1.08; 10 | width: 32.207%; 11 | } 12 | -------------------------------------------------------------------------------- /test/stylelint/number-no-trailing-zeros/number-no-trailing-zeros.out.css: -------------------------------------------------------------------------------- 1 | $var: 1 2px; 2 | $string-var: "1.0"; 3 | 4 | p { 5 | background: url("/v1.0/background.jpg"); 6 | transition: 0.4s cubic-bezier(0.23, 1, 0.32, 1); 7 | top: 1px; 8 | line-height: 1; 9 | letter-spacing: 1.08; 10 | width: 32.207%; 11 | } 12 | -------------------------------------------------------------------------------- /test/stylelint/order-order/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "stylelint-order" 4 | ], 5 | 6 | "rules": { 7 | "order/order": [ 8 | "custom-properties", 9 | "declarations" 10 | ], 11 | "order/properties-order": [ 12 | [ 13 | { 14 | "emptyLineBefore": "always", 15 | "properties": [ 16 | "font-size", 17 | "line-height" 18 | ] 19 | }, 20 | { 21 | "emptyLineBefore": "always", 22 | "properties": [ 23 | "position", 24 | "top", 25 | "right", 26 | "bottom", 27 | "left" 28 | ] 29 | } 30 | ] 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test/stylelint/order-order/order-order.css: -------------------------------------------------------------------------------- 1 | body { 2 | line-height: 10px; 3 | font-size: 13px; 4 | position: absolute; 5 | left: 10px; 6 | top: 5px; 7 | --text-normal: #000; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/order-order/order-order.out.css: -------------------------------------------------------------------------------- 1 | body { 2 | --text-normal: #000; 3 | font-size: 13px; 4 | line-height: 10px; 5 | 6 | position: absolute; 7 | top: 5px; 8 | left: 10px; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/order-properties-alphabetical-order/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "stylelint-order" 4 | ], 5 | 6 | "rules": { 7 | "order/properties-alphabetical-order": true, 8 | "order/properties-order": [ 9 | [ 10 | { 11 | "emptyLineBefore": "always", 12 | "properties": [ 13 | "font-size", 14 | "line-height" 15 | ] 16 | }, 17 | { 18 | "emptyLineBefore": "always", 19 | "properties": [ 20 | "position", 21 | "top", 22 | "right", 23 | "bottom", 24 | "left" 25 | ] 26 | } 27 | ] 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/stylelint/order-properties-alphabetical-order/order-properties-alphabetical-order.css: -------------------------------------------------------------------------------- 1 | body { 2 | line-height: 10px; 3 | font-size: 13px; 4 | position: absolute; 5 | left: 10px; 6 | top: 5px; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/order-properties-alphabetical-order/order-properties-alphabetical-order.out.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 13px; 3 | left: 10px; 4 | line-height: 10px; 5 | position: absolute; 6 | top: 5px; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/order-properties-order/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | "stylelint-order" 4 | ], 5 | 6 | "rules": { 7 | "order/properties-order": [ 8 | [ 9 | { 10 | "emptyLineBefore": "always", 11 | "properties": [ 12 | "font-size", 13 | "line-height" 14 | ] 15 | }, 16 | { 17 | "emptyLineBefore": "always", 18 | "properties": [ 19 | "position", 20 | "top", 21 | "right", 22 | "bottom", 23 | "left" 24 | ] 25 | } 26 | ] 27 | ] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /test/stylelint/order-properties-order/order-properties-order.css: -------------------------------------------------------------------------------- 1 | body { 2 | line-height: 10px; 3 | font-size: 13px; 4 | position: absolute; 5 | left: 10px; 6 | top: 5px; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/order-properties-order/order-properties-order.out.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 13px; 3 | line-height: 10px; 4 | 5 | position: absolute; 6 | top: 5px; 7 | left: 10px; 8 | } 9 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-after-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-combinator-space-after": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-after-always/selector-combinator-space-after-always.css: -------------------------------------------------------------------------------- 1 | a +b { color: pink; } 2 | 3 | a>b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-after-always/selector-combinator-space-after-always.out.css: -------------------------------------------------------------------------------- 1 | a + b { 2 | color: pink; 3 | } 4 | 5 | a > b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-after-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-combinator-space-after": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-after-never/selector-combinator-space-after-never.css: -------------------------------------------------------------------------------- 1 | a + b { color: pink; } 2 | 3 | a> b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-after-never/selector-combinator-space-after-never.out.css: -------------------------------------------------------------------------------- 1 | a +b { 2 | color: pink; 3 | } 4 | 5 | a >b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-combinator-space-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-before-always/selector-combinator-space-before-always.css: -------------------------------------------------------------------------------- 1 | a+ b { color: pink; } 2 | 3 | a>b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-before-always/selector-combinator-space-before-always.out.css: -------------------------------------------------------------------------------- 1 | a + b { 2 | color: pink; 3 | } 4 | 5 | a > b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-before-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-combinator-space-before": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-before-never/selector-combinator-space-before-never.css: -------------------------------------------------------------------------------- 1 | a + b { color: pink; } 2 | 3 | a >b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-combinator-space-before-never/selector-combinator-space-before-never.out.css: -------------------------------------------------------------------------------- 1 | a+ b { 2 | color: pink; 3 | } 4 | 5 | a> b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-always-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-newline-after": "always-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-always-multi-line/selector-list-comma-newline-after-always-multi-line.css: -------------------------------------------------------------------------------- 1 | a 2 | , b { color: pink; } 3 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-always-multi-line/selector-list-comma-newline-after-always-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a, 2 | b { 3 | color: pink; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-newline-after": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-always/selector-list-comma-newline-after-always.css: -------------------------------------------------------------------------------- 1 | a, b { color: pink; } 2 | 3 | a 4 | , b { color: pink; } 5 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-always/selector-list-comma-newline-after-always.out.css: -------------------------------------------------------------------------------- 1 | a, 2 | b { 3 | color: pink; 4 | } 5 | 6 | a, 7 | b { 8 | color: pink; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-never-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-newline-after": "never-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-never-multi-line/selector-list-comma-newline-after-never-multi-line.css: -------------------------------------------------------------------------------- 1 | a 2 | , b { color: pink; } 3 | 4 | a, 5 | b { color: pink; } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-after-never-multi-line/selector-list-comma-newline-after-never-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a,b { 2 | color: pink; 3 | } 4 | 5 | a,b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-always-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-newline-before": "always-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-always-multi-line/selector-list-comma-newline-before-always-multi-line.css: -------------------------------------------------------------------------------- 1 | a, 2 | b { color: pink; } 3 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-always-multi-line/selector-list-comma-newline-before-always-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a 2 | , 3 | b { 4 | color: pink; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-newline-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-always/selector-list-comma-newline-before-always.css: -------------------------------------------------------------------------------- 1 | a,b { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-always/selector-list-comma-newline-before-always.out.css: -------------------------------------------------------------------------------- 1 | a 2 | , 3 | b { 4 | color: pink; 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-never-multi-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-newline-before": "never-multi-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-never-multi-line/selector-list-comma-newline-before-never-multi-line.css: -------------------------------------------------------------------------------- 1 | a 2 | , b { color: pink; } 3 | 4 | a 5 | , 6 | b { color: pink; } 7 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-newline-before-never-multi-line/selector-list-comma-newline-before-never-multi-line.out.css: -------------------------------------------------------------------------------- 1 | a, 2 | b { 3 | color: pink; 4 | } 5 | 6 | a, 7 | b { 8 | color: pink; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-always-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-space-after": "always-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-always-single-line/selector-list-comma-space-after-always-single-line.css: -------------------------------------------------------------------------------- 1 | a,b { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-always-single-line/selector-list-comma-space-after-always-single-line.out.css: -------------------------------------------------------------------------------- 1 | a, b { 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-always/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-space-after": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-always/selector-list-comma-space-after-always.css: -------------------------------------------------------------------------------- 1 | a,b { color: pink; } 2 | 3 | a ,b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-always/selector-list-comma-space-after-always.out.css: -------------------------------------------------------------------------------- 1 | a, b { 2 | color: pink; 3 | } 4 | 5 | a, b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-never-single-line/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-space-after": "never-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-never-single-line/selector-list-comma-space-after-never-single-line.css: -------------------------------------------------------------------------------- 1 | a, b { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-never-single-line/selector-list-comma-space-after-never-single-line.out.css: -------------------------------------------------------------------------------- 1 | a,b { 2 | color: pink; 3 | } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-never/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-space-after": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-never/selector-list-comma-space-after-never.css: -------------------------------------------------------------------------------- 1 | a, b { color: pink; } 2 | 3 | a , b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-after-never/selector-list-comma-space-after-never.out.css: -------------------------------------------------------------------------------- 1 | a,b { 2 | color: pink; 3 | } 4 | 5 | a,b { 6 | color: pink; 7 | } 8 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-always-single-line/.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "rules": { 3 | "selector-list-comma-space-before": "always-single-line" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-always-single-line/selector-list-comma-space-before-always-single-line.css: -------------------------------------------------------------------------------- 1 | a,b { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-always-single-line/selector-list-comma-space-before-always-single-line.out.css: -------------------------------------------------------------------------------- 1 | a , 2 | b { 3 | color: pink; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-always/.stylelintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-space-before": "always" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-always/selector-list-comma-space-before-always.css: -------------------------------------------------------------------------------- 1 | a,b { color: pink; } 2 | 3 | a, b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-always/selector-list-comma-space-before-always.out.css: -------------------------------------------------------------------------------- 1 | a , 2 | b { 3 | color: pink; 4 | } 5 | 6 | a , 7 | b { 8 | color: pink; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-never-single-line/.stylelintrc.yaml: -------------------------------------------------------------------------------- 1 | rules: 2 | "selector-list-comma-space-before": "never-single-line" 3 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-never-single-line/selector-list-comma-space-before-never-single-line.css: -------------------------------------------------------------------------------- 1 | a ,b { color: pink; } 2 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-never-single-line/selector-list-comma-space-before-never-single-line.out.css: -------------------------------------------------------------------------------- 1 | a, 2 | b { 3 | color: pink; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-never/.stylelintrc.config.js: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "selector-list-comma-space-before": "never" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-never/selector-list-comma-space-before-never.css: -------------------------------------------------------------------------------- 1 | a ,b { color: pink; } 2 | 3 | a , b { color: pink; } 4 | -------------------------------------------------------------------------------- /test/stylelint/selector-list-comma-space-before-never/selector-list-comma-space-before-never.out.css: -------------------------------------------------------------------------------- 1 | a, 2 | b { 3 | color: pink; 4 | } 5 | 6 | a, 7 | b { 8 | color: pink; 9 | } 10 | -------------------------------------------------------------------------------- /test/stylelint/shorthand-property-no-redundant-values/.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "shorthand-property-no-redundant-values": true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/stylelint/shorthand-property-no-redundant-values/shorthand-property-no-redundant-values.css: -------------------------------------------------------------------------------- 1 | div { 2 | padding: 1px 2px 1px 2px; 3 | margin: 1px 2px 1px; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/shorthand-property-no-redundant-values/shorthand-property-no-redundant-values.out.css: -------------------------------------------------------------------------------- 1 | div { 2 | padding: 1px 2px; 3 | margin: 1px 2px; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/string-quotes-double/.stylelintrc.yaml: -------------------------------------------------------------------------------- 1 | rules: 2 | "string-quotes": "double" 3 | -------------------------------------------------------------------------------- /test/stylelint/string-quotes-double/string-quotes-double.css: -------------------------------------------------------------------------------- 1 | a { 2 | content: ''; 3 | font-family: 'Test Font', sans-serif; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/string-quotes-double/string-quotes-double.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | content: ""; 3 | font-family: "Test Font", sans-serif; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/string-quotes-single/.stylelintrc.yaml: -------------------------------------------------------------------------------- 1 | rules: 2 | "string-quotes": "single" 3 | -------------------------------------------------------------------------------- /test/stylelint/string-quotes-single/string-quotes-single.css: -------------------------------------------------------------------------------- 1 | a { 2 | content: ""; 3 | font-family: "Test Font", sans-serif; 4 | } 5 | -------------------------------------------------------------------------------- /test/stylelint/string-quotes-single/string-quotes-single.out.css: -------------------------------------------------------------------------------- 1 | a { 2 | content: ''; 3 | font-family: 'Test Font', sans-serif; 4 | } 5 | --------------------------------------------------------------------------------