diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..98c2686 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,17 @@ +{ + "parser": "@typescript-eslint/parser", + "plugins": ["react"], + "extends": [ + "react-app", + "react-app/jest", + "plugin:react/recommended" + ], + "settings": { + "react": { + "version": "detect" + } + }, + "rules": { + "indent": ["error", 2, { "SwitchCase": 1 }] + } +} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..39abe4d --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +yarn lint diff --git a/config-overrides.js b/config-overrides.js index d10f3ea..af26d75 100644 --- a/config-overrides.js +++ b/config-overrides.js @@ -2,52 +2,52 @@ const webpack = require('webpack') module.exports = function override(config, env) { - config.module.rules.push({ - test: /\.js$/, - exclude: /node_modules[/\\](?!react-native-vector-icons)/, - use: { - loader: "babel-loader", - options: { - // Disable reading babel configuration - babelrc: false, - configFile: false, + config.module.rules.push({ + test: /\.js$/, + exclude: /node_modules[/\\](?!react-native-vector-icons)/, + use: { + loader: "babel-loader", + options: { + // Disable reading babel configuration + babelrc: false, + configFile: false, - // The configuration for compilation - presets: [ - ["@babel/preset-env", { useBuiltIns: "usage", "corejs": "3" }], - "@babel/preset-react", - "@babel/preset-flow", - "@babel/preset-typescript", - ], - plugins: [ - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-object-rest-spread", - "@babel/plugin-transform-modules-commonjs" - ] - } + // The configuration for compilation + presets: [ + ["@babel/preset-env", { useBuiltIns: "usage", "corejs": "3" }], + "@babel/preset-react", + "@babel/preset-flow", + "@babel/preset-typescript", + ], + plugins: [ + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-object-rest-spread", + "@babel/plugin-transform-modules-commonjs" + ] } - }); - - config.plugins.push( - new webpack.ProvidePlugin({ - Buffer: ["buffer", "Buffer"], - }) - ) - - config.module.rules.push({ - test: /\.(jpg|png|woff|woff2|eot|ttf|svg)$/, - type: 'asset/resource' - }) - - config.resolve.fallback = { - crypto: require.resolve("crypto-browserify"), - stream: require.resolve("stream-browserify"), - http: require.resolve('stream-http'), - https: require.resolve('https-browserify'), - url: false } + }); - config.resolve.alias['react-native$'] = require.resolve('react-native-web'); + config.plugins.push( + new webpack.ProvidePlugin({ + Buffer: ["buffer", "Buffer"], + }) + ) - return config; + config.module.rules.push({ + test: /\.(jpg|png|woff|woff2|eot|ttf|svg)$/, + type: 'asset/resource' + }) + + config.resolve.fallback = { + crypto: require.resolve("crypto-browserify"), + stream: require.resolve("stream-browserify"), + http: require.resolve('stream-http'), + https: require.resolve('https-browserify'), + url: false + } + + config.resolve.alias['react-native$'] = require.resolve('react-native-web'); + + return config; }; diff --git a/package.json b/package.json index 6574ed6..91e19c9 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,8 @@ "start": "react-app-rewired start", "build": "react-app-rewired build", "test": "react-app-rewired test", + "lint": "eslint .", + "prepare": "husky", "eject": "react-scripts eject" }, "eslintConfig": { @@ -75,7 +77,14 @@ "@types/node": "^16.7.13", "@types/react": "^18.0.0", "@types/react-dom": "^18.0.0", + "@typescript-eslint/eslint-plugin": "^6.13.2", + "@typescript-eslint/parser": "^6.13.2", "crypto-browserify": "^3.12.0", + "eslint": "^8.3.0", + "eslint-config-react-app": "^7.0.1", + "eslint-plugin-react": "^7.33.2", + "eslint-webpack-plugin": "^3.1.1", + "husky": "^9.0.11", "react-app-rewired": "^2.2.1", "stream-browserify": "^3.0.0" } diff --git a/public/index.html b/public/index.html index 1a6d95a..1e28cec 100644 --- a/public/index.html +++ b/public/index.html @@ -25,10 +25,50 @@ Learn how to configure a non-root public URL by running `npm run build`. -->