Skip to content

Commit

Permalink
Merge branch 'main' into multiple-blockquotes-android
Browse files Browse the repository at this point in the history
  • Loading branch information
robertKozik committed Jan 22, 2024
2 parents 3a19496 + 1617ec0 commit 7e65264
Show file tree
Hide file tree
Showing 123 changed files with 2,606 additions and 1,706 deletions.
17 changes: 16 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
**/node_modules/*
parser/out.js
parser/react-native-live-markdown-parser.js

# any js file inside android and ios folders
**/android/**/*.js
**/ios/**/*.js

# Output of the build process & scripts
lib/**/*
scripts/**/*

babel.config.js
metro.config.js
react-native.config.js
jest.config.js
webpack.config.js
.eslintrc.js
45 changes: 21 additions & 24 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ module.exports = {
project: true,
tsconfigRootDir: __dirname,
},
env: {
jest: true,
},
extends: [
'expensify',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:@typescript-eslint/stylistic',
'plugin:import/typescript',
'prettier',
'plugin:prettier/recommended',
],
plugins: [
Expand All @@ -19,39 +24,29 @@ module.exports = {
],
settings: {
'import/resolver': {
alias: [['react-native-markdown-text-input', './src/index.tsx']],
alias: [['@expensify/react-native-live-markdown', './src/index.tsx']],
},
},
root: true,
rules: {
'prettier/prettier': [
'error',
'rulesdir/prefer-underscore-method': 'off',
'react/jsx-props-no-spreading': 'off',
'react/require-default-props': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }],
"import/extensions": [
"error",
"ignorePackages",
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
},
],
'curly': 'error',
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
'import/no-unresolved': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'react/jsx-uses-vars': 'error',
'react/jsx-uses-react': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off', // TODO consider enabling this (currently it reports styles defined at the bottom of the file)
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-expect-error': 'allow-with-description',
},
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-var-requires': 'warn',
'eqeqeq': 'error',
'no-unreachable': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
Expand All @@ -62,5 +57,7 @@ module.exports = {
],
'tsdoc/syntax': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/consistent-type-definitions': 'off',
},
};
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
*.bat text eol=crlf
Binary file added .github/OSBotify-private-key.asc.gpg
Binary file not shown.
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Details
<!-- Explanation of the change or anything fishy that is going on -->

### Related Issues
<!-- Please replace GH_LINK with the link to the GitHub issue this Pull Request is related to -->
GH_LINK

### Manual Tests
<!---
Most changes should have accompanying tests. Describe the tests you added or if no tests were added an explanation about why one was not needed.
--->

### Linked PRs
<!---
Please include links to any update PRs in repos that must change their package.json version.
--->
39 changes: 39 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CLA Assistant

on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

jobs:
CLA:
runs-on: ubuntu-latest
# This job only runs for pull request comments or pull request target events (not issue comments)
if: github.event.issue.pull_request || github.event_name == 'pull_request_target'
steps:
- uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73
id: sign
with:
text: ${{ github.event.comment.body }}
regex: '\s*I have read the CLA Document and I hereby sign the CLA\s*'
- uses: actions-ecosystem/action-regex-match@9c35fe9ac1840239939c59e5db8839422eed8a73
id: recheck
with:
text: ${{ github.event.comment.body }}
regex: '\s*recheck\s*'
- name: CLA Assistant
if: ${{ steps.recheck.outputs.match != '' || steps.sign.outputs.match != '' }} || github.event_name == 'pull_request_target'
# Version: 2.1.2-beta
uses: cla-assistant/github-action@948230deb0d44dd38957592f08c6bd934d96d0cf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN : ${{ secrets.CLA_BOTIFY_TOKEN }}
with:
path-to-signatures: '${{ github.repository }}/cla.json'
path-to-document: 'https://github.com/${{ github.repository }}/blob/main/CLA.md'
branch: 'main'
remote-organization-name: 'Expensify'
remote-repository-name: 'CLA'
lock-pullrequest-aftermerge: false
allowlist: 'snyk-bot,OSBotify'
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint JavaScript

on:
pull_request:
types: [opened, synchronize]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Setup web example
run: npm ci
working-directory: ./WebExample

- run: yarn install --immutable


- name: Verify there's no Prettier diff
run: |
yarn lint --fix --quiet
if ! git diff --name-only --exit-code; then
# shellcheck disable=SC2016
echo 'Error: Prettier diff detected! Please run `npm run prettier` and commit the changes.'
exit 1
fi
87 changes: 87 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# name: Publish package to npmjs

# # This workflow runs when code is pushed to `main` (i.e: when a pull request is merged)
# on:
# push:
# branches: [main]

# # Ensure that only once instance of this workflow executes at a time.
# # If multiple PRs are merged in quick succession, there will only ever be one publish workflow running and one pending.
# concurrency: ${{ github.workflow }}

# jobs:
# version:
# runs-on: ubuntu-latest

# # OSBotify will update the version on `main`, so this check is important to prevent an infinite loop
# if: ${{ github.actor != 'OSBotify' }}

# steps:
# - uses: actions/checkout@v3
# with:
# ref: main

# - name: Decrypt & Import OSBotify GPG key
# run: |
# cd .github
# gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output OSBotify-private-key.asc OSBotify-private-key.asc.gpg
# gpg --import OSBotify-private-key.asc
# env:
# LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

# - name: Set up git for OSBotify
# run: |
# git config --global user.signingkey 367811D53E34168C
# git config --global commit.gpgsign true
# git config --global user.name OSBotify
# git config --global user.email [email protected]

# - uses: actions/setup-node@v3
# with:
# node-version: '16.x'
# registry-url: 'https://registry.npmjs.org'

# - name: Generate branch name
# run: echo "BRANCH_NAME=OSBotify-bump-version-$(uuidgen)" >> $GITHUB_ENV

# - name: Create branch for version-bump pull request
# run: git checkout -b ${{ env.BRANCH_NAME }}

# - name: Install npm packages
# run: npm ci

# - name: Update npm version
# run: npm version patch

# - name: Set new version in GitHub ENV
# run: echo "NEW_VERSION=$(jq '.version' package.json)" >> $GITHUB_ENV

# - name: Push branch and publish tags
# run: git push --set-upstream origin ${{ env.BRANCH_NAME }} && git push --tags

# - name: Create pull request
# run: |
# gh pr create \
# --title "Update version to ${{ env.NEW_VERSION }}" \
# --body "Update version to ${{ env.NEW_VERSION }}"
# sleep 5
# env:
# GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}

# - name: Auto-approve pull request
# run: gh pr review --approve ${{ env.BRANCH_NAME }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Auto-merge pull request
# run: gh pr merge --merge --delete-branch ${{ env.BRANCH_NAME }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Build package
# run: npm run build

# - name: Publish to npm
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# OSX
#
.DS_Store

# XDE
.expo/
# IDE
.idea

# VSCode
.vscode/
jsconfig.json

# NPM file created by GitHub actions
.npmrc

# Xcode
#
build/
*.pbxuser
!default.pbxuser
Expand All @@ -30,7 +31,6 @@ DerivedData
project.xcworkspace

# Android/IJ
#
.classpath
.cxx
.gradle
Expand All @@ -48,11 +48,11 @@ example/ios/Pods
example/vendor/

# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
dist/

# BUCK
buck-out/
Expand All @@ -77,5 +77,5 @@ android/keystores/debug.keystore
# generated by bob
lib/

# react-native-markdown-text-input
android/src/main/assets/out.js
# react-native-live-markdown
android/src/main/assets/react-native-live-markdown-parser.js
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scripts/**/*
CODE_OF_CONDUCT.md
.eslintrc.js
9 changes: 9 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
tabWidth: 2,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
arrowParens: 'always',
printWidth: 190,
singleAttributePerLine: true,
};
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ nmHoistingLimits: workspaces
plugins:
- path: scripts/pod-install.cjs
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.6.1.cjs
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ The [example app](/example/) demonstrates usage of the library. You need to run

It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.

If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/MarkdownTextInputExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-markdown-text-input`.
If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/LiveMarkdownExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-live-markdown`.

To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-markdown-text-input` under `Android`.
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-live-markdown` under `Android`.

You can use various commands from the root directory to work with the project.

Expand Down Expand Up @@ -71,7 +71,7 @@ yarn clean
To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this:

```sh
Running "MarkdownTextInputExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
Running "LiveMarkdownExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
```

Note the `"fabric":true` and `"concurrentRoot":true` properties.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Tomasz Zawadzki
Copyright (c) 2024 Expensify, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
Loading

0 comments on commit 7e65264

Please sign in to comment.