Skip to content

Commit

Permalink
feat(typescript): Add typescript support for UI components library (f…
Browse files Browse the repository at this point in the history
…reeCodeCamp#43541)

* Add TS configs and improve dir structure

* Add TS configs and improve dir structure

* Fix components exports from index

* chore: prettier

* Add tsconfig and then fix the linter warnings

* Add @babel/preset-typescript

* Fix eslint rule and update btn component to fix storybook

* Fix TS and Jest configs

Converted all remaining files to TS as well

* Remove TS ignored rules and fixed some TS & jest stuff

* Revert to old directory structure

* Use absolute versions in package.json

* enable ts strict to infer types

Co-authored-by: Hamza Waleed <[email protected]>
  • Loading branch information
hamzawaleed0102 and hamzawaleed01 authored Sep 28, 2021
1 parent cc13291 commit ebec670
Show file tree
Hide file tree
Showing 15 changed files with 480 additions and 142 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"parserOptions": {
"project": [
"./client/tsconfig.json",
"./tools/challenge-helper-scripts/tsconfig.json"
"./tools/challenge-helper-scripts/tsconfig.json",
"./tools/ui-components/tsconfig.json"
]
},
"extends": [
Expand Down
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = { babelrcRoots: ['./api-server', './client'] };
module.exports = {
babelrcRoots: ['./api-server', './client']
};
3 changes: 2 additions & 1 deletion jest.transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const babelOptions = {
}
}
],
'@babel/react'
'@babel/react',
'@babel/preset-typescript'
]
};

Expand Down
262 changes: 242 additions & 20 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"lint:challenges": "cd ./curriculum && npm run lint",
"lint:css": "npm run prettier -- --check",
"lint:js": "eslint --max-warnings 0 .",
"lint:ts": "tsc -p client",
"lint:ts": "tsc -p client && tsc -p tools/ui-components",
"lint:translations": "cd ./client && npm run lint",
"postinstall": "npm run bootstrap",
"prettier": "prettier \"**/*.css\"",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
module.exports = {
"presets": [
"@babel/preset-react",
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"targets": {
"browsers": [">0.25%", "not dead"]
}
}
],
"@babel/preset-react"
]
],
"plugins": [["transform-react-remove-prop-types", { "removeImport": true }]]
}
Loading

0 comments on commit ebec670

Please sign in to comment.