Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sorting exceptions for logical property shorthands #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
115 changes: 113 additions & 2 deletions rules/shorthandData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,34 @@

// See https://github.com/stylelint/stylelint/blob/10.1.0/lib/reference/shorthandData.js
module.exports = {
margin: ['margin-top', 'margin-bottom', 'margin-left', 'margin-right'],
padding: ['padding-top', 'padding-bottom', 'padding-left', 'padding-right'],
margin: [
'margin-top',
'margin-bottom',
'margin-left',
'margin-right',
'margin-block',
'margin-block-end',
'margin-block-start',
'margin-inline',
'margin-inline-end',
'margin-inline-start',
Comment on lines +10 to +15
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed to duplicate properties here, since they have separate declarations below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will do that. Might not have time for the tweaks until Monday, but I won't forget about it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I will write tests and find out if they are necessary.

],
'margin-block': ['margin-block-end', 'margin-block-start'],
'margin-inline': ['margin-inline-end', 'margin-inline-start'],
padding: [
'padding-top',
'padding-bottom',
'padding-left',
'padding-right',
'padding-block',
'padding-block-end',
'padding-block-start',
'padding-inline',
'padding-inline-end',
'padding-inline-start',
],
'padding-block': ['padding-block-end', 'padding-block-start'],
'padding-inline': ['padding-inline-end', 'padding-inline-start'],
background: [
'background-image',
'background-size',
Expand Down Expand Up @@ -36,6 +62,26 @@ module.exports = {
'border-bottom-color',
'border-left-color',
'border-right-color',
'border-block',
'border-block-color',
'border-block-style',
'border-block-width',
'border-block-end-color',
'border-block-end-style',
'border-block-end-width',
'border-block-start-color',
'border-block-start-style',
'border-block-start-width',
'border-inline',
'border-inine-color',
'border-inine-style',
'border-inine-width',
'border-inline-end-color',
'border-inline-end-style',
'border-inline-end-width',
'border-inline-start-color',
'border-inline-start-style',
'border-inline-start-width',
],
'border-top': ['border-top-width', 'border-top-style', 'border-top-color'],
'border-bottom': ['border-bottom-width', 'border-bottom-style', 'border-bottom-color'],
Expand All @@ -46,25 +92,47 @@ module.exports = {
'border-bottom-width',
'border-left-width',
'border-right-width',
'border-block-width',
'border-block-end-width',
'border-block-start-width',
'border-inline-width',
'border-inline-end-width',
'border-inline-start-width',
],
'border-style': [
'border-top-style',
'border-bottom-style',
'border-left-style',
'border-right-style',
'border-block-style',
'border-block-end-style',
'border-block-start-style',
'border-inline-style',
'border-inline-end-style',
'border-inline-start-style',
],
'border-color': [
'border-top-color',
'border-bottom-color',
'border-left-color',
'border-right-color',
'border-block-color',
'border-block-end-color',
'border-block-start-color',
'border-inline-color',
'border-inline-end-color',
'border-inline-start-color',
],
'list-style': ['list-style-type', 'list-style-position', 'list-style-image'],
'border-radius': [
'border-top-right-radius',
'border-top-left-radius',
'border-bottom-right-radius',
'border-bottom-left-radius',
'border-start-start-radius',
'border-start-end-radius',
'border-end-start-radius',
'border-end-end-radius',
],
transition: [
'transition-delay',
Expand All @@ -82,6 +150,19 @@ module.exports = {
'animation-fill-mode',
'animation-play-state',
],
'border-block': [
'border-block-color',
'border-block-style',
'border-block-width',
'border-block-end',
'border-block-end-color',
'border-block-end-style',
'border-block-end-width',
'border-block-start',
'border-block-start-color',
'border-block-start-style',
'border-block-start-width',
],
'border-block-end': [
'border-block-end-width',
'border-block-end-style',
Expand All @@ -99,6 +180,19 @@ module.exports = {
'border-image-outset',
'border-image-repeat',
],
'border-inline': [
'border-inline-color',
'border-inline-style',
'border-inline-width',
'border-inline-end',
'border-inline-end-color',
'border-inline-end-style',
'border-inline-end-width',
'border-inline-start',
'border-inline-start-color',
'border-inline-start-style',
'border-inline-start-width',
],
'border-inline-end': [
'border-inline-end-width',
'border-inline-end-style',
Expand Down Expand Up @@ -128,7 +222,24 @@ module.exports = {
'grid-gap': ['grid-row-gap', 'grid-column-gap'],
'grid-row': ['grid-row-start', 'grid-row-end'],
'grid-template': ['grid-template-columns', 'grid-template-rows', 'grid-template-areas'],
inset: [
'inset-block',
'inset-block-end',
'inset-block-start',
'inset-inline',
'inset-inline-end',
'inset-inline-start',
],
'inset-block': ['inset-block-end', 'inset-block-start'],
'inset-inline': ['inset-inline-end', 'inset-inline-start'],
outline: ['outline-color', 'outline-style', 'outline-width'],
overflow: ['overflow-block', 'overflow-inline', 'overflow-x', 'overflow-y'],
'overflow-behavior': [
'overflow-behavior-block',
'overflow-behavior-inline',
'overflow-behavior-x',
'overflow-behavior-y',
],
'text-decoration': ['text-decoration-color', 'text-decoration-style', 'text-decoration-line'],
'text-emphasis': ['text-emphasis-style', 'text-emphasis-color'],
mask: [
Expand Down