From c167151cc22e356c2572a7f23142821982e9d327 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Dec 2024 23:36:50 -0800 Subject: [PATCH] chore: first steps to migrating to TypeScript --- package.json | 9 ++++++++- tsconfig.json | 1 + webpack.common.js | 7 ++++--- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tsconfig.json diff --git a/package.json b/package.json index 4501751..97f931e 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,19 @@ "@babel/core": "^7.26.0", "@babel/preset-env": "^7.26.0", "@babel/preset-react": "^7.25.9", + "@babel/preset-typescript": "^7.23.3", "@eslint/eslintrc": "^3.1.0", "@eslint/js": "^9.14.0", + "@types/chrome": "^0.0.260", + "@types/react": "^18.2.64", + "@types/react-dom": "^18.2.21", + "@typescript-eslint/eslint-plugin": "^7.1.1", + "@typescript-eslint/parser": "^7.1.1", "babel-loader": "^9.2.1", "classnames": "^2.5.1", "copy-webpack-plugin": "^12.0.2", "css-loader": "^7.1.2", - "eslint": "^9.14.0", + "eslint": "^8.56.0", "eslint-plugin-jasmine": "^4.2.2", "eslint-plugin-react": "^7.37.2", "globals": "^15.12.0", @@ -32,6 +38,7 @@ "sass": "^1.81.0", "sass-loader": "^16.0.3", "style-loader": "^0.23.1", + "typescript": "^5.3.3", "webpack": "^5.96.1", "webpack-cli": "^5.1.4", "webpack-merge": "^6.0.1" diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/tsconfig.json @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/webpack.common.js b/webpack.common.js index e809daf..25dbd97 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -13,14 +13,15 @@ module.exports = { module: { rules: [ { - test: /.(js|jsx|mjs)$/, + test: /\.(js|jsx|mjs|ts|tsx)$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { presets: [ '@babel/preset-env', - '@babel/preset-react' + '@babel/preset-react', + '@babel/preset-typescript' ] } } @@ -90,7 +91,7 @@ module.exports = { '@/scss': path.resolve(__dirname, 'src/assets/scss'), '@/vendor': path.resolve(__dirname, 'src/lib/vendor'), }, - extensions: ['.js', '.jsx', '.mjs'], + extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'], }, watchOptions: {