Skip to content

Commit

Permalink
chore(pie-monorepo): DSW-000 update typescript eslint plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
xander-marjoram committed Jul 25, 2024
2 parents 04dc45b + 927b800 commit 3b0bec2
Show file tree
Hide file tree
Showing 93 changed files with 954 additions and 4,440 deletions.
7 changes: 7 additions & 0 deletions .changeset/light-badgers-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@justeattakeaway/pie-checkbox": minor
---

[Changed] - Replaced label prop with a slot to give consumers the option to easily customize the label.
[Changed] - Fixed the rtl styles for the tick/dash for checked/indeterminate state.
[Changed] - Updated visual tests.
6 changes: 6 additions & 0 deletions .changeset/modern-melons-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@justeattakeaway/pie-button": minor
---

[Changed] - Styles now use classmap
[Fixed] - Fixed background colour when button is in `xsmall` or `small` size and responsive mode is true, where the bg-color wasn't updating to orange as required
7 changes: 7 additions & 0 deletions .changeset/neat-cooks-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@justeattakeaway/pie-checkbox": patch
"@justeattakeaway/pie-switch": patch
"@justeattakeaway/pie-webc": patch
---

[Changed] - isRtl attr changed to data-is-rtl
7 changes: 7 additions & 0 deletions .changeset/polite-carpets-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@justeattakeaway/pie-checkbox-group": minor
---

[Added] - New `isInline` prop.
[Added] - Styling for Checkbox Group.
[Added] - Visual tests.
5 changes: 5 additions & 0 deletions .changeset/six-ducks-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wc-react17": minor
---

[Added] - pie-webc integration to react app
1 change: 1 addition & 0 deletions apps/examples/wc-react17/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
root: true,
extends: [
require.resolve('@justeattakeaway/eslint-config-pie/strict'),
],
Expand Down
43 changes: 21 additions & 22 deletions apps/examples/wc-react17/.gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

.yarn/*

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
22 changes: 11 additions & 11 deletions apps/examples/wc-react17/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Getting Started with Create React App
# React + Vite

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

## Available Scripts
Currently, two official plugins are available:

In the project directory, you can run:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
## Available Scripts

The page will reload when you make changes.\
You may also see any lint errors in the console.
In the project directory, you can run:

### `yarn dev`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
Runs the app in the development mode.

The page will reload when you make changes.
You may also see any lint errors in the console.
13 changes: 13 additions & 0 deletions apps/examples/wc-react17/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
28 changes: 20 additions & 8 deletions apps/examples/wc-react17/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
{
"name": "wc-react17",
"version": "0.4.43",
"private": true,
"version": "0.4.43",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@justeattakeaway/pie-button": "0.47.8",
"@justeattakeaway/pie-css": "0.12.1",
"@lit/react": "1.0.2",
"@justeattakeaway/pie-webc": "0.5.13",
"@lit/react": "1.0.5",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "5.0.1"
"react-dom": "17.0.2"
},
"scripts": {
"dev": "react-scripts start",
"build:examples": "react-scripts build"
"devDependencies": {
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@vitejs/plugin-react": "4.3.1",
"eslint": "8.57.0",
"eslint-plugin-react": "7.34.3",
"eslint-plugin-react-hooks": "4.6.2",
"eslint-plugin-react-refresh": "0.4.7",
"vite": "5.3.4"
},
"browserslist": {
"production": [
Expand Down
43 changes: 0 additions & 43 deletions apps/examples/wc-react17/public/index.html

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PieButton } from '@justeattakeaway/pie-button/dist/react';
import { PieButton } from '@justeattakeaway/pie-webc/react/button.js';

import '@justeattakeaway/pie-css';
import './styles.css';
import './App.css';

function App () {
return (
Expand Down
10 changes: 0 additions & 10 deletions apps/examples/wc-react17/src/index.js

This file was deleted.

10 changes: 10 additions & 0 deletions apps/examples/wc-react17/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App.jsx";

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
);
7 changes: 7 additions & 0 deletions apps/examples/wc-react17/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
4 changes: 1 addition & 3 deletions apps/pie-docs/src/_11ty/shortcodes/componentStatusTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const buildRow = (cells, headings) => cells.map((cell) => {
headings.map((heading) => {
if ('componentName' in cell) {
content = `<a class="c-componentStatus-link" href="/components/${cell.componentName.toLowerCase().replace(' ', '-')}">${cell.componentName}</a>`;
} else

if (heading.title === cell.resource) {
} else if (heading.title === cell.resource) {
const { bgColor, status } = statusSettings[cell.status];
content = `<span class="c-componentStatus-status" style="--bg-colour: ${bgColor}; margin-inline-start: 30px;">${status}</span>`;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/pie-storybook/data/tag-variants-to-statuses-map.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TagVariantToStatusMap } from '../interfaces/tag-variant-to-status-map';
import { type TagVariantToStatusMap } from '../interfaces/tag-variant-to-status-map';

export const tagVariantToStatusMap: TagVariantToStatusMap = {
alpha: 'yellow',
Expand Down
6 changes: 3 additions & 3 deletions apps/pie-storybook/decorators/component-status.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { TemplateResult, html } from 'lit';
import { type TemplateResult, html } from 'lit';
import '@justeattakeaway/pie-tag';
import '@justeattakeaway/pie-icons-webc/dist/IconHelpCircle.js';
import componentStatusesJson from '../component-statuses.json';
import { StorybookContext } from '../interfaces/storybook-context';
import { ComponentStatuses } from '../interfaces/component-status';
import { type StorybookContext } from '../interfaces/storybook-context';
import { type ComponentStatuses } from '../interfaces/component-status';
import { tagVariantToStatusMap } from '../data/tag-variants-to-statuses-map';

const componentStatuses: ComponentStatuses = componentStatusesJson;
Expand Down
4 changes: 2 additions & 2 deletions apps/pie-storybook/decorators/writing-direction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TemplateResult } from 'lit';
import { StorybookContext } from '../interfaces/storybook-context';
import { type TemplateResult } from 'lit';
import { type StorybookContext } from '../interfaces/storybook-context';

export const WritingDirection = (story: () => TemplateResult, storybookContext: StorybookContext) => {
const { globals } = storybookContext;
Expand Down
4 changes: 2 additions & 2 deletions apps/pie-storybook/stories/pie-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { ifDefined } from 'lit/directives/if-defined.js';
/* eslint-disable import/no-duplicates */
import '@justeattakeaway/pie-button';
import {
ButtonProps as ButtonPropsBase, iconPlacements, sizes, types, variants, responsiveSizes, defaultProps,
type ButtonProps as ButtonPropsBase, iconPlacements, sizes, types, variants, responsiveSizes, defaultProps,
} from '@justeattakeaway/pie-button';
/* eslint-enable import/no-duplicates */
import '@justeattakeaway/pie-icons-webc/dist/IconPlusCircle.js';

import { createStory, type TemplateFunction, sanitizeAndRenderHTML } from '../utilities';
import { StoryMeta, SlottedComponentProps } from '../types';
import { type StoryMeta, type SlottedComponentProps } from '../types';

type ButtonProps = SlottedComponentProps<ButtonPropsBase>;
type ButtonStoryMeta = StoryMeta<ButtonProps>;
Expand Down
2 changes: 1 addition & 1 deletion apps/pie-storybook/stories/pie-card.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
/* eslint-disable import/no-duplicates */
import '@justeattakeaway/pie-card';
import {
CardProps as CardPropsBase, variants, tags, paddingValues, defaultProps,
type CardProps as CardPropsBase, variants, tags, paddingValues, defaultProps,
} from '@justeattakeaway/pie-card';
/* eslint-enable import/no-duplicates */

Expand Down
52 changes: 29 additions & 23 deletions apps/pie-storybook/stories/pie-checkbox-group.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { html } from 'lit';
import { ifDefined } from 'lit/directives/if-defined.js';
/* eslint-disable import/no-duplicates */
import '@justeattakeaway/pie-checkbox-group';
import { CheckboxGroupProps, defaultProps, statusTypes } from '@justeattakeaway/pie-checkbox-group';
import { type CheckboxGroupProps, defaultProps, statusTypes } from '@justeattakeaway/pie-checkbox-group';
/* eslint-enable import/no-duplicates */

import { type StoryMeta } from '../types';
Expand All @@ -29,6 +29,13 @@ const checkboxGroupStoryMeta: CheckboxGroupStoryMeta = {
description: 'The visible label for the checkbox group.',
control: 'text',
},
isInline: {
description: 'Inline (horizontal) positioning of checkbox items.',
control: 'boolean',
defaultValue: {
summary: defaultArgs.isInline,
},
},
status: {
description: 'The status of the checkbox group component / assistive text. Can be default, success or error.',
control: 'select',
Expand Down Expand Up @@ -66,32 +73,31 @@ export default checkboxGroupStoryMeta;
const Template = ({
name,
label,
isInline,
assistiveText,
status,
disabled,
}: CheckboxGroupProps) => html`
<p>Please note, the checkboxes are separate components. See
<pie-link href="/?path=/story/checkbox--default">pie-checkbox</pie-link>.</p>
<pie-checkbox-group
name="${ifDefined(name)}"
label="${ifDefined(label)}"
assistiveText="${ifDefined(assistiveText)}"
status=${ifDefined(status)}
?disabled="${disabled}"
>
<pie-checkbox
name="checkbox-one"
label="checkbox 1">
</pie-checkbox>
<pie-checkbox
name="checkbox-two"
label="checkbox 2">
</pie-checkbox>
<pie-checkbox
name="checkbox-three"
label="checkbox 3">
</pie-checkbox>
</pie-checkbox-group>
<div style="max-width: 400px">
<p>Please note, the checkboxes are separate components. See
<pie-link href="/?path=/story/checkbox--default">pie-checkbox</pie-link>.</p>
<pie-checkbox-group
name="${ifDefined(name)}"
label="${ifDefined(label)}"
assistiveText="${ifDefined(assistiveText)}"
?isInline=${isInline}
status=${ifDefined(status)}
?disabled="${disabled}"
>
<pie-checkbox name="checkbox-one">checkbox 1</pie-checkbox>
<pie-checkbox name="checkbox-two">checkbox 2</pie-checkbox>
<pie-checkbox name="checkbox-three">checkbox 3 longer label</pie-checkbox>
<pie-checkbox name="checkbox-three">checkbox 4</pie-checkbox>
<pie-checkbox name="checkbox-three">checkbox 5 even longer label: Lorem ipsum dolor sit amet,
consectetur adipiscing elit.</pie-checkbox>
<pie-checkbox name="checkbox-three">checkbox 6</pie-checkbox>
</pie-checkbox-group>
</div>
`;

export const Default = createStory<CheckboxGroupProps>(Template, defaultArgs)();
Loading

0 comments on commit 3b0bec2

Please sign in to comment.