Skip to content

Commit cdba866

Browse files
authored
Feature/support width height (#19)
* Fix eslint errors * Add support for width/height properties * Revert unwanted change
1 parent 300dd5c commit cdba866

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

.tape.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
warnings: 1,
66
}, {
77
source: 'body { left: 0 }',
8-
args: ['always', { except: 'left' }],
8+
args: [ 'always', { except: 'left' }],
99
warnings: 0,
1010
}, {
1111
source: 'body { top: 0; left: 0 }',
@@ -21,7 +21,7 @@ module.exports = {
2121
warnings: 2
2222
}, {
2323
source: 'body { top: 0; margin-left: 0 }',
24-
args: ['always', { except: ['top', /^margin/] }],
24+
args: [ 'always', { except: [ 'top', /^margin/ ] }],
2525
warnings: 0
2626
}, {
2727
source: 'body { padding-left: 0; margin-right: 0 }',
@@ -78,13 +78,37 @@ module.exports = {
7878
}, {
7979
source: 'body:dir(ltr) { text-align: left }',
8080
expect: 'body:dir(ltr) { text-align: left }',
81-
args: ['always']
81+
args: [ 'always' ]
8282
}, {
8383
source: 'body { float: left; text-align: left }',
8484
expect: 'body { float: left; text-align: start }',
85-
args: ['always', {
86-
except: [/^float$/i]
85+
args: [ 'always', {
86+
except: [ /^float$/i ]
8787
}]
88+
}, {
89+
source: 'body { width: 0; }',
90+
expect: 'body { inline-size: 0; }',
91+
args: 'always'
92+
}, {
93+
source: 'body { min-width: 0; }',
94+
expect: 'body { min-inline-size: 0; }',
95+
args: 'always'
96+
}, {
97+
source: 'body { max-width: 0; }',
98+
expect: 'body { max-inline-size: 0; }',
99+
args: 'always'
100+
}, {
101+
source: 'body { height: 0; }',
102+
expect: 'body { block-size: 0; }',
103+
args: 'always'
104+
}, {
105+
source: 'body { min-height: 0; }',
106+
expect: 'body { min-block-size: 0; }',
107+
args: 'always'
108+
}, {
109+
source: 'body { max-height: 0; }',
110+
expect: 'body { max-block-size: 0; }',
111+
args: 'always'
88112
}, {
89113
source: 'body { border-left: 0; }',
90114
expect: 'body { border-inline-start: 0; }',
@@ -101,7 +125,7 @@ module.exports = {
101125
source: 'body { border-bottom: 0; }',
102126
expect: 'body { border-block-end: 0; }',
103127
args: 'always'
104-
},{
128+
}, {
105129
source: 'body { border-left-color: 0; }',
106130
expect: 'body { border-inline-start-color: 0; }',
107131
args: 'always'

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ Assuming _left to right_ directionality:
208208
| `padding-bottom` | `padding-block-end` |
209209
| `padding-left` | `padding-inline-start` |
210210

211+
| Physical Property | Logical Property |
212+
| ----------------- | ---------------------- |
213+
| `width` | `inline-size` |
214+
| `min-width` | `min-inline-size` |
215+
| `max-width` | `max-inline-size` |
216+
| `height` | `block-size` |
217+
| `min-height` | `min-block-size` |
218+
| `max-height` | `max-block-size` |
219+
211220
[cli-img]: https://img.shields.io/travis/csstools/stylelint-use-logical.svg
212221
[cli-url]: https://travis-ci.org/csstools/stylelint-use-logical
213222
[git-img]: https://img.shields.io/badge/support-chat-blue.svg

lib/maps.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export const physicalProp = dir => [
3636
[ [ `padding-${inline.start[dir]}` ], 'padding-inline-start' ],
3737
[ [ `padding-${inline.end[dir]}` ], 'padding-inline-end' ],
3838

39+
// width, height
40+
[ [ 'width' ], 'inline-size' ],
41+
[ [ 'min-width' ], 'min-inline-size' ],
42+
[ [ 'max-width' ], 'max-inline-size' ],
43+
[ [ 'height' ], 'block-size' ],
44+
[ [ 'min-height' ], 'min-block-size' ],
45+
[ [ 'max-height' ], 'max-block-size' ],
3946

4047
// border
4148
[ [ 'border-top' ], 'border-block-start' ],

0 commit comments

Comments
 (0)