From 7bee2ff9950d9283c5fb23fb4d2f2e4b10761f1a Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Thu, 20 Jun 2024 16:04:05 -0600 Subject: [PATCH] feat: Lint Setup Added some nice to have lint rules Set max warnings on lint --- .eslintrc.json | 16 +++++++++++++++- package.json | 3 ++- yarn.lock | 12 ++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c163db777..238c44545 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,12 +1,26 @@ { "extends": "universe/native", "ignorePatterns": ["dist/", "node_modules/", "vendor/"], - "plugins": ["react", "import", "unused-imports", "react-hooks"], + "plugins": ["react", "import", "unused-imports", "react-hooks", "react-native"], "rules": { "no-unused-vars": "off", "unused-imports/no-unused-imports": "error", "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "error", + "react-native/no-inline-styles": "warn", + "react-native/no-raw-text": "warn", + "react-native/no-single-element-style-arrays": "warn", + "react/jsx-no-bind": [ + "warn", + { + "ignoreRefs": true, + "allowArrowFunctions": false, + "allowFunctions": false, + "allowBind": false, + "ignoreDOMComponents": true + } + ], + "prettier/prettier": "off" // We use prettier manually on the side }, "root": true diff --git a/package.json b/package.json index 7fd890805..0aec1d2d9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "node scripts/build/build.js", "commit": "git show --format=\"%h\" --no-patch", "db": "ts-node scripts/migrations/db.ts", - "lint": "eslint --ext .ts,.tsx .", + "lint": "eslint --ext .ts,.tsx . --max-warnings 325", "ios": "EXPO_ENV=dev expo start --ios", "postinstall": "patch-package && node scripts/wasm.js && husky install && cross-os postinstall", "start": "EXPO_ENV=dev expo start", @@ -196,6 +196,7 @@ "eslint-config-universe": "^12.0.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-native": "^4.1.0", "eslint-plugin-unused-imports": "^2.0.0", "git-is-clean": "^3.0.1", "husky": "^8.0.2", diff --git a/yarn.lock b/yarn.lock index 3da6b9129..96c401a1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14938,6 +14938,18 @@ eslint-plugin-react-hooks@^4.6.0: resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz" integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== +eslint-plugin-react-native-globals@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-native-globals/-/eslint-plugin-react-native-globals-0.1.2.tgz#ee1348bc2ceb912303ce6bdbd22e2f045ea86ea2" + integrity sha512-9aEPf1JEpiTjcFAmmyw8eiIXmcNZOqaZyHO77wgm0/dWfT/oxC1SrIq8ET38pMxHYrcB6Uew+TzUVsBeczF88g== + +eslint-plugin-react-native@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-native/-/eslint-plugin-react-native-4.1.0.tgz#5343acd3b2246bc1b857ac38be708f070d18809f" + integrity sha512-QLo7rzTBOl43FvVqDdq5Ql9IoElIuTdjrz9SKAXCvULvBoRZ44JGSkx9z4999ZusCsb4rK3gjS8gOGyeYqZv2Q== + dependencies: + eslint-plugin-react-native-globals "^0.1.1" + eslint-plugin-react@^7.32.2: version "7.33.1" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.33.1.tgz#bc27cccf860ae45413a4a4150bf0977345c1ceab"