-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[//]: # (This file is generated by eslint-docgen. Do not edit it directly.) | ||
|
||
# no-margin-properties | ||
|
||
Discourage using margin properties for spacing; prefer defining spacing in parent elements with `flex` or `grid` using the `gap` property for a more resilient layout. Margins make components less reusable in other contexts. | ||
|
||
📋 This rule is enabled in `plugin:@pandacss/all`. | ||
|
||
## Rule details | ||
|
||
❌ Examples of **incorrect** code: | ||
```js | ||
import { css } from './panda/css'; | ||
|
||
const styles = css({ marginLeft: '4' }); | ||
``` | ||
```js | ||
|
||
import { css } from './panda/css'; | ||
|
||
function App(){ | ||
return <div className={css({ margin: '3' })} />; | ||
}; | ||
``` | ||
```js | ||
|
||
import { Circle } from './panda/jsx'; | ||
|
||
function App(){ | ||
return <Circle marginX="2" />; | ||
} | ||
``` | ||
|
||
✔️ Examples of **correct** code: | ||
```js | ||
import { css } from './panda/css'; | ||
|
||
const styles = css({ display: 'flex', gap: '4' }); | ||
``` | ||
```js | ||
|
||
import { grid } from './panda/css'; | ||
|
||
function App(){ | ||
return <div className={grid({ gap: '3' })} />; | ||
}; | ||
``` | ||
```js | ||
|
||
import { Flex } from './panda/jsx'; | ||
|
||
function App(){ | ||
return <Flex gap="2" />; | ||
} | ||
``` | ||
|
||
## Resources | ||
|
||
* [Rule source](/plugin/src/rules/no-margin-properties.ts) | ||
* [Test source](/tests/no-margin-properties.test.ts) |