Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Setup linter for PR #112

Merged
merged 4 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build Package CI

on: [push]
on:
push:
branches:
- master

jobs:
build:
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Pull Request CI

on:
pull_request:
types:
- synchronize
- opened
- reopened
- ready_for_review
- unlocked
- review_requested

jobs:
validate:
runs-on: ubuntu-18.04

strategy:
matrix:
node: [14]

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- name: Node.JS ${{matrix.node}}
uses: actions/setup-node@v2
with:
node-version: ${{matrix.node}}

- name: Install dependencies
run: yarn install

- name: Build Woly
run: yarn build

- name: Check for formatting
run: yarn format

- name: Check for code style
run: yarn lint:code

- name: Check for CSS issues
run: yarn lint:style

- name: Run tests
run: yarn test
3 changes: 2 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": [
"stylelint-config-recommended",
"stylelint-config-styled-components",
"stylelint-config-rational-order"
],
"rules": {
Expand All @@ -10,6 +11,6 @@
"empty-line-between-groups": true
}
],
"rule-empty-line-before": "always-multi-line"
"no-descending-specificity": null
}
}
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"build": "rm -rf dist && node build",
"commit": "git-cz",
"docs:build": "gatsby clean && gatsby build --prefix-paths",
"format": "prettier --write '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"lint:code": "eslint --fix --ext .ts,.tsx src",
"lint:style": "stylelint ./src/**/*.{js,css,ts,tsx} --fix",
"format": "prettier --check '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"format:fix": "prettier --write '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"lint:code": "eslint --ext .ts,.tsx src",
"lint:code:fix": "yarn lint:code --fix",
"lint:style": "stylelint './src/**/*.{js,css,ts,tsx}'",
"percy:cypress": "percy exec -- cypress run",
"start": "gatsby clean && gatsby develop",
"test:visual": "start-server-and-test 'yarn start' http://localhost:8000/package/woly/component/button 'yarn percy:cypress'",
Expand Down Expand Up @@ -85,6 +87,8 @@
"stylelint": "^13.9.0",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-recommended": "^3.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"ts-loader": "^8.0.16",
"typescript": "^4.1.3",
"webpack": "^4"
Expand Down
5 changes: 3 additions & 2 deletions src/ui/atoms/backdrop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import styled from 'styled-components';

export const Backdrop = styled.div`
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
bottom: 0;
left: 0;

background: rgba(0, 0, 0, 0.3);
`;
16 changes: 10 additions & 6 deletions src/ui/atoms/button-icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@ const ButtonIconBase: React.FC<Props & Variant> = ({

export const ButtonIcon = styled(ButtonIconBase)`
${box}
--local-vertical: calc(
1px * var(--woly-component-level) * var(--woly-main-level)
);

--local-vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--local-shape-color: var(--woly-canvas-default);
--local-icon-size: calc(var(--woly-line-height));
--local-button-size: calc(var(--local-icon-size) + (var(--local-vertical) * 2));
--local-icon-color: var(--woly-shape-default);

display: flex;
justify-content: center;

align-items: center;
justify-content: center;
box-sizing: border-box;

width: var(--local-button-size);
height: var(--local-button-size);

background: var(--local-shape-color);
border: var(--woly-border-width) solid var(--local-shape-color);
border-radius: var(--woly-rounding);
cursor: pointer;
background: var(--local-shape-color);
outline: none;
cursor: pointer;

[data-icon] {
display: flex;
align-items: center;
justify-content: center;

svg {
width: var(--local-icon-size);
height: var(--local-icon-size);
Expand All @@ -59,6 +59,7 @@ export const ButtonIcon = styled(ButtonIconBase)`
svg > path {
fill: var(--local-icon-color);
}

svg > g {
stroke: var(--local-icon-color);
}
Expand All @@ -71,13 +72,16 @@ export const ButtonIcon = styled(ButtonIconBase)`
&:active {
--local-shape-color: var(--woly-focus);
}

&:focus {
--local-shape-color: var(--woly-shape-active);
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
}

&:hover {
--local-shape-color: var(--woly-shape-hover);
}

&:disabled {
--local-shape-color: var(--woly-canvas-disabled);
}
Expand Down
8 changes: 5 additions & 3 deletions src/ui/atoms/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ export const Button = styled(ButtonBase)`
--local-shape-color: var(--woly-shape-default);
--local-border-color: var(--woly-shape-default);

${box};
${box}

box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
justify-content: center;

box-sizing: border-box;

color: var(--local-text-color);
font-size: var(--woly-font-size);
line-height: var(--woly-line-height);
Expand All @@ -60,9 +61,10 @@ export const Button = styled(ButtonBase)`
outline: none;

&[data-outlined='true'] {
background-color: transparent;
color: var(--local-shape-color);

background-color: transparent;

svg > path {
fill: var(--local-shape-color);
}
Expand Down
15 changes: 9 additions & 6 deletions src/ui/atoms/chip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,28 @@ export const Chip = styled(ChipBase)`
--local-color: var(--woly-shape-text-default);
--local-border-color: var(--woly-shape-default);

box-sizing: border-box;
display: flex;
align-items: center;
background-color: var(--local-background);

box-sizing: border-box;

color: var(--local-color);
border-radius: var(--woly-rounding);
font-size: var(--woly-font-size);
outline: none;

background-color: var(--local-background);
border: var(--woly-border-width) solid var(--local-border-color);
border-radius: var(--woly-rounding);
outline: none;

[data-text] {
outline: none;
line-height: var(--woly-line-height);

outline: none;
}

&[role='button']:focus-within {
--local-background: var(--woly-focus);
--local-border-color: var(--woly-shape-active);

box-shadow: 0 0 0 var(--woly-border-width) var(--woly-shape-default);
}

Expand Down
12 changes: 6 additions & 6 deletions src/ui/atoms/header-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ const map = (properties: Variant) => ({
export const HeaderPanel = styled.div.attrs(map)`
display: flex;
align-items: center;

height: 100%;
width: 100%;

--local-vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--local-horizontal: calc(
var(--woly-const-m) + (1px * var(--woly-main-level)) + var(--local-vertical)
);
height: 100%;

padding: var(--local-vertical) var(--local-horizontal);

background-color: var(--woly-background);
border: var(--woly-border-width) solid var(--woly-background);
border-radius: var(--woly-rounding);
box-shadow: var(--woly-shadow);

--local-vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--local-horizontal: calc(
var(--woly-const-m) + (1px * var(--woly-main-level)) + var(--local-vertical)
);
` as StyledComponent<'div', Record<string, unknown>, Variant>;
2 changes: 1 addition & 1 deletion src/ui/atoms/heading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export const Heading = styled.span.attrs(map)`
--local-color: var(--woly-canvas-text-default);

color: var(--local-color);
font-weight: 500;
font-size: 24px;
line-height: 30px;
font-weight: 500;
&[data-size='2'] {
font-size: 21px;
line-height: 27px;
Expand Down
14 changes: 8 additions & 6 deletions src/ui/atoms/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export const ListContainer = styled.div.attrs(mapContainer)`
display: grid;
grid-template-columns: 1fr;
gap: var(--local-gap);
background-color: var(--woly-shape-text-default);
padding: 0;
margin: 0;
padding: 0;

background-color: var(--woly-shape-text-default);
` as StyledComponent<'div', Record<string, unknown>, Variant>;

export const ListItem: React.FC<ListItemProps & ListElementsProps & Variant> = ({
Expand Down Expand Up @@ -67,17 +68,18 @@ const ListItemContainer = styled.div.attrs(mapItem)`
${box}
--local-icon-color: var(--woly-canvas-text-default);
--local-backgound: var(--woly-canvas-default);
--local-color: var(--woly-canvas-text-default)
--local-color: var(--woly-canvas-text-default);

cursor: pointer;
color: var(--local-color);
font-size: var(--woly-font-size);
line-height: var(--woly-line-height);
text-decoration: none;
background-color: var(--local-backgound);
color: var(--local-color);

list-style-type: none;

background-color: var(--local-backgound);
cursor: pointer;

span {
svg > path {
fill: var(--local-icon-color);
Expand Down
1 change: 1 addition & 0 deletions src/ui/atoms/separator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const Separator = styled(SeparatorBase)`

[data-line] {
height: var(--woly-border-width);

background: var(--woly-canvas-disabled);
}
` as StyledComponent<'div', Record<string, unknown>, Variant>;
18 changes: 11 additions & 7 deletions src/ui/atoms/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const Table = styled.table.attrs(map)`
--local-gap: calc(var(--woly-const-m) / 2);

display: grid;
gap: var(--local-gap);
grid-template-columns: repeat(var(--local-columns), auto);
gap: var(--local-gap);
`;

export const Thead = styled.thead`
Expand All @@ -28,19 +28,23 @@ export const Tbody = styled.tbody`
`;

export const Th = styled.th`
padding: var(--local-vertical) var(--local-horizontal);
max-width: var(--local-cell-max-width);
box-sizing: border-box;
background: var(--woly-shape-text-default);
max-width: var(--local-cell-max-width);
padding: var(--local-vertical) var(--local-horizontal);

color: var(--woly-canvas-text-disabled);

background: var(--woly-shape-text-default);
`;

export const Td = styled.td`
padding: var(--local-vertical) var(--local-horizontal);
max-width: var(--local-cell-max-width);
box-sizing: border-box;
background: var(--woly-shape-text-default);
max-width: var(--local-cell-max-width);
padding: var(--local-vertical) var(--local-horizontal);

color: var(--woly-canvas-text-default);

background: var(--woly-shape-text-default);
`;

export const Tr = styled.tr`
Expand Down
Loading