Betterer: Add noMargin prop check (#105409)
* Chore: Add a betterer rule for noMargin prop * Use existing file selector * Check for grafana/ui import * Update results * Update results
This commit is contained in:
@@ -128,6 +128,18 @@ module.exports = [
|
|||||||
selector: 'MemberExpression[object.name=localStorage]',
|
selector: 'MemberExpression[object.name=localStorage]',
|
||||||
message: 'Direct usage of localStorage is not allowed. Use `Store` from @grafana/data instead.',
|
message: 'Direct usage of localStorage is not allowed. Use `Store` from @grafana/data instead.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
selector:
|
||||||
|
'Program:has(ImportDeclaration[source.value="@grafana/ui"] ImportSpecifier[imported.name="Card"]) JSXOpeningElement[name.name="Card"]:not(:has(JSXAttribute[name.name="noMargin"]))',
|
||||||
|
message:
|
||||||
|
'Add noMargin prop to Card components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
selector:
|
||||||
|
'Program:has(ImportDeclaration[source.value="@grafana/ui"] ImportSpecifier[imported.name="Field"]) JSXOpeningElement[name.name="Field"]:not(:has(JSXAttribute[name.name="noMargin"]))',
|
||||||
|
message:
|
||||||
|
'Add noMargin prop to Field components to remove built-in margins. Use layout components like Stack or Grid with the gap prop instead for consistent spacing.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+1130
-59
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,7 @@ export function ProviderCard({ providerId, enabled, configPath, authType, onClic
|
|||||||
const url = getProviderUrl({ configPath, id: providerId });
|
const url = getProviderUrl({ configPath, id: providerId });
|
||||||
const [iconName, displayName] = UIMap[providerId] || ['lock', providerId.toUpperCase()];
|
const [iconName, displayName] = UIMap[providerId] || ['lock', providerId.toUpperCase()];
|
||||||
return (
|
return (
|
||||||
<Card href={url} onClick={onClick}>
|
<Card href={url} onClick={onClick} noMargin>
|
||||||
<Card.Heading>{displayName}</Card.Heading>
|
<Card.Heading>{displayName}</Card.Heading>
|
||||||
<Card.Meta>{authType}</Card.Meta>
|
<Card.Meta>{authType}</Card.Meta>
|
||||||
{isIconName(iconName) && (
|
{isIconName(iconName) && (
|
||||||
|
|||||||
Reference in New Issue
Block a user