diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..b8e7836 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,18 @@ +name: Prettier check + +on: + pull_request: + +jobs: + prettier-check: + name: Prettier check + runs-on: ubuntu-latest + steps: + - name: 🏗 Setup repo + uses: actions/checkout@v4 + + - name: 📦 Install dependencies + run: npm install + + - name: ✨ Run Prettier check + run: npm run prettier:check diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..a54e543 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +example/android/ +example/ios/ +android/ +ios/ +.expo/ \ No newline at end of file diff --git a/example/App.tsx b/example/App.tsx index d24bf27..673ad65 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -86,7 +86,7 @@ export default function App() { // When a final result is received, any following recognized transcripts will omit the previous final result const transcriptTally = ev.isFinal ? (current?.transcriptTally ?? "") + transcript - : current?.transcriptTally ?? ""; + : (current?.transcriptTally ?? ""); return { transcriptTally, diff --git a/example/tsconfig.json b/example/tsconfig.json index d9ce0e5..40d61ae 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -6,6 +6,6 @@ "expo-speech-recognition": ["../src/index"], "expo-speech-recognition/*": ["../src/*"] }, - "types": ["@types/dom-speech-recognition"], - }, + "types": ["@types/dom-speech-recognition"] + } } diff --git a/example/webpack.config.js b/example/webpack.config.js index d83834c..32a04f9 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js @@ -1,19 +1,19 @@ -const createConfigAsync = require('@expo/webpack-config'); -const path = require('path'); +const createConfigAsync = require("@expo/webpack-config"); +const path = require("path"); module.exports = async (env, argv) => { const config = await createConfigAsync( { ...env, babel: { - dangerouslyAddModulePathsToTranspile: ['expo-speech-recognition'], + dangerouslyAddModulePathsToTranspile: ["expo-speech-recognition"], }, }, - argv + argv, ); config.resolve.modules = [ - path.resolve(__dirname, './node_modules'), - path.resolve(__dirname, '../node_modules'), + path.resolve(__dirname, "./node_modules"), + path.resolve(__dirname, "../node_modules"), ]; return config; diff --git a/package-lock.json b/package-lock.json index c7456b5..93f5695 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "@types/dom-speech-recognition": "^0.0.4", "@types/react": "^18.3.3", "expo-module-scripts": "^3.5.2", - "expo-modules-core": "^1.12.21" + "expo-modules-core": "^1.12.21", + "prettier": "^3.3.3" }, "peerDependencies": { "expo": "*", @@ -14037,7 +14038,6 @@ "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "license": "MIT", - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, diff --git a/package.json b/package.json index f912893..f2c9a99 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,9 @@ "expo-module": "expo-module", "open:ios": "open -a \"Xcode\" example/ios", "open:android": "open -a \"Android Studio\" example/android", - "ts:check": "tsc -p . --noEmit" + "ts:check": "tsc -p . --noEmit", + "prettier:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,css,scss,md}\"", + "prettier:write": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,scss,md}\"" }, "keywords": [ "react-native", @@ -35,7 +37,8 @@ "@types/dom-speech-recognition": "^0.0.4", "@types/react": "^18.3.3", "expo-module-scripts": "^3.5.2", - "expo-modules-core": "^1.12.21" + "expo-modules-core": "^1.12.21", + "prettier": "^3.3.3" }, "prettier": { "trailingComma": "all"