From b65ed82d47de1ba03da0878ae45b2a0f3fbcf452 Mon Sep 17 00:00:00 2001 From: Anselme Date: Mon, 25 Sep 2023 12:29:30 +0200 Subject: [PATCH] add github action test (#18) * add github action test * update pr.yml --- .eslintignore | 5 +++++ .eslintrc.js | 7 +++++++ .github/workflows/pr.yml | 34 ++++++++++++++++++++++++++++++++++ .prettierrc.json | 8 ++++++++ package.json | 6 +++++- 5 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .github/workflows/pr.yml create mode 100644 .prettierrc.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..ec487a0 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,5 @@ +plugins +metro.config.js +babel.config.js +android +ios \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..5507422 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + root: true, + extends: ["universe/native"], + rules: { + "import/order": "off", + }, +}; diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..cf1cb62 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,34 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: React Native CI for PR + +on: + pull_request: + branches: main + +jobs: + install-test-yarn: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - run: yarn install --immutable + - run: yarn lint + - run: yarn prebuild + install-test-npm: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + + - run: npm install + - run: npm run lint + - run: npm run prebuild diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..0d54ec0 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "trailingComma": "all", + "tabWidth": 2, + "semi": true, + "singleQuote": false, + "printWidth": 80, + "arrowParens": "always" +} diff --git a/package.json b/package.json index 3882da0..dad7397 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "ios": "expo run:ios", "android": "expo run:android", "test": "CI=1 expo install --check", + "lint": "eslint .", "test:fix": "expo install --fix", "doctor": "npx expo-doctor", "postinstall": "patch-package" @@ -36,7 +37,10 @@ "@expo/config-plugins": "~7.8.4" }, "devDependencies": { - "@babel/core": "^7.18.6" + "@babel/core": "^7.18.6", + "eslint": "^8.50.0", + "eslint-config-universe": "^12.0.0", + "prettier": "^3.0.3" }, "private": true }