Skip to content

Commit 00a3261

Browse files
Barthélémy LedouxTejasQ
authored andcommitted
Refactor: Rewrite loaders folder in typescript (#1485)
* ts highlight * ts highlightCode md * ts noAutoLink * ts slugger * ts remove Doclets * ts sortProps * ts getName from filepath * ts chunkiy * fix props loader * ts filter components examples * ts requireIt * ts expand default component * ts getast * ts getAllContentPages * ts getComponentFiles * ts get files from sections * ts get patterns from section * ts getExamples * ts getImports * ts getComponents * ts getComponents * ts getSctions * ts getProps * before starting the loaders * update hasExamples type * update types * fix some types * type fix * update getProps * fix typings for default Example * fix types for defaultExamples * ts props loader * type fix sanitizeConfig * last type fixes * ts examples loader * ts styleguide loader * finish the job * remove custom eslintrc * generate the types * avoid exporting test specs * run tsc om src omly * remove unused space * remove flow from ci * remove compilation of types on publish * rollbalk changes to bin * remove useless types * remove oops test file * Use standard Array.isArray instead of lodash Co-Authored-By: Artem Sapegin <[email protected]> * fix typechecks
1 parent 708ca07 commit 00a3261

File tree

106 files changed

+1010
-777
lines changed

Some content is hidden

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

106 files changed

+1010
-777
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ node_js:
77
addons:
88
apt:
99
packages:
10-
- libgconf-2-4
10+
- libgconf-2-4
1111

1212
script:
1313
# Run tests without coverage since it's 2x faster
@@ -38,7 +38,6 @@ jobs:
3838

3939
- stage: typecheck
4040
script:
41-
- npm run flow check
4241
- npm run tscheck
4342

4443
- stage: integration

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,13 @@
104104
"@testing-library/react": "^9.3.0",
105105
"@types/buble": "^0.19.2",
106106
"@types/copy-webpack-plugin": "^5.0.0",
107+
"@types/doctrine": "0.0.3",
107108
"@types/enzyme": "^3.10.3",
109+
"@types/escodegen": "0.0.6",
108110
"@types/estree": "^0.0.39",
109111
"@types/jest": "^24.0.21",
110112
"@types/keymirror": "^0.1.1",
113+
"@types/loader-utils": "^1.1.3",
111114
"@types/lodash": "^4.14.144",
112115
"@types/markdown-to-jsx": "^6.9.0",
113116
"@types/node": "^12.12.3",
@@ -172,8 +175,8 @@
172175
"start:sections": "node lib/bin/styleguidist.js server --config examples/sections/styleguide.config.js",
173176
"start:ui": "node lib/bin/styleguidist.js server",
174177
"lint": "eslint . --cache --fix --ext .js,.ts,.tsx",
175-
"flow": "flow",
176178
"compile": "babel --delete-dir-on-start --ignore **/__mocks__/*,**/__tests__/*,**/*.spec.*,**/*.d.ts --extensions '.js,.ts,.tsx' -d lib/ src/",
179+
"compile:types": "tsc -p ./tsconfig.types.json --emitDeclarationOnly",
177180
"compile:watch": "npm run compile -- --watch",
178181
"prepublishOnly": "npm run compile",
179182
"build:basic": "node lib/bin/styleguidist.js build --config examples/basic/styleguide.config.js",

src/client/rsg-components/Argument/Argument.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
33
import { ArgumentRenderer, styles } from './ArgumentRenderer';
4-
import classes from '../../../../test/classes';
54

65
const name = 'Foo';
76
const type = { name: 'Array' };

src/client/rsg-components/Arguments/Arguments.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
33
import { ArgumentsRenderer, styles } from './ArgumentsRenderer';
4-
import classes from '../../../../test/classes';
54

65
const props = {
76
classes: classes(styles),

src/client/rsg-components/Editor/Editor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const styles = ({ fontFamily, fontSize, color, borderRadius }: Rsg.Theme) => ({
3535
},
3636
});
3737

38-
interface EditorProps extends JssInjectedProps {
38+
export interface EditorProps extends JssInjectedProps {
3939
code: string;
4040
onChange: (code: string) => void;
4141
}

src/client/rsg-components/JsDoc/JsDoc.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { TagProps, TagObject } from 'react-docgen';
44
import map from 'lodash/map';
55
import Markdown from 'rsg-components/Markdown';
66

7-
const plural = (array: any[], caption: string) => (array.length === 1 ? caption : `${caption}s`);
7+
const plural = (array: TagObject[], caption: string) =>
8+
array.length === 1 ? caption : `${caption}s`;
89
const list = (array: TagObject[]) => array.map(item => item.description).join(', ');
910
const paragraphs = (array: TagObject[]) => array.map(item => item.description).join('\n\n');
1011

File renamed without changes.

src/client/rsg-components/Name/Name.spec.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
33
import { NameRenderer, styles } from './NameRenderer';
4-
// TODO: simplify this path
5-
import classes from '../../../../test/classes';
64

75
const props = {
86
classes: classes(styles),

src/client/rsg-components/Para/Para.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { shallow } from 'enzyme';
33
import { ParaRenderer, styles } from './ParaRenderer';
4-
import classes from '../../../../test/classes';
54

65
const props = {
76
classes: classes(styles),

0 commit comments

Comments
 (0)