Skip to content

Commit b470388

Browse files
authored
Merge pull request #2131 from CDCgov/test
Test
2 parents 2fc71ab + a316722 commit b470388

File tree

274 files changed

+19505
-11044
lines changed

Some content is hidden

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

274 files changed

+19505
-11044
lines changed

.eslintrc.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,15 @@
44
"ecmaVersion": "latest",
55
"sourceType": "module"
66
},
7-
"plugins": [
8-
"@typescript-eslint"
9-
],
7+
"plugins": ["@typescript-eslint", "eslint-plugin-prettier"],
108
"extends": [
11-
"plugin:jsx-a11y/recommended",
9+
// "plugin:jsx-a11y/recommended",
1210
"prettier",
1311
"plugin:react-hooks/recommended"
1412
],
1513
"rules": {
16-
"import/no-named-as-default": 0,
17-
"no-labels": 0,
18-
"no-unused-labels": 0,
19-
"no-console": 1,
20-
"import/no-anonymous-default-export": 0
14+
"no-console": ["error", { "allow": ["error"] }],
15+
"no-debugger": "error",
16+
"react-hooks/exhaustive-deps": "off"
2117
}
22-
}
18+
}

.github/workflows/lint_staged.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Lint Staged Files
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'packages/**/*.{js,jsx,ts,tsx}'
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '16' # or the version you're using
20+
21+
- name: Install dependencies
22+
run: |
23+
npm install
24+
25+
- name: Lint staged files
26+
run: |
27+
STAGED_FILES=$(git diff --cached --name-only --diff-filter=AM | grep -E '\.(js|jsx|ts|tsx)$' || true)
28+
29+
if [ -n "$STAGED_FILES" ]; then
30+
npx eslint $STAGED_FILES
31+
else
32+
echo "No staged files to lint."
33+
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Reject PRs with new .scss Files
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
jobs:
8+
check-scss-files:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
15+
- name: Fetch base branch
16+
run: git fetch origin ${{ github.event.pull_request.base.ref }}
17+
18+
- name: Check for new .scss files in the PR
19+
run: |
20+
# Get the list of changed files in the PR
21+
added_files=$(git diff --diff-filter=A --name-only origin/${{ github.event.pull_request.base.ref }} ${{ github.sha }})
22+
23+
# Check if any .scss files are present
24+
if echo "$added_files" | grep -q '\.scss$'; then
25+
echo "Error: PR contains newly added .scss files."
26+
exit 1
27+
else
28+
echo "No new .scss files found in the PR."
29+
fi
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test Storybook
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
storybook-tests:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: 18
18+
cache: yarn
19+
20+
- name: Install dependencies
21+
run: yarn install --frozen-lockfile
22+
23+
- name: Build Packages
24+
run: lerna run build
25+
26+
- name: Build Storybook
27+
run: yarn build-storybook --output-dir storybook-static
28+
29+
- name: Add Playwright
30+
run: npx playwright install
31+
32+
- name: Start Storybook
33+
run: yarn storybook -p 6006 &
34+
35+
- name: Wait for Storybook to be available
36+
run: npx wait-on http://localhost:6006
37+
38+
- name: Run Storybook tests
39+
run: yarn test-storybook

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Run lint-staged to check for eslint issues before commit
5+
npx lint-staged

.prettierignore

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
node_modules
2-
packages/map/src/data/us-topo.json
3-
packages/map/src/data/world-topo.json
4-
packages/map/src/data/us-hex.json
5-
packages/map/src/data/us-regions-topo.json
6-
packages/map/src/data/us-regions-topo-2.json
7-
packages/map/src/data/county-topo.json
8-
packages/map/src/data/county-map.json

.storybook/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import svgr from 'vite-plugin-svgr' // Svg Support
66
const config: StorybookConfig = {
77
stories: [
88
'../_stories/*.mdx',
9-
'../packages/**/_stories/*.stories.@(js|jsx|ts|tsx)',
9+
'../packages/**/_stories/*.stories.@(js|jsx|ts|tsx|mdx)',
1010
'../_stories/private/**/*.stories.@(js|jsx|ts|tsx)'
1111
],
1212
addons: [
1313
'@storybook/addon-links',
1414
'@storybook/addon-essentials',
1515
'@storybook/addon-interactions',
1616
'storybook-addon-fetch-mock',
17-
'@storybook/addon-a11y'
17+
'@storybook/addon-a11y',
18+
'@storybook/addon-docs'
1819
],
1920
staticDirs: ['./assets'],
2021
framework: {

generateViteConfig.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ dns.setDefaultResultOrder('verbatim')
1414
// - Active dev servers ('lerna run start') must be restarted in order to view the changed settings.
1515
const generateViteConfig = (componentName, configOptions = {}, reactOptions = {}) => {
1616
let configOptionsDefault = {
17-
server: { port: 8080 },
17+
server: {
18+
port: 8080,
19+
headers: {
20+
'Access-Control-Allow-Origin': '*'
21+
}
22+
},
1823
build: {
1924
commonjsOptions: {
2025
include: [/@cdc\/core/, /node_modules/]

package.json

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@
2424
"@storybook/manager-api": "^7.4.6",
2525
"@storybook/react": "^7.4.6",
2626
"@storybook/react-vite": "^7.4.6",
27+
"@storybook/test-runner": "0.12.0",
2728
"@storybook/testing-library": "^0.2.2",
2829
"@storybook/theming": "^7.4.6",
2930
"@testing-library/jest-dom": "^5.16.5",
3031
"@testing-library/react": "^14.0.0",
32+
"@types/chroma-js": "^3.1.1",
33+
"@types/papaparse": "^5.3.15",
3134
"@types/react": "^18.0.26",
3235
"@types/react-dom": "^18.0.9",
3336
"@types/resize-observer-browser": "^0.1.5",
3437
"@typescript-eslint/eslint-plugin": "^6.8.0",
3538
"@typescript-eslint/parser": "^7.0.1",
36-
"@visx/group": "^3.0.0",
39+
"@visx/group": "3.12.0",
3740
"@visx/heatmap": "^3.0.0",
38-
"@visx/scale": "^3.0.0",
3941
"@vitejs/plugin-react": "^4.3.4",
4042
"@vitest/coverage-c8": "^0.29.2",
4143
"@vitest/ui": "^0.29.2",
@@ -53,11 +55,11 @@
5355
"eslint-plugin-react-hooks": "^4.6.0",
5456
"eslint-plugin-storybook": "^0.6.11",
5557
"gh-pages": "^5.0.0",
56-
"html-react-parser": "^3.0.8",
57-
"husky": "^4.3.0",
58+
"html-react-parser": "5.2.3",
59+
"husky": "^8.0.0",
5860
"jsdom": "^22.1.0",
5961
"lerna": "^7.1.3",
60-
"lint-staged": "^10.4.0",
62+
"lint-staged": "^15.5.1",
6163
"lodash": "^4.17.21",
6264
"lodash.get": "^4.4.2",
6365
"lodash.merge": "^4.6.2",
@@ -69,7 +71,7 @@
6971
"react": "^18.2.0",
7072
"react-dnd": "^16.0.1",
7173
"react-dom": "^18.2.0",
72-
"react-tooltip": "^5.7.2",
74+
"react-tooltip": "5.8.2-beta.3",
7375
"react-visibility-sensor": "^5.1.1",
7476
"resize-observer-polyfill": "^1.5.1",
7577
"rollup-plugin-node-externals": "^6.1.2",
@@ -82,31 +84,37 @@
8284
"vite-plugin-md": "^0.21.5",
8385
"vite-plugin-svgr": "^2.4.0",
8486
"vitest": "^1.2.2",
85-
"whatwg-fetch": "^3.6.2"
87+
"whatwg-fetch": "3.6.20"
8688
},
8789
"lint-staged": {
8890
"./packages/*/src/**/*.{js,jsx,ts,tsx}": [
89-
"npx prettier --write",
90-
"eslint --config .eslintrc.json"
91+
"eslint --config .eslintrc.json",
92+
"npx prettier --write"
9193
]
9294
},
9395
"scripts": {
9496
"clean": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
9597
"publish": "npx lerna publish",
9698
"storybook": "storybook dev -p 6006",
99+
"test-storybook": "npx test-storybook",
97100
"storybook-docs": "storybook dev --docs",
98101
"build-storybook": "storybook build",
99102
"predeploy": "storybook build --output-dir .storybook_build && touch .storybook_build/.nojekyll",
100-
"deploy": "gh-pages -d .storybook_build -t true"
103+
"deploy": "gh-pages -d .storybook_build -t true",
104+
"lint": "eslint packages/*/src/**/*.{js,jsx,ts,tsx}",
105+
"prepare": "husky install"
101106
},
102107
"dependencies": {
103108
"@visx/annotation": "^3.3.0",
104109
"@visx/brush": "^3.0.1",
105-
"@visx/legend": "^3.0.0",
110+
"@visx/legend": "3.12.0",
106111
"@visx/pattern": "^3.0.0",
107112
"@visx/responsive": "^2.10.0",
108113
"@vitest/coverage-v8": "^1.2.2",
109-
"dompurify": "^3.1.5"
114+
"chroma-js": "3.1.2",
115+
"dompurify": "^3.1.5",
116+
"papaparse": "5.5.2",
117+
"react-table": "7.8.0"
110118
},
111119
"resolutions": {
112120
"jackspeak": "2.1.1"

packages/chart/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
-->
4646

4747
<!-- GENERIC CHART TYPES -->
48-
<div class="react-container" data-config="/examples/private/ari-other-conditions-1.json"></div>
48+
<!-- <div class="react-container" data-config="/examples/private/ari-other-conditions-1.json"></div> -->
49+
<!-- <div class="react-container" data-config="/examples/private/Viral-Respiratory-Deaths-Age.json"></div> -->
4950
<!-- <div class="react-container" data-config="/examples/cases-year.json"></div>-->
5051
<!-- <div class="react-container" data-config="/examples/test.json"></div> -->
5152
<!-- <div class="react-container" data-config="/examples/feature/line/line-chart.json"></div> -->

0 commit comments

Comments
 (0)