Skip to content

Commit

Permalink
Typescript setup for core-react (#515)
Browse files Browse the repository at this point in the history
* Add typescript packages

* Add tsconfig

* Couldn't do it without the tslib deps, even if it's supposed to be a dep on rollup-plugin-typescript2

* Disable ts checks as a baseline before porting
  • Loading branch information
wenche authored and vnys committed Aug 28, 2020
1 parent 6a84ec5 commit 733539a
Show file tree
Hide file tree
Showing 147 changed files with 265 additions and 2 deletions.
7 changes: 6 additions & 1 deletion libraries/core-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
"@testing-library/jest-dom": "^5.9.0",
"@testing-library/react": "^10.2.1",
"@testing-library/user-event": "^10.3.2",
"@types/react": "^16.9.47",
"@types/react-dom": "^16.9.8",
"babel-plugin-react-docgen": "^4.1.0",
"babel-plugin-styled-components": "^1.10.7",
"jest": "^26.0.1",
Expand All @@ -58,7 +60,10 @@
"react-dom": "^16.13.1",
"rollup": "^2.15.0",
"rollup-plugin-polyfill": "^3.0.0",
"styled-components": "4.4.1"
"rollup-plugin-typescript2": "^0.27.2",
"styled-components": "4.4.1",
"tslib": "^2.0.1",
"typescript": "^4.0.2"
},
"peerDependencies": {
"prop-types": "^15.7.2",
Expand Down
92 changes: 91 additions & 1 deletion libraries/core-react/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions libraries/core-react/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import babel from '@rollup/plugin-babel'
import polyfill from 'rollup-plugin-polyfill'
import typescript from 'rollup-plugin-typescript2'
import pkg from './package.json'

const peerDeps = Object.keys(pkg.peerDependencies || {})
Expand All @@ -28,6 +29,12 @@ export default [
plugins: [
json(),
resolve({ extensions: ['.jsx', '.js'] }),
typescript({
tsconfig: 'tsconfig.json',
typescript: require('typescript'),
include: ['*.ts+(|x)', '**/*.ts+(|x)', '*.js+(|x)', '**/*.js+(|x)'],
exclude: ['node_modules/**'],
}),
babel({
exclude: 'node_modules/**',
presets: ['@babel/env', '@babel/preset-react'],
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/Accordion.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef, useMemo } from 'react'
import createId from 'lodash/uniqueId'
import PropTypes from 'prop-types'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/Accordion.test.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-undef */
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import { render, cleanup, screen, fireEvent } from '@testing-library/react'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/Accordion.tokens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { tokens } from '@equinor/eds-tokens'

const {
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/AccordionHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/AccordionItem.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef, useState } from 'react'
import PropTypes from 'prop-types'
import { commonPropTypes, commonDefaultProps } from './Accordion.propTypes'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/AccordionPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Accordion/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { Accordion } from './Accordion'
import { AccordionItem } from './AccordionItem'
import { AccordionHeaderTitle, AccordionHeader } from './AccordionHeader'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Avatar/Avatar.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Avatar/Avatar.tokens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export const avatar = {
enabled: {
border: {
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Avatar/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// @ts-nocheck
export { Avatar } from './Avatar'
1 change: 1 addition & 0 deletions libraries/core-react/src/Banner/Banner.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Banner/Banner.tokens.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable camelcase */
// @ts-nocheck
import { tokens } from '@equinor/eds-tokens'

const {
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Banner/BannerActions.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Banner/BannerIcon.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Banner/BannerMessage.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Banner/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { Banner } from './Banner'
import { BannerIcon } from './BannerIcon'
import { BannerMessage } from './BannerMessage'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Breadcrumbs/Breadcrumb.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Breadcrumbs/Breadcrumbs.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef, useState, Fragment } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Breadcrumbs/Breadcrumbs.tokens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { tokens } from '@equinor/eds-tokens'

const {
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Breadcrumbs/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { Breadcrumbs } from './Breadcrumbs'
import { Breadcrumb } from './Breadcrumb'

Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Button/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Button/Button.tokens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import primary from '@equinor/eds-tokens/components/button/buttons-primary.json'
import secondary from '@equinor/eds-tokens/components/button/buttons-secondary.json'
import danger from '@equinor/eds-tokens/components/button/buttons-danger.json'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Button/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
// @ts-nocheck
export { Button } from './Button'
1 change: 1 addition & 0 deletions libraries/core-react/src/Card/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions libraries/core-react/src/Card/Card.tokens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { tokens } from '@equinor/eds-tokens'

const {
Expand Down
Loading

0 comments on commit 733539a

Please sign in to comment.