Skip to content

Commit ee8bb81

Browse files
colinrotherhamrichard smith
andauthored
Use modern JSX runtime with Babel, named exports, verbatim syntax (#271)
* Preserve build output (non-minified) for all modules * Fix TypeScript "Type 'NodeListOf<HTMLElement>' must have a '[Symbol.iterator]()' method that returns an iterator" * Make sure source maps include original sources * Configure Babel with Browserslist * Use named exports, package imports and verbatim syntax * Fix missing README upgrade link * Configure Rollup build with Babel * Switch to modern JSX runtime * Fix tests that relied on classic JSX runtime * Fix deprecated Jest assertions * Avoid circular dependencies * Remove unused packages * Remove unused Jest mock * Update test packages * Update snapshots * Use package imports for stories * Use correct file extensions for exported modules * Always export util types and guards * Fix TypeScript compiler issues * Set up TypeScript references * Add mandatory ES module file extensions to sources * Remove mandatory ES module file extensions for Jest * Remove mostly duplicate `:ci` npm scripts * Split out ESLint only `lint:js` npm script * Split out TypeScript only `lint:types` npm script * Split out Prettier only `lint:prettier` npm script * Enable Prettier `"quoteProps": "consistent"` * Update to ESLint v9 * Enable ESLint editor validation for JSX * Remove ESLint rules we should fix instead * Turn off ESLint rules handled by TypeScript * Fix ESLint "Cannot reassign variables declared outside of the component/hook" * Fix ESLint missing React hook dependencies * Fix ESLint unnecessary disable comments * Fix ESLint remaining issues * Fix missing lodash package * Upgrade to latest Yarn stable * Upgrade TypeScript with resolutions * Require React v18.2 minimum version * Upgrade to React v19 * Upgrade to React v19 compatible packages * Restore `'use client'` for Next.js * Updating component library to latest Storybook for React * Update changelog for previous fixes * Add panel component * Add changelog entry * Update package version to v6.0.0-beta.1 * Add JSDoc types --------- Co-authored-by: richard smith <[email protected]>
1 parent 144c5a7 commit ee8bb81

File tree

343 files changed

+6891
-7517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

343 files changed

+6891
-7517
lines changed

.browserslistrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[javascripts]
2+
supports es6-module
3+
4+
[node]
5+
node 22

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ jobs:
2222
- name: Yarn Install
2323
run: yarn
2424
- name: Lint
25-
run: yarn lint:ci
25+
run: yarn lint
2626
- name: Jest Tests
27-
run: yarn test:ci
27+
run: yarn test --coverage
2828
- name: Typescript build
2929
run: yarn build
3030
- name: Storybook build

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828
run: yarn
2929

3030
- name: Lint
31-
run: yarn lint:ci
31+
run: yarn lint
3232

3333
- name: Jest Tests
34-
run: yarn test:ci
34+
run: yarn test --coverage
3535

3636
- name: Typescript build
3737
run: yarn build

.prettierignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Node.js modules
2+
node_modules/
3+
4+
# Test coverage
5+
coverage/
6+
7+
# Build output
8+
dist/
9+
10+
# Files to ignore
11+
.yarnrc.yml
12+
package-lock.json

.prettierrc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2+
"printWidth": 100,
3+
"quoteProps": "consistent",
24
"semi": true,
3-
"trailingComma": "all",
45
"singleQuote": true,
5-
"printWidth": 100,
6-
"tabWidth": 2
6+
"tabWidth": 2,
7+
"trailingComma": "all"
78
}

.storybook/main.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,29 @@ import tsConfigPaths from 'vite-tsconfig-paths';
44

55
const config: StorybookConfig = {
66
stories: ['../stories/**/*.stories.@(ts|tsx)', '../stories/**/*.mdx'],
7-
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
7+
addons: ['@storybook/addon-links', '@storybook/addon-docs'],
88
framework: {
99
name: '@storybook/react-vite',
1010
options: {},
1111
},
12-
docs: {
13-
autodocs: true,
14-
},
12+
1513
typescript: {
1614
reactDocgen: 'react-docgen-typescript',
1715
},
16+
1817
viteFinal(config) {
1918
return mergeConfig(config, {
2019
plugins: [tsConfigPaths()],
20+
css: {
21+
preprocessorOptions: {
22+
scss: {
23+
quietDeps: true,
24+
loadPaths: ['node_modules'],
25+
},
26+
},
27+
},
2128
});
2229
},
2330
};
31+
2432
export default config;

.storybook/manager.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import { addons } from '@storybook/manager-api';
1+
import { addons } from 'storybook/manager-api';
22
import nhsTheme from './theme';
33
import { startCase, upperFirst } from 'lodash';
44

5-
const sentenceCase = (string) => {
6-
if (typeof string !== 'string') return '';
7-
return upperFirst(startCase(string).toLowerCase());
5+
const sentenceCase = (name = '') => {
6+
if (!name || typeof name !== 'string') {
7+
return '';
8+
}
9+
10+
return upperFirst(startCase(name).toLowerCase());
811
};
912

1013
addons.setConfig({
1114
sidebar: {
12-
renderLabel: ({ name, type }) => sentenceCase(name),
15+
renderLabel: ({ name }) => sentenceCase(name),
1316
},
1417
theme: nhsTheme,
1518
});

.storybook/preview.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import './storybook.scss';
2-
import { Preview } from '@storybook/react';
2+
import { type Preview } from '@storybook/react-vite';
33

44
const preview: Preview = {
55
parameters: {
@@ -18,5 +18,8 @@ const preview: Preview = {
1818
},
1919
},
2020
},
21+
22+
tags: ['autodocs'],
2123
};
24+
2225
export default preview;

0 commit comments

Comments
 (0)