Skip to content

Commit

Permalink
Proposal: Apply prettier on the whole project files (#313)
Browse files Browse the repository at this point in the history
## 📜 Description

This is a proposal. When I'm working on the repository, I notice that
the formatter (prettier) update some part of the files even if I don't
changed them. This occurs because some files are not formatted with it,
this PR add a new npm command (`format`) and run it.

I know that this is a lot of changes (especially in the docs markdown
files), feels free to close the PR if you don't want to deal with this.

## 💡 Motivation and Context

This simplifies collaboration on the project, can even been run on
commit using `lint-staged`.

---------

Co-authored-by: kirillzyusko <[email protected]>
  • Loading branch information
zoontek and kirillzyusko authored Dec 27, 2023
1 parent 97e9c8f commit b6d2ca8
Show file tree
Hide file tree
Showing 325 changed files with 4,154 additions and 3,764 deletions.
96 changes: 43 additions & 53 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,102 +1,92 @@
module.exports = {
root: true,
plugins: ['@typescript-eslint', 'react', 'react-native', 'jest', 'import'],
plugins: ["@typescript-eslint", "react", "react-native", "jest", "import"],
extends: [
'@react-native',
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:import/typescript',
"@react-native",
"prettier",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:import/typescript",
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
'import/resolver': {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: '<root>/tsconfig.json',
project: "<root>/tsconfig.json",
},
},
},
rules: {
'prettier/prettier': [
'error',
"prettier/prettier": [
"error",
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
quoteProps: "consistent",
trailingComma: "all",
},
],
// react
'react-hooks/exhaustive-deps': 'warn',
"react-hooks/exhaustive-deps": "warn",
// typescript
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports" },
],
'@typescript-eslint/no-var-requires': 'warn',
"@typescript-eslint/no-var-requires": "warn",
// import
'sort-imports': [
'error',
"sort-imports": [
"error",
{
// sort destructure imports
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'],
memberSyntaxSortOrder: ["none", "all", "single", "multiple"],
allowSeparatedGroups: true,
},
],
'import/order': [
'error',
"import/order": [
"error",
{
'groups': [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'type',
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"type",
],
'alphabetize': {
order: 'asc',
"alphabetize": {
order: "asc",
caseInsensitive: true,
},
'newlines-between': 'always',
"newlines-between": "always",
},
],
},
overrides: [
{
files: ['src/specs/**'],
files: ["src/specs/**"],
rules: {
'@typescript-eslint/ban-types': [
'error',
"@typescript-eslint/ban-types": [
"error",
{
extendDefaults: true,
types: {
'{}': false,
"{}": false,
},
},
],
},
},
],
env: {
'react-native/react-native': true,
'jest/globals': true,
"react-native/react-native": true,
"jest/globals": true,
},
ignorePatterns: [
'node_modules/**',
'lib/**',
'example/**',
'FabricExample/**',
'docs/**',
'scripts/**',
],
ignorePatterns: ["node_modules/**", "lib/**", "scripts/**"],
};
21 changes: 11 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: ""
labels: bug
assignees: kirillzyusko

---

**Describe the bug**
Expand All @@ -18,6 +17,7 @@ I would be highly appreciate if you can provide repository for reproducing your

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -30,13 +30,14 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Smartphone (please complete the following information):**
- Desktop OS: [e.g. Windows 10, MacOS 10.15.5]
- Device: [e.g. iPhone8]
- OS: [e.g. iOS 10.0]
- RN version: [e.g. 0.68.2]
- RN architecture: [e.g. old/new or paper/fabric]
- JS engine: [e.g. JSC, Hermes, v8]
- Library version: [e.g. 1.2.0]

- Desktop OS: [e.g. Windows 10, MacOS 10.15.5]
- Device: [e.g. iPhone8]
- OS: [e.g. iOS 10.0]
- RN version: [e.g. 0.68.2]
- RN architecture: [e.g. old/new or paper/fabric]
- JS engine: [e.g. JSC, Hermes, v8]
- Library version: [e.g. 1.2.0]

**Additional context**
Add any other context about the problem here.
Add any other context about the problem here.
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: ""
labels: Feature
assignees: kirillzyusko

---

**Is your feature request related to a problem? Please describe.**
Expand All @@ -17,4 +16,4 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots about the feature request here.
21 changes: 14 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## 📜 Description

<!-- Describe your changes in detail -->

## 💡 Motivation and Context

<!-- Why is this change required? What problem does it solve? -->
<!-- If it fixes an open issue, please link to the issue here. -->

Expand All @@ -12,26 +14,31 @@
<!-- If your changes don't affect one of platform/language below - then remove this platform/language -->

### JS
-
-

-
-

### iOS
-
-

-
-

### Android
-
-

-
-

## 🤔 How Has This Been Tested?

<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
<!-- see how your change affects other areas of the code, etc. -->

## 📸 Screenshots (if appropriate):

<!-- Add screenshots/video if needed -->
<!-- That would be highly appreciated if you can add how it looked before and after your changes -->

## 📝 Checklist

- [ ] CI successfully passed
- [ ] CI successfully passed
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: true
closeComment: true
42 changes: 21 additions & 21 deletions .github/workflows/android-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ name: 🛠 Android e2e tests
on:
pull_request:
paths:
- '.github/workflows/android-e2e-test.yml'
- 'package.json'
- 'android/**'
- 'example/**'
- 'e2e/**'
- 'src/**'
- ".github/workflows/android-e2e-test.yml"
- "package.json"
- "android/**"
- "example/**"
- "e2e/**"
- "src/**"
push:
branches:
- main
paths:
- '.github/workflows/android-e2e-test.yml'
- 'package.json'
- 'android/**'
- 'example/**'
- 'e2e/**'
- 'src/**'
- ".github/workflows/android-e2e-test.yml"
- "package.json"
- "android/**"
- "example/**"
- "e2e/**"
- "src/**"

jobs:
test:
Expand All @@ -27,19 +27,19 @@ jobs:
env:
WORKING_DIRECTORY: example
concurrency:
group: android-e2e-${{ github.ref }}
cancel-in-progress: true
group: android-e2e-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
node-version: 18.x
cache: "yarn"
- name: Setup JDK 11
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '11'
distribution: "microsoft"
java-version: "11"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -77,8 +77,8 @@ jobs:
api-level: 28
target: default
profile: pixel_2
ram-size: '4096M'
disk-size: '10G'
ram-size: "4096M"
disk-size: "10G"
disable-animations: false
avd-name: e2e_emulator
arch: x86_64
Expand All @@ -87,4 +87,4 @@ jobs:
if: ${{ failure() }}
with:
name: android-fail-screen-shoots
path: e2e/artifacts
path: e2e/artifacts
30 changes: 15 additions & 15 deletions .github/workflows/build-android-fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ on:
branches:
- main
paths:
- '.github/workflows/build-android-fabric.yml'
- 'android/**'
- 'FabricExample/android/**'
- 'yarn.lock'
- 'FabricExample/yarn.lock'
- 'src/specs/**'
- ".github/workflows/build-android-fabric.yml"
- "android/**"
- "FabricExample/android/**"
- "yarn.lock"
- "FabricExample/yarn.lock"
- "src/specs/**"
pull_request:
paths:
- '.github/workflows/build-android-fabric.yml'
- 'android/**'
- 'FabricExample/android/**'
- 'yarn.lock'
- 'FabricExample/yarn.lock'
- 'src/specs/**'
- ".github/workflows/build-android-fabric.yml"
- "android/**"
- "FabricExample/android/**"
- "yarn.lock"
- "FabricExample/yarn.lock"
- "src/specs/**"

jobs:
build:
Expand All @@ -30,8 +30,8 @@ jobs:
- name: Setup JDK 11
uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '11'
distribution: "microsoft"
java-version: "11"

- name: Get yarn cache directory path
id: fabric-yarn-cache-dir-path
Expand All @@ -57,4 +57,4 @@ jobs:
restore-keys: |
${{ runner.os }}-fabric-gradle-
- name: Run Gradle Build for FabricExample/android/
run: cd FabricExample/android && ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a && cd ../..
run: cd FabricExample/android && ./gradlew assembleDebug --build-cache -PreactNativeArchitectures=arm64-v8a && cd ../..
Loading

0 comments on commit b6d2ca8

Please sign in to comment.