Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-sanderson committed Nov 7, 2024
1 parent 40143d6 commit fb7a053
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
23 changes: 21 additions & 2 deletions eslint-local-rules/rules.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Rule } from 'eslint';
import { Button } from '@trezor/components/libDev/src';

export default {
'no-override-ds-component': {
Expand Down Expand Up @@ -56,14 +57,32 @@ export default {
TaggedTemplateExpression(node) {
if (
node.tag.type === 'CallExpression' &&
node.tag.callee.name === 'styled' &&
node.tag.arguments[0].type === 'Identifier'
node.tag.callee.name === 'styled' // &&
// node.tag.arguments[0].type === 'Identifier'
) {
const componentName = node.tag.arguments[0].name;

// if (componentName === 'Button') {
// console.log('componentName', componentName);
// console.log('importedComponents', importedComponents);
// }

// if (componentName === 'Button') {
// throw new Error('test');
// }

// Check if component name matches any imported component from the specified packages
for (const [pkgName, components] of importedComponents) {
console.log(
components,
'has',
componentName,
components.has(componentName),
);

if (components.has(componentName)) {
console.log('reporting...', pkgName, node.tag.arguments[0].name);

context.report({
node,
messageId: 'avoidStyledComponent',
Expand Down
8 changes: 0 additions & 8 deletions packages/protobuf/eslint.config.mjs

This file was deleted.

1 change: 0 additions & 1 deletion packages/protobuf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"protobufjs": "7.4.0"
},
"devDependencies": {
"@trezor/eslint": "workspace:*",
"protobufjs-cli": "^1.1.3",
"tsx": "^4.16.3"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled, { useTheme } from 'styled-components';

import { BigNumber } from '@trezor/utils/src/bigNumber';
import { Badge, Button, Card, Icon, Row, Tooltip, variables } from '@trezor/components';
import { Badge, Button, Card, Icon, IconButton, Row, Tooltip, variables } from '@trezor/components';
import { spacings, spacingsPx } from '@trezor/theme';
import { selectAccountStakeTransactions } from '@suite-common/wallet-core';
import { getAccountEverstakeStakingPool, isPending } from '@suite-common/wallet-utils';
Expand Down Expand Up @@ -56,8 +56,18 @@ const ButtonsWrapper = styled.div`
flex-wrap: wrap;
`;

const x = styled(IconButton)``;

const y = styled(Button);

const z = styled(Card)``;

console.log(x, y, z);

// eslint-disable-next-line local-rules/no-override-ds-component
const StyledButton = styled(Button).attrs(props => ({
const StyledButtonToTriggerLint = styled(Button)``;

const StyledButton = StyledButtonToTriggerLint.attrs(props => ({
...props,
variant: 'tertiary',
type: 'button',
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11652,7 +11652,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@trezor/protobuf@workspace:packages/protobuf"
dependencies:
"@trezor/eslint": "workspace:*"
"@trezor/schema-utils": "workspace:*"
protobufjs: "npm:7.4.0"
protobufjs-cli: "npm:^1.1.3"
Expand Down

0 comments on commit fb7a053

Please sign in to comment.