From 07a58adb45cde8f3a46bc1afee63e6056b469469 Mon Sep 17 00:00:00 2001 From: Mashal Malik <107556986+Mashal-m@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:09:15 +0500 Subject: [PATCH] fix: revert ts config PR (#315) --- README.rst | 8 ---- config/jest.config.js | 4 +- config/webpack.prod.config.js | 4 +- example/src/App.jsx | 3 -- example/src/Image.tsx | 11 ----- example/src/__snapshots__/App.test.jsx.snap | 12 ----- package-lock.json | 52 ++++++++------------- package.json | 2 - tsconfig.json | 27 ----------- 9 files changed, 23 insertions(+), 100 deletions(-) delete mode 100644 example/src/Image.tsx delete mode 100644 tsconfig.json diff --git a/README.rst b/README.rst index f0912b2eb..505e54cfe 100644 --- a/README.rst +++ b/README.rst @@ -157,14 +157,6 @@ You may create a `.env.private` with any overrides of the environment settings c **Note: .env.private should be added to your project's .gitignore so it does not get checked in.** -Local module configuration for TypeScript ------------------------------------------ - -#. Copy tsconfig.json into the root of the module -#. Set "rootDir" to the root of the source code folders, and "outDir" to the distribution folder -#. Set "include" to wildcard patterns specifying the subdirectories/files under rootDir where source code can be found -#. Include any wildcards under rootDir that should be excluded using "exclude". Make sure the "outDir" directory is excluded here, if it is under "include". - Development ----------- diff --git a/config/jest.config.js b/config/jest.config.js index 716c0e10c..ae08b706f 100644 --- a/config/jest.config.js +++ b/config/jest.config.js @@ -1,6 +1,5 @@ const path = require('path'); const fs = require('fs'); -const { jsWithTs: tsjPreset } = require('ts-jest/presets'); const presets = require('../lib/presets'); @@ -34,12 +33,11 @@ module.exports = { '/node_modules/(?!@edx)', ], transform: { - '^.+\\.jsx?$': [ + '^.+\\.[t|j]sx?$': [ 'babel-jest', { configFile: presets.babel.resolvedFilepath, }, ], - ...tsjPreset.transform, }, }; diff --git a/config/webpack.prod.config.js b/config/webpack.prod.config.js index 2ae2934b7..49af73b06 100644 --- a/config/webpack.prod.config.js +++ b/config/webpack.prod.config.js @@ -62,12 +62,12 @@ module.exports = merge(commonConfig, { // The babel-loader transforms newer ES2015+ syntax to older ES5 for older browsers. // Babel is configured with the .babelrc file at the root of the project. { - test: /\.(js|jsx|ts|tsx)$/, + test: /\.(js|jsx)$/, exclude: /node_modules\/(?!@edx)/, use: { loader: 'babel-loader', options: { - configFile: presets['babel-typescript'].resolvedFilepath, + configFile: presets.babel.resolvedFilepath, }, }, }, diff --git a/example/src/App.jsx b/example/src/App.jsx index 33840ecb8..2f1346339 100644 --- a/example/src/App.jsx +++ b/example/src/App.jsx @@ -1,5 +1,4 @@ import config from 'env.config'; -import Image from './Image.tsx'; import appleUrl, { ReactComponent as Apple } from './apple.svg'; import appleImg from './apple.jpg'; @@ -20,8 +19,6 @@ export default function App() {

JSX parsing tests

-

TSX parsing tests

- appleFromTsx

Asset import tests

apple apple diff --git a/example/src/Image.tsx b/example/src/Image.tsx deleted file mode 100644 index a8e7531e1..000000000 --- a/example/src/Image.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React, { CSSProperties } from "react"; - -type ImageProps = { - src: string; - alt?: string; - style?: CSSProperties; -}; - -export default function Image(props:ImageProps) { - return ; -} diff --git a/example/src/__snapshots__/App.test.jsx.snap b/example/src/__snapshots__/App.test.jsx.snap index 551869852..5666dd15d 100644 --- a/example/src/__snapshots__/App.test.jsx.snap +++ b/example/src/__snapshots__/App.test.jsx.snap @@ -39,18 +39,6 @@ exports[`Basic test should render 1`] = ` } } /> -

- TSX parsing tests -

- appleFromTsx

Asset import tests

diff --git a/package-lock.json b/package-lock.json index 1c8659ade..e2b0fa70e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,10 +68,8 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.18.6", - "@types/jest": "^26.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.11", - "ts-jest": "^26.5.0", "typescript": "^4.9.4" }, "peerDependencies": { @@ -3412,16 +3410,6 @@ "@types/istanbul-lib-report": "*" } }, - "node_modules/@types/jest": { - "version": "26.0.24", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz", - "integrity": "sha512-E/X5Vib8BWqZNRlDxj9vYXhsDwPYbPINqKF9BsnSoon4RQ0D9moEuLD8txgyypFLH7J4+Lho9Nr/c8H0Fi+17w==", - "dev": true, - "dependencies": { - "jest-diff": "^26.0.0", - "pretty-format": "^26.0.0" - } - }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -4785,7 +4773,8 @@ "version": "0.2.6", "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "fast-json-stable-stringify": "2.x" }, @@ -11476,7 +11465,8 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "devOptional": true + "optional": true, + "peer": true }, "node_modules/makeerror": { "version": "1.0.12", @@ -15827,7 +15817,8 @@ "version": "26.5.6", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.6.tgz", "integrity": "sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "bs-logger": "0.x", "buffer-from": "1.x", @@ -15855,7 +15846,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "devOptional": true, + "optional": true, + "peer": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -15867,7 +15859,8 @@ "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "devOptional": true, + "optional": true, + "peer": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -19436,16 +19429,6 @@ "@types/istanbul-lib-report": "*" } }, - "@types/jest": { - "version": "26.0.24", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz", - "integrity": "sha512-E/X5Vib8BWqZNRlDxj9vYXhsDwPYbPINqKF9BsnSoon4RQ0D9moEuLD8txgyypFLH7J4+Lho9Nr/c8H0Fi+17w==", - "dev": true, - "requires": { - "jest-diff": "^26.0.0", - "pretty-format": "^26.0.0" - } - }, "@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -20522,7 +20505,8 @@ "version": "0.2.6", "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "devOptional": true, + "optional": true, + "peer": true, "requires": { "fast-json-stable-stringify": "2.x" } @@ -25397,7 +25381,8 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "devOptional": true + "optional": true, + "peer": true }, "makeerror": { "version": "1.0.12", @@ -28587,7 +28572,8 @@ "version": "26.5.6", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.6.tgz", "integrity": "sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==", - "devOptional": true, + "optional": true, + "peer": true, "requires": { "bs-logger": "0.x", "buffer-from": "1.x", @@ -28605,13 +28591,15 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "devOptional": true + "optional": true, + "peer": true }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "devOptional": true, + "optional": true, + "peer": true, "requires": { "lru-cache": "^6.0.0" } diff --git a/package.json b/package.json index cfebf80f3..c5d285a30 100644 --- a/package.json +++ b/package.json @@ -81,10 +81,8 @@ }, "devDependencies": { "@babel/preset-typescript": "^7.18.6", - "@types/jest": "^26.0.0", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.11", - "ts-jest": "^26.5.0", "typescript": "^4.9.4" }, "peerDependencies": { diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index fc1b971bf..000000000 --- a/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "allowSyntheticDefaultImports": true, - "declaration": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react", - "lib": ["dom", "es6", "dom.iterable"], - "isolatedModules": true, - "module": "ES6", - "moduleResolution": "node", - "noFallthroughCasesInSwitch": true, - "noImplicitAny": false, - "noImplicitThis": true, - "noUnusedParameters": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "strictFunctionTypes": false, - "target": "ES6", - "rootDir": "example", - "outDir": "dist" - }, - "include": ["example/**/*"], - "exclude": ["example/dist/*", "example/node_modules/*"] -}