Skip to content

Commit 9172dd1

Browse files
committed
upate
1 parent cb457e4 commit 9172dd1

File tree

1 file changed

+21
-47
lines changed
  • challenges/ecosystem

1 file changed

+21
-47
lines changed

challenges/ecosystem/02.md

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,31 @@ Prettier is an opinionated code formatter. It enforces a consistent style by par
4242

4343
![Prettier format on save preview on VS Code](https://raw.githubusercontent.com/flexbox/react-native-workshop/main/challenges/ecosystem/format-on-save.png)
4444

45+
### Setup ESLint
4546

46-
### Setup ESLint in your expo project
47+
- [ ] Setup ESLint in your project with the following command:
4748

4849
```console
4950
npx expo lint
5051
```
5152

52-
You can lint your code manually by rerunning `npx expo lint` in your terminal.
53+
- [ ] Answer **yes** to the following question:
5354

54-
- [ ] Setup ESLint in your project.
55-
- [ ] Run `npx expo lint` in your terminal.
55+
```console
56+
✔ No ESLint config found. Install and configure ESLint in this project?
57+
```
58+
59+
You will have a `.eslintrc.js` file created at the root of your project.
5660

5761
### Prettier
5862

59-
For other packages managers
60-
```console
61-
npx expo install -- --save-dev prettier eslint-config-prettier eslint-plugin-prettier
62-
```
63+
- [ ] Install the following dependencies
6364

64-
For yarn
6565
```console
66-
yarn add -D prettier eslint-config-prettier eslint-plugin-prettier
66+
npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier
67+
# or `yarn add --dev prettier eslint-config-prettier eslint-plugin-prettier`
6768
```
6869

69-
- [ ] add the dependencies to your project.
70-
7170
- [ ] Update your `eslintrc.js` file to add the following rules:
7271

7372
```javascript
@@ -87,11 +86,8 @@ module.exports = {
8786
- [ ] Update your scripts on `package.json` to check errors.
8887

8988
```json
90-
<<<<<<< Updated upstream
9189
// package.json
9290

93-
=======
94-
>>>>>>> Stashed changes
9591
"scripts": {
9692
...
9793
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
@@ -130,9 +126,7 @@ We are making progress, but we are not done yet. We need to add rules for React
130126

131127
```console
132128
npm install --dev prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react
133-
```
134-
```console
135-
yarn add -D prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react
129+
# or `yarn add --dev prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react`
136130
```
137131

138132
- [ ] Update your `.eslintrc.js` file to add the following rules:
@@ -190,9 +184,7 @@ We want to add some rules to our ESLint configuration.
190184

191185
```console
192186
npm install --dev eslint-plugin-react-native
193-
```
194-
```console
195-
yarn add -D eslint-plugin-react-native
187+
# or `yarn add --dev eslint-plugin-react-native`
196188
```
197189

198190
- [ ] Update your `.eslintrc.js` file to add the following react-native rules:
@@ -218,9 +210,7 @@ We now want to sort our imports automatically. We can use the `simple-import-sor
218210

219211
```console
220212
npm install --dev eslint-plugin-simple-import-sort
221-
```
222-
```console
223-
yarn add -D eslint-plugin-simple-import-sort
213+
# or `yarn add --dev eslint-plugin-simple-import-sort`
224214
```
225215

226216
- [ ] Update your `.eslintrc.js` file to add the following import rules:
@@ -249,28 +239,8 @@ yarn add -D eslint-plugin-simple-import-sort
249239
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
250240
]
251241
}
252-
<<<<<<< Updated upstream
253242
],
254243
},
255-
=======
256-
]
257-
}
258-
};
259-
```
260-
261-
- Create a `.prettierrc` file at the root of your project with the following content:
262-
263-
```json
264-
// .prettierrc
265-
266-
{
267-
"$schema": "http://json.schemastore.org/prettierrc",
268-
"semi": true,
269-
"singleAttributePerLine": true,
270-
"trailingComma": "none",
271-
"tabWidth": 2,
272-
"singleQuote": false
273-
>>>>>>> Stashed changes
274244
}
275245
```
276246

@@ -298,6 +268,12 @@ In our case `cargo_capacity`, `cost_in_credits` are not using `camelCase` and we
298268

299269
## 👽 Bonus
300270

271+
### Avoid data layer issues
272+
273+
- [ ] Install [TanStack Query ESLint plugin](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query).
274+
275+
### Share your settings with your team
276+
301277
You can share your VSCode settings with your team by adding a `.vscode` folder at the root of your project with the following content:
302278

303279
```json
@@ -314,6 +290,4 @@ You can share your VSCode settings with your team by adding a `.vscode` folder a
314290

315291
This will make sure everyone in your team is using the same settings.
316292

317-
- [ ] create a ``.vscode` folder and paste the previous `settings.json` files.
318-
319-
- [ ] Install [TanStack Query ESLint plugin](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query).
293+
- [ ] create a ``.vscode` folder and paste the previous `settings.json` files.

0 commit comments

Comments
 (0)