Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ module.exports = api => {
},
],
],
overrides: [
{
test: ['./src/**/*.ts', './src/**/*.tsx'],
presets: [
[
Copy link
Contributor

@mingzexiao6 mingzexiao6 Mar 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need @babel/preset-react here during the transition stage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, since it's already in the presets section. This is the overrides section for specific file types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but from what i understand, if you add @babel/preset-react, you can rename current react files to .ts and .tsx right now. It's useful during your transition stage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. I was really only looking at new files. If we find ourselves converting existing components, we should add it.

'@babel/preset-typescript',
{
isTSX: true,
allExtensions: true,
},
],
],
},
],
env: {
production: {
plugins: [['react-remove-properties', { properties: ['data-testid'] }]],
Expand Down
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@formatjs/intl-relativetimeformat": "^4.5.9",
"axios": "^0.19.1",
"bluebird": "^3.7.2",
"box-ui-elements": "11.1.0-beta.35",
"box-ui-elements": "12.0.0-beta.34",
"chai": "^4.1.2",
"chai-dom": "^1.8.0",
"classnames": "^2.2.5",
Expand Down Expand Up @@ -62,12 +62,17 @@
"@babel/preset-env": "^7.7.7",
"@babel/preset-flow": "^7.7.4",
"@babel/preset-react": "^7.7.4",
"@box/frontend": "^6.0.0",
"@babel/preset-typescript": "^7.9.0",
"@box/frontend": "^6.4.0",
"@box/languages": "^1.0.0",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"@types/classnames": "^2.2.10",
"@types/lodash": "^4.14.149",
"@types/react": "^16.9.25",
"@types/react-dom": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"autoprefixer": "^9.7.3",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
Expand Down Expand Up @@ -128,7 +133,7 @@
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^19.0.0",
"stylelint-order": "^3.1.1",
"typescript": "^3.7.3",
"typescript": "^3.8.3",
"uglifyjs-webpack-plugin": "^2.2.0",
"wait-on": "^3.3.0",
"webpack": "^4.41.5",
Expand All @@ -152,6 +157,7 @@
"lint": "npm-run-all lint:*",
"lint:js": "eslint .",
"lint:scss": "stylelint \"src/**/*.scss\" --syntax scss",
"lint:ts": "tsc && eslint --ext=.tsx,.ts --max-warnings=0 .",
"release:cdn": "yarn setup; node ./scripts/prod.js",
"release:major": "scripts/release.sh -m && scripts/publish.sh",
"release:minor": "scripts/release.sh -n && scripts/publish.sh",
Expand Down
5 changes: 1 addition & 4 deletions scripts/webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ module.exports = () => {
resolve: {
modules: ['src', 'node_modules'],
},
resolveLoader: {
modules: [path.resolve('src'), path.resolve('node_modules')],
},
module: {
rules: [
{
test: /\.js$/,
test: /\.(js|ts|tsx)$/,
loader: 'babel-loader',
exclude: /node_modules\/(?!(react-intl|intl-messageformat|intl-messageformat-parser)\/).*/,
},
Expand Down
1 change: 1 addition & 0 deletions scripts/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const config = Object.assign(commonConfig(), {
),
moment: path.resolve('src/utils/MomentShim'), // Hack to leverage Intl instead
},
extensions: ['.tsx', '.ts', '.js'],
modules: ['src', 'node_modules'],
},
devServer: {
Expand Down
1 change: 1 addition & 0 deletions src/temp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed once we start adding actual Typescript files.

5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "@box/frontend/ts/tsconfig",
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
"exclude": ["node_modules", "dist"]
}
Loading