Skip to content

Commit a45da17

Browse files
authored
Separate ESLint and Prettier (#3373)
* Disable legacy Prettier ESLint integration * Run Prettier separately * Add caching * Separate -some and -all * Reduce node inits
1 parent 0ff7e71 commit a45da17

5 files changed

Lines changed: 22 additions & 13 deletions

File tree

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module.exports = {
1515
'simple-import-sort',
1616
],
1717
rules: {
18+
// Temporary until https://github.com/facebook/react-native/pull/43756 gets into a release.
19+
'prettier/prettier': 0,
1820
'react/no-unescaped-entities': 0,
1921
'react-native/no-inline-styles': 0,
2022
'simple-import-sort/imports': [

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
attempt_delay: 2000
2525
- name: Lint check
2626
run: yarn lint
27+
- name: Prettier check
28+
run: yarn prettier --check .
2729
- name: Check & compile i18n
2830
run: yarn intl:build
2931
- name: Type check

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ google-services.json
104104
# Performance results (Flashlight)
105105
.perf/
106106

107+
# ESLint
108+
.eslintcache
109+
107110
# i18n
108111
src/locale/locales/_build/
109112
src/locale/locales/**/*.js

.prettierignore

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
ios
2-
android
3-
src/third-party
4-
src/app.json
5-
public
6-
/bskyweb/templates
7-
/dist/
8-
/.watchmanconfig
9-
/app.json
1+
# Ignore everything except the code in src/.
2+
# Based on https://stackoverflow.com/a/70715829/458193
3+
*
4+
!src/**/*.js
5+
!src/**/*.jsx
6+
!src/**/*.ts
7+
!src/**/*.tsx
8+
!*/
109

11-
web/index.html
12-
web-build/*
10+
# More specific ignores go below.
11+
src/locale/locales

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"test-watch": "NODE_ENV=test jest --watchAll",
2727
"test-ci": "NODE_ENV=test jest --ci --forceExit --reporters=default --reporters=jest-junit",
2828
"test-coverage": "NODE_ENV=test jest --coverage",
29-
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
29+
"lint": "yarn eslint --cache --ext .js,.jsx,.ts,.tsx src",
3030
"typecheck": "tsc --project ./tsconfig.check.json",
3131
"e2e:mock-server": "./jest/dev-infra/with-test-redis-and-db.sh ts-node --project tsconfig.e2e.json __e2e__/mock-server.ts",
3232
"e2e:metro": "NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
@@ -314,6 +314,9 @@
314314
]
315315
},
316316
"lint-staged": {
317-
"*{.js,.jsx,.ts,.tsx}": "yarn eslint --fix"
317+
"*{.js,.jsx,.ts,.tsx}": [
318+
"eslint --cache --fix",
319+
"prettier --cache --write --ignore-unknown"
320+
]
318321
}
319322
}

0 commit comments

Comments
 (0)