diff --git a/.eslintrc.js b/.eslintrc.js index 8e39d62ac..c4b0b9ab3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,9 @@ module.exports = { root: true, - extends: ["universe/native", "universe/web"], - ignorePatterns: ["build"], -}; + extends: ['universe/native', 'universe/web'], + ignorePatterns: ['build'], + plugins: ['prettier'], + globals: { + __dirname: true, + }, +} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..28d549458 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,13 @@ +name: Lint +on: + pull_request: +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - uses: actions/setup-node@v3 + - run: npm install + - run: npm run eslint diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 000000000..fec61a2a6 --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,7 @@ +module.exports = { + semi: false, + singleQuote: true, + trailingComma: 'es5', + arrowParens: 'always', + printWidth: 80, +} diff --git a/example/App.tsx b/example/App.tsx index 75b6a10e3..d281fe4b0 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -1,17 +1,17 @@ -import React from "react"; +import { NavigationContainer } from '@react-navigation/native' +import React from 'react' +import { Button } from 'react-native' +import { QueryClient, QueryClientProvider } from 'react-query' -import LaunchScreen from "./src/LaunchScreen"; -import TestScreen from "./src/TestScreen"; -import HomeScreen from "./src/HomeScreen"; -import ConversationScreen from "./src/ConversationScreen"; -import ConversationCreateScreen from "./src/ConversationCreateScreen"; -import { NavigationContainer } from "@react-navigation/native"; -import { XmtpContextProvider } from "./src/XmtpContext"; -import { Navigator } from "./src/Navigation"; -import { QueryClient, QueryClientProvider } from "react-query"; -import { Button } from "react-native"; +import ConversationCreateScreen from './src/ConversationCreateScreen' +import ConversationScreen from './src/ConversationScreen' +import HomeScreen from './src/HomeScreen' +import LaunchScreen from './src/LaunchScreen' +import { Navigator } from './src/Navigation' +import TestScreen from './src/TestScreen' +import { XmtpContextProvider } from './src/XmtpContext' -const queryClient = new QueryClient(); +const queryClient = new QueryClient() export default function App() { return ( @@ -22,36 +22,36 @@ export default function App() { name="launch" component={LaunchScreen} options={{ - title: "XMTP RN Example", + title: 'XMTP RN Example', headerStyle: { - backgroundColor: "rgb(49 0 110)", + backgroundColor: 'rgb(49 0 110)', }, - headerTintColor: "#fff", + headerTintColor: '#fff', headerTitleStyle: { - fontWeight: "bold", + fontWeight: 'bold', }, }} /> ({ - title: "My Conversations", + title: 'My Conversations', headerStyle: { - backgroundColor: "rgb(49 0 110)", + backgroundColor: 'rgb(49 0 110)', }, - headerTintColor: "#fff", + headerTintColor: '#fff', headerTitleStyle: { - fontWeight: "bold", + fontWeight: 'bold', }, headerRight: () => (