Skip to content

Commit c964560

Browse files
authored
feat: vanilla extract based components (#17)
this adds the design system implementation
1 parent 35f7587 commit c964560

File tree

184 files changed

+9186
-181
lines changed

Some content is hidden

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

184 files changed

+9186
-181
lines changed

.eslintignore

+9
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ dist
88
*.lock
99
*.npmignore
1010
examples/**
11+
docs/.next/
12+
docs/public/playroom/
13+
14+
components/dist/
15+
components/coverage/
16+
components/src/components/icons/generated/
17+
18+
.yarn/*
19+
yarn.lock

.eslintrc.js

+32-2
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,49 @@ module.exports = {
55
parserOptions: {
66
tsconfigRootDir: __dirname,
77
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
8+
ecmaVersion: 8,
9+
sourceType: "module",
10+
ecmaFeatures: {
11+
impliedStrict: true,
12+
experimentalObjectRestSpread: true
13+
},
14+
allowImportExportEverywhere: true
815
},
9-
plugins: ['@typescript-eslint', 'react-hooks', 'eslint-plugin-tsdoc'],
16+
plugins: [
17+
"@typescript-eslint",
18+
"import",
19+
"react",
20+
"jest"
21+
'react-hooks',
22+
'eslint-plugin-tsdoc'],
1023
extends: [
1124
'eslint:recommended',
1225
'plugin:@typescript-eslint/recommended',
1326
'plugin:@typescript-eslint/recommended-requiring-type-checking',
27+
"plugin:eslint-comments/recommended",
28+
"plugin:@typescript-eslint/recommended",
29+
"plugin:import/errors",
30+
"plugin:import/warnings",
31+
"plugin:import/typescript",
32+
"plugin:react/recommended",
33+
"plugin:react-hooks/recommended",
34+
"plugin:prettier/recommended",
35+
"prettier"
1436
],
1537
rules: {
1638
'react-hooks/rules-of-hooks': 'error',
1739
'react-hooks/exhaustive-deps': 'warn',
1840
'tsdoc/syntax': 'warn',
41+
'@typescript-eslint/explicit-module-boundary-types': "off",
42+
'@typescript-eslint/no-explicit-any': "off",
1943
},
2044
env: {
45+
es6: true,
2146
browser: true,
47+
node: true,
48+
jest: true
2249
},
23-
}
50+
globals: {
51+
__DEV__: true,
52+
},
53+
};

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ LICENSE* text
3434
*.yml text
3535
*.sh eol=lf
3636

37+
*.txt ident

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ cache/
6767
.nyc*
6868
*.log
6969
*.debug
70+
71+
# Generated Components
72+
components/
73+
!packages/components/**/*

.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/__mocks__/**
2+
**/__tests__/**
3+
**/examples/**
4+
**/tasks/**

.prettierignore

+9
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,12 @@ dist/
1616
*.uml
1717
*.json
1818
*.js
19+
docs/.next/
20+
docs/public/playroom/
21+
22+
components/dist/
23+
components/coverage/
24+
components/src/components/icons/generated/
25+
26+
.yarn/*
27+
yarn.lock

config/eslint/plugins/jsdoc.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
module.exports = {
4+
plugins: ['jsdoc'],
5+
settings: {
6+
jsdoc: {
7+
tagNamePreference: {
8+
augments: 'extends',
9+
},
10+
},
11+
},
12+
rules: {
13+
'jsdoc/check-param-names': 2,
14+
'jsdoc/check-tag-names': [
15+
'error',
16+
{
17+
definedTags: ['jest-environment'],
18+
},
19+
],
20+
'jsdoc/check-types': 2,
21+
},
22+
};

config/eslint/plugins/jsdoc.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
module.exports = {
4+
plugins: ['jsdoc'],
5+
settings: {
6+
jsdoc: {
7+
tagNamePreference: {
8+
augments: 'extends',
9+
},
10+
},
11+
},
12+
rules: {
13+
'jsdoc/check-param-names': 2,
14+
'jsdoc/check-tag-names': [
15+
'error',
16+
{
17+
definedTags: ['jest-environment'],
18+
},
19+
],
20+
'jsdoc/check-types': 2,
21+
},
22+
};
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* Copyright (c) 20222, Manifold Finance, Inc.
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use strict';
9+
10+
module.exports = {
11+
plugins: ['testing-library'],
12+
overrides: [
13+
{
14+
// extends: ['plugin:testing-library/react'],
15+
files: ['**/components/**/Link-test.js'],
16+
rules: {
17+
// Enforce promises from async queries to be handled
18+
'testing-library/await-async-query': 'error',
19+
20+
// Enforce async utils to be awaited properly
21+
'testing-library/await-async-utils': 'error',
22+
23+
// Enforce promises from fire event methods to be handled
24+
'testing-library/await-fire-event': 'error',
25+
26+
// Ensure `data-testid` values match a provided regex.
27+
'testing-library/consistent-data-testid': 'off',
28+
29+
// Disallow unnecessary `await` for sync events
30+
'testing-library/no-await-sync-events': 'error',
31+
32+
// Disallow unnecessary `await` for sync queries
33+
'testing-library/no-await-sync-query': 'error',
34+
35+
// Disallow the use of `container` methods
36+
'testing-library/no-container': 'error',
37+
38+
// Disallow the use of debugging utilities like `debug`
39+
'testing-library/no-debug': 'error',
40+
41+
// Disallow importing from DOM Testing Library
42+
'testing-library/no-dom-import': 'error',
43+
44+
// Disallow the use of `cleanup`
45+
'testing-library/no-manual-cleanup': 'error',
46+
47+
// Disallow direct Node access
48+
'testing-library/no-node-access': 'error',
49+
50+
// Disallow the use of promises passed to a `fireEvent` method
51+
'testing-library/no-promise-in-fire-event': 'error',
52+
53+
// Disallow the use of `render` in setup functions
54+
'testing-library/no-render-in-setup': 'error',
55+
56+
// Disallow wrapping Testing Library utils or empty callbacks in `act`
57+
'testing-library/no-unnecessary-act': 'error',
58+
59+
// Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved`
60+
'testing-library/no-wait-for-empty-callback': 'error',
61+
62+
// Disallow the use of multiple expect inside `waitFor`
63+
'testing-library/no-wait-for-multiple-assertions': 'error',
64+
65+
// Disallow the use of side effects inside `waitFor`
66+
'testing-library/no-wait-for-side-effects': 'error',
67+
68+
// Ensures no snapshot is generated inside of a `waitFor` call
69+
'testing-library/no-wait-for-snapshot': 'error',
70+
71+
// Suggest using explicit assertions rather than just `getBy*` queries
72+
'testing-library/prefer-explicit-assert': 'error',
73+
74+
// Suggest using `findBy*` methods instead of the `waitFor` + `getBy` queries
75+
'testing-library/prefer-find-by': 'error',
76+
77+
// Enforce specific queries when checking element is present or not
78+
'testing-library/prefer-presence-queries': 'error',
79+
80+
// Suggest using screen while using queries
81+
'testing-library/prefer-screen-queries': 'error',
82+
83+
// Suggest using `userEvent` library instead of `fireEvent` for simulating user interaction
84+
'testing-library/prefer-user-event': 'error',
85+
86+
// Use `waitFor` instead of deprecated wait methods
87+
'testing-library/prefer-wait-for': 'error',
88+
89+
// Enforce a valid naming for return value from `render`
90+
'testing-library/render-result-naming-convention': 'off',
91+
},
92+
},
93+
],
94+
};

githash.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
commits $

jest.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1+
'use strict';
2+
3+
// @ts-check
4+
/** @type {import('@jest/types').Config.InitialOptions} */
15
module.exports = {
26
preset: 'ts-jest',
37
testEnvironment: 'jsdom',
8+
collectCoverage: true,
9+
collectCoverageFrom: ['packages/**/*.{ts,tsx}'],
410
moduleNameMapper: {
511
'^@disco3/(.*)$': '<rootDir>/packages/$1/src',
612
},
713
testPathIgnorePatterns: [
814
'<rootDir>/packages/network',
9-
'<rootDir>/packages/url'
15+
'<rootDir>/packages/url',
16+
'<rootDir>/packages/components',
1017
]
1118
}

package.json

+45-16
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,72 @@
1313
"test:ci": "jest -u --passWithNoTests --coverageDirectory .github/coverage",
1414
"format": "prettier --config .prettierrc.js --write \"**/*.{ts,tsx,md}\"",
1515
"deduplicate": "npx yarn-deduplicate -s fewer yarn.lock",
16-
"deduplicate:check": "npx yarn-deduplicate -s fewer yarn.lock --list --fail"
16+
"deduplicate:check": "npx yarn-deduplicate -s fewer yarn.lock --list --fail",
17+
"gen:comp": "node packages/generateComponent.js"
1718
},
1819
"dependencies": {
1920
"@strictsoftware/typedoc-plugin-monorepo": "^0.4.2",
2021
"typedoc": "0.19.2"
2122
},
2223
"devDependencies": {
23-
"@babel/core": "^7.10.4",
24+
"@babel/core": "^7.17.5",
2425
"@babel/eslint-parser": "^7.16.3",
25-
"@babel/plugin-proposal-export-namespace-from": "^7.10.4",
26-
"@babel/plugin-proposal-optional-chaining": "^7.12.7",
27-
"@babel/preset-env": "^7.10.4",
28-
"@babel/preset-react": "^7.16.0",
29-
"@babel/preset-typescript": "^7.12.7",
30-
"@testing-library/react-hooks": "^7.0.2",
26+
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
27+
"@babel/plugin-proposal-optional-chaining": "^ 7.16.7",
28+
"@babel/preset-env": "^7.16.11",
29+
"@babel/preset-react": "^7.16.7",
30+
"@babel/preset-typescript": "^ 7.16.7",
3131
"@tsconfig/recommended": "^1.0.1",
3232
"@types/jest": "27.0.2",
3333
"@types/node": "^16.9.0",
34-
"@types/react": "^17.0.21",
35-
"@typescript-eslint/eslint-plugin": "^5.9.1",
36-
"@typescript-eslint/parser": "^5.9.1",
34+
"@types/react": "^17.0.39",
35+
"@typescript-eslint/eslint-plugin": "^5.12.1",
36+
"@typescript-eslint/parser": "^5.12.1",
37+
"@testing-library/dom": "^8.10.1",
38+
"@testing-library/jest-dom": "^5.14.1",
39+
"@testing-library/react": "^12.1.2",
40+
"@testing-library/react-hooks": "^7.0.2",
41+
"@testing-library/user-event": "^13.5.0",
42+
"@types/testing-library__jest-dom": "^5.14.1",
3743
"@walletconnect/ethereum-provider": "^1.7.1",
38-
"eslint": "^8.6.0",
39-
"eslint-plugin-react-hooks": "^4.3.0",
40-
"eth-provider": "^0.9.4",
44+
"eth-provider": "^0.10.0",
4145
"jest": "27.2.4",
4246
"lerna": "^4.0.0",
4347
"magic-sdk": "^6.1.0",
4448
"prettier": "^2.5.1",
4549
"react": "^17.0.2",
4650
"react-test-renderer": "^17.0.2",
51+
"walletlink": "^2.5.0",
52+
"@prettier/plugin-xml": "^1.2.0",
53+
"@size-limit/preset-big-lib": "^6.0.3",
54+
"@svgr/babel-plugin-remove-jsx-attribute": "^6.0.0",
55+
"@svgr/cli": "^5.5.0",
56+
"@svgr/core": "^5.5.0",
57+
"@types/dedent": "^0.7.0",
58+
"@types/fs-extra": "^9.0.13",
59+
"@types/glob": "^7.2.0",
60+
"change-case": "^4.1.2",
61+
"dedent": "^0.7.0",
62+
"eslint": "^8.6.0",
63+
"eslint-plugin-react-hooks": "^4.3.0",
64+
"eslint-config-next": "12.0.1",
65+
"eslint-config-prettier": "^8.3.0",
66+
"eslint-import-resolver-typescript": "^2.5.0",
67+
"eslint-plugin-eslint-comments": "^3.2.0",
68+
"eslint-plugin-import": "^2.24.2",
69+
"eslint-plugin-jest": "^24.5.2",
70+
"eslint-plugin-mdx": "^1.15.1",
71+
"eslint-plugin-prettier": "^4.0.0",
72+
"eslint-plugin-react": "^7.26.0",
73+
"fs-extra": "^10.0.1",
74+
"glob": "^7.2.0",
75+
"prompt": "^1.2.0",
76+
"size-limit": "^6.0.3",
4777
"ts-jest": "^27.1.3",
4878
"ts-node": "^10.4.0",
4979
"tslib": "^2.3.1",
5080
"turbo": "^1.1.2",
51-
"typescript": "^4.5.4",
52-
"walletlink": "^2.4.5"
81+
"typescript": "^4.5.4"
5382
},
5483
"engines": {
5584
"npm": ">=7.0.0",

packages/components/jest.config.ts

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Config } from '@jest/types';
2+
import { pathsToModuleNameMapper } from 'ts-jest/utils';
3+
4+
import { compilerOptions } from './tsconfig.json';
5+
6+
const config: Config.InitialOptions = {
7+
collectCoverageFrom: [
8+
'src/**/*.{ts,tsx}',
9+
'!**/index.ts',
10+
'!**/*.snippets.tsx',
11+
'!**/*.css.ts',
12+
'!**/icons/**',
13+
'!**/tokens/**',
14+
],
15+
globals: {
16+
'ts-jest': {
17+
babelConfig: {
18+
plugins: ['@vanilla-extract/babel-plugin'],
19+
},
20+
},
21+
},
22+
moduleNameMapper: {
23+
...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/' }),
24+
},
25+
preset: 'ts-jest',
26+
roots: ['<rootDir>'],
27+
testEnvironment: 'jsdom',
28+
testRegex: '.*\\.test\\.(ts|tsx)$',
29+
watchPlugins: [
30+
'jest-watch-typeahead/filename',
31+
'jest-watch-typeahead/testname',
32+
],
33+
};
34+
35+
export default config;

0 commit comments

Comments
 (0)