Skip to content

Commit 9feaf27

Browse files
authored
Merge pull request #369 from react95-io/beta
2 parents a42fb6c + eabc391 commit 9feaf27

File tree

320 files changed

+10713
-9476
lines changed

Some content is hidden

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

320 files changed

+10713
-9476
lines changed

.babelrc

+49-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,59 @@
11
{
2+
"sourceType": "unambiguous",
23
"presets": [
34
[
45
"@babel/preset-env",
56
{
6-
"modules": false
7+
"shippedProposals": true,
8+
"loose": true
79
}
810
],
9-
"@babel/preset-react"
11+
"@babel/preset-typescript"
1012
],
1113
"plugins": [
12-
"babel-plugin-styled-components",
13-
"@babel/plugin-proposal-class-properties",
14-
"@babel/plugin-transform-runtime"
15-
],
16-
"env": {
17-
"test": {
18-
"presets": ["@babel/preset-env"],
19-
"plugins": [
20-
["babel-plugin-styled-components", { "ssr": false, "displayName": false }]
21-
]
22-
}
23-
}
14+
"@babel/plugin-transform-shorthand-properties",
15+
"@babel/plugin-transform-block-scoping",
16+
[
17+
"@babel/plugin-proposal-decorators",
18+
{
19+
"legacy": true
20+
}
21+
],
22+
[
23+
"@babel/plugin-proposal-class-properties",
24+
{
25+
"loose": true
26+
}
27+
],
28+
[
29+
"@babel/plugin-proposal-private-property-in-object",
30+
{
31+
"loose": true
32+
}
33+
],
34+
[
35+
"@babel/plugin-proposal-private-methods",
36+
{
37+
"loose": true
38+
}
39+
],
40+
"@babel/plugin-proposal-export-default-from",
41+
"@babel/plugin-syntax-dynamic-import",
42+
[
43+
"@babel/plugin-proposal-object-rest-spread",
44+
{
45+
"loose": true,
46+
"useBuiltIns": true
47+
}
48+
],
49+
"@babel/plugin-transform-classes",
50+
"@babel/plugin-transform-arrow-functions",
51+
"@babel/plugin-transform-parameters",
52+
"@babel/plugin-transform-destructuring",
53+
"@babel/plugin-transform-spread",
54+
"@babel/plugin-transform-for-of",
55+
"babel-plugin-macros",
56+
"@babel/plugin-proposal-optional-chaining",
57+
"@babel/plugin-proposal-nullish-coalescing-operator"
58+
]
2459
}

.codesandbox/ci.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"installCommand": "install:codesandbox",
32
"buildCommand": "build:prod",
4-
"sandboxes": ["react95-template-xkfj0"]
3+
"node": "16",
4+
"sandboxes": [
5+
"react95-template-xkfj0"
6+
]
57
}

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = yes
9+
insert_final_newline = yes

.eslintrc.js

+48-6
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,72 @@
11
module.exports = {
2-
extends: ['airbnb', 'plugin:prettier/recommended'],
3-
parser: '@babel/eslint-parser',
2+
extends: [
3+
'plugin:@typescript-eslint/recommended',
4+
'airbnb',
5+
'plugin:prettier/recommended',
6+
'plugin:react-hooks/recommended'
7+
],
8+
parser: '@typescript-eslint/parser',
49
plugins: ['react', 'prettier'],
510
env: {
611
browser: true,
712
es6: true,
813
jest: true
914
},
1015
rules: {
11-
'import/no-unresolved': ['error', { ignore: ['react95'] }],
16+
'@typescript-eslint/explicit-module-boundary-types': 'off',
17+
'@typescript-eslint/no-empty-function': 'off',
18+
'@typescript-eslint/no-empty-interface': 'off',
19+
'@typescript-eslint/no-use-before-define': 'off',
20+
'@typescript-eslint/no-unused-vars': [
21+
'error',
22+
{
23+
argsIgnorePattern: '^_\\d*$'
24+
}
25+
],
26+
'import/extensions': ['error', { js: 'never', ts: 'never', tsx: 'never' }],
27+
'import/no-unresolved': [
28+
'error',
29+
// TODO: Remove ../../test/utils when TypeScript migration is complete
30+
{ ignore: ['react95', '../../test/utils'] }
31+
],
1232
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
33+
'import/prefer-default-export': 'off',
1334
'jsx-a11y/label-has-associated-control': ['error', { assert: 'either' }],
1435
'jsx-a11y/label-has-for': 'off',
36+
'no-nested-ternary': 'off',
1537
'prettier/prettier': 'error',
1638
'react/forbid-prop-types': 'off',
17-
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
39+
'react/jsx-filename-extension': [
40+
'warn',
41+
{ extensions: ['.js', '.jsx', '.tsx'] }
42+
],
1843
'react/jsx-props-no-spreading': 'off',
1944
'react/no-array-index-key': 'off',
45+
'react/prop-types': 'off',
46+
'react/require-default-props': 'off',
2047
'react/static-property-placement': ['error', 'static public field']
2148
},
2249
overrides: [
2350
{
24-
files: ['*.spec.@(js|jsx)', '*.stories.@(js|jsx)'],
51+
files: ['*.spec.@(js|jsx|ts|tsx)', '*.stories.@(js|jsx|ts|tsx)'],
2552
rules: {
2653
'no-console': 'off'
2754
}
55+
},
56+
{
57+
files: ['*.@(ts|tsx)'],
58+
rules: {
59+
// This is handled by @typescript-eslint/no-unused-vars
60+
'no-undef': 'off'
61+
}
62+
}
63+
],
64+
settings: {
65+
'import/parsers': {
66+
'@typescript-eslint/parser': ['.ts', '.tsx']
67+
},
68+
'import/resolver': {
69+
typescript: {}
2870
}
29-
]
71+
}
3072
};

.github/workflows/ci.yml

+52
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,58 @@ on:
44
pull_request:
55

66
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Git Checkout
11+
uses: actions/checkout@v2
12+
13+
- name: Setup node
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 16
17+
18+
- name: Cache packages
19+
uses: actions/cache@v3
20+
with:
21+
key: node_modules-v4-${{ hashFiles('yarn.lock') }}
22+
path: |-
23+
node_modules
24+
*/node_modules
25+
restore-keys: 'node_modules-v4-'
26+
27+
- name: Yarn install
28+
run: yarn install --ignore-optional --frozen-lockfile
29+
30+
- name: Lint
31+
run: yarn run lint
32+
33+
type-check:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Git Checkout
37+
uses: actions/checkout@v2
38+
39+
- name: Setup node
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: 16
43+
44+
- name: Cache packages
45+
uses: actions/cache@v3
46+
with:
47+
key: node_modules-v4-${{ hashFiles('yarn.lock') }}
48+
path: |-
49+
node_modules
50+
*/node_modules
51+
restore-keys: 'node_modules-v4-'
52+
53+
- name: Yarn install
54+
run: yarn install --ignore-optional --frozen-lockfile
55+
56+
- name: Type Check
57+
run: yarn run typescript
58+
759
test:
860
runs-on: ubuntu-latest
961
steps:

.storybook/decorators/globalStyle.js renamed to .storybook/decorators/withGlobalStyle.tsx

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { DecoratorFn } from '@storybook/react';
12
import React from 'react';
23
import { createGlobalStyle } from 'styled-components';
34

4-
import styleReset from '../../src/common/styleReset';
5-
// TODO is there a way to keep import paths consistent with what end user will get?
65
import ms_sans_serif from '../../src/assets/fonts/dist/ms_sans_serif.woff2';
76
import ms_sans_serif_bold from '../../src/assets/fonts/dist/ms_sans_serif_bold.woff2';
7+
import styleReset from '../../src/common/styleReset';
88

99
const GlobalStyle = createGlobalStyle`
1010
${styleReset}
@@ -20,14 +20,21 @@ const GlobalStyle = createGlobalStyle`
2020
font-weight: bold;
2121
font-style: normal
2222
}
23+
html, body, #root {
24+
height: 100%;
25+
}
26+
#root > * {
27+
height: 100%;
28+
box-sizing: border-box;
29+
}
2330
body {
2431
font-family: 'ms_sans_serif', 'sans-serif';
2532
}
2633
`;
2734

28-
export default storyFn => (
35+
export const withGlobalStyle: DecoratorFn = story => (
2936
<>
3037
<GlobalStyle />
31-
{storyFn()}
38+
{story()}
3239
</>
3340
);

.storybook/logo.png

12.7 KB
Loading

.storybook/main.js

-18
This file was deleted.

.storybook/main.ts

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import type { StorybookConfig } from '@storybook/react/types';
2+
import type { PropItem } from 'react-docgen-typescript';
3+
4+
const path = require('path');
5+
6+
const storybookConfig: StorybookConfig = {
7+
stories: ['../@(docs|src)/**/*.stories.@(tsx|mdx)'],
8+
addons: [
9+
{
10+
name: '@storybook/addon-docs',
11+
options: {
12+
sourceLoaderOptions: {
13+
injectStoryParameters: false
14+
}
15+
}
16+
},
17+
'@storybook/addon-storysource',
18+
'./theme-picker/register.ts'
19+
],
20+
core: {
21+
builder: 'webpack5'
22+
},
23+
features: {
24+
babelModeV7: true,
25+
storyStoreV7: true,
26+
modernInlineRender: true,
27+
postcss: false
28+
},
29+
typescript: {
30+
check: false,
31+
checkOptions: {},
32+
reactDocgen: 'react-docgen-typescript',
33+
reactDocgenTypescriptOptions: {
34+
shouldExtractLiteralValuesFromEnum: true,
35+
propFilter: (prop: PropItem) =>
36+
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true
37+
}
38+
},
39+
webpackFinal: config => {
40+
config.resolve = {
41+
...config.resolve,
42+
alias: {
43+
...config.resolve?.alias,
44+
react95: path.resolve(__dirname, '../src/index')
45+
}
46+
};
47+
48+
return config;
49+
}
50+
};
51+
52+
module.exports = storybookConfig;

.storybook/manager.css

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* Remove from the sidebar menu stories that contains "unstable" */
2+
a[data-item-id$='-unstable'].sidebar-item,
3+
a[data-item-id*='-unstable-'].sidebar-item,
4+
button[data-item-id$='-unstable'].sidebar-item,
5+
button[data-item-id$='-unstable-'].sidebar-item {
6+
display: none !important;
7+
}

.storybook/manager.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import './manager.css';
2+
3+
import { addons } from '@storybook/addons';
4+
import theme from './theme';
5+
6+
addons.setConfig({
7+
theme
8+
});

.storybook/preview.js

-40
This file was deleted.

0 commit comments

Comments
 (0)