Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/22998 - Init package #1

Merged
merged 34 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9d37f45
init project
rezkiy37 Jul 31, 2023
65ab46a
add typescript
rezkiy37 Jul 31, 2023
04f7cf3
add deps
rezkiy37 Jul 31, 2023
1434137
add eslint
rezkiy37 Jul 31, 2023
da8dd5b
add prettier
rezkiy37 Jul 31, 2023
0c8d20b
fix lint react warning
rezkiy37 Jul 31, 2023
1f49c78
uninstall deps
rezkiy37 Jul 31, 2023
d5db00c
fix id
rezkiy37 Jul 31, 2023
b5d46db
extend tsconfig
rezkiy37 Jul 31, 2023
cf0a088
add expensify deps
rezkiy37 Aug 1, 2023
f688ea3
fix ts launch
rezkiy37 Aug 1, 2023
fbb789d
fix lint
rezkiy37 Aug 2, 2023
85e214a
improve prettier ignore
rezkiy37 Aug 2, 2023
40d1f6b
improve project setup
rezkiy37 Aug 7, 2023
509c0c1
add husky
rezkiy37 Aug 7, 2023
f2b8c65
use pre-push
rezkiy37 Aug 7, 2023
79806f0
add gh actions
rezkiy37 Aug 8, 2023
bc0dea3
Revert "use pre-push"
rezkiy37 Aug 8, 2023
3b42444
Revert "add husky"
rezkiy37 Aug 8, 2023
56a4e39
split example with the source code
rezkiy37 Aug 8, 2023
8d396ce
prettify eslint
rezkiy37 Aug 8, 2023
3fbc77d
add react-fast-pdf package
rezkiy37 Aug 8, 2023
618624c
simplify scripts
rezkiy37 Aug 10, 2023
502e1e0
set 1.0.0 as initial version
rezkiy37 Aug 10, 2023
fd15c93
triger CI
rezkiy37 Aug 16, 2023
3e1437e
add on push trigger
rezkiy37 Aug 16, 2023
6a75742
triger CI
rezkiy37 Aug 16, 2023
c49cf7e
run prettier
rezkiy37 Aug 16, 2023
b1f8c63
Revert "add on push trigger"
rezkiy37 Aug 16, 2023
68b04e9
add test workflow
rezkiy37 Aug 16, 2023
59ce16f
fix
rezkiy37 Aug 16, 2023
1c31a34
remove test workflow
rezkiy37 Aug 16, 2023
a2d5aee
remove publish workflow
rezkiy37 Aug 16, 2023
5aa9aa4
connect cla workflow
rezkiy37 Aug 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"extends": ["eslint:recommended", "airbnb", "plugin:@typescript-eslint/recommended", "plugin:react/jsx-runtime", "plugin:jsx-a11y/recommended", "plugin:react/recommended", "prettier"],
"plugins": ["@typescript-eslint", "react", "jsx-a11y"],
"ignorePatterns": ["dist", "node_modules", ".git"],
"rules": {
"arrow-parens": [
"error",
"as-needed",
{
"requireForBlockBody": true
}
],
"no-invalid-this": "error",
"react/function-component-definition": [
"error",
{
"namedComponents": "function-declaration",
"unnamedComponents": "arrow-function"
}
],
"no-restricted-syntax": [
"error",
// The following four selectors prevent the usage of async/await
{
"selector": "AwaitExpression",
"message": "async/await is not allowed"
},
{
"selector": "FunctionDeclaration[async=true]",
"message": "async functions are not allowed"
},
{
"selector": "FunctionExpression[async=true]",
"message": "async functions are not allowed"
},
{
"selector": "ArrowFunctionExpression[async=true]",
"message": "async functions are not allowed"
},
{
"selector": "MethodDefinition[async=true]",
"message": "async methods are not allowed"
}
]
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"plugins": ["@typescript-eslint"],
"extends": ["plugin:@typescript-eslint/recommended-type-checked", "airbnb-typescript", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
}
}
],
"settings": {
"react": {
"version": "detect"
}
}
}
Binary file added .github/OSBotify-private-key.asc.gpg
Binary file not shown.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!-- 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 }}/contributingGuides/CLA.md'
branch: 'main'
remote-organization-name: 'Expensify'
remote-repository-name: 'CLA'
lock-pullrequest-aftermerge: false
allowlist: 'snyk-bot,OSBotify'
30 changes: 30 additions & 0 deletions .github/workflows/style_and_syntax_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Style and Syntax Checks

on:
pull_request:
types: [opened, synchronize]

jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npx eslint src

- name: Run Prettier
run: npx prettier . --check

- name: Run TypeScript checks
run: npm run ts
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# OSX
.DS_Store

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

# NPM file created by GitHub actions
.npmrc

# Decrypted private key we do not want to commit
.github/OSBotify-private-key.asc
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The GH actions don't seem to compile and verify themselves well when Prettier is applied to them
dist
package.json
package-lock.json
*.html
*.css
*.scss
*.md
*.yml
*.yaml
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: 4,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
arrowParens: 'always',
printWidth: 190,
singleAttributePerLine: true,
};
20 changes: 20 additions & 0 deletions contributingGuides/CLA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Expensify Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects (“Projects”) made available by Expensify Inc or its affiliates (“Expensify”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Expensify in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact reactnative@expensify.com.

You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your rights, title and interest in and to your Contributions.

**Copyright License.** You hereby grant, and agree to grant, to Expensify a non-exclusive, perpetual, irrevocable, worldwide, fully-paid, royalty-free, transferable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute your Contributions and such derivative works, with the right to sublicense the foregoing rights through multiple tiers of sublicensees.

**Patent License.** You hereby grant, and agree to grant, to Expensify a non-exclusive, perpetual, irrevocable, worldwide, fully-paid, royalty-free, transferable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer your Contributions, where such license applies only to those patent claims licensable by you that are necessarily infringed by your Contributions alone or by combination of your Contributions with the Project to which such Contributions were submitted, with the right to sublicense the foregoing rights through multiple tiers of sublicensees.

**Moral Rights.** To the fullest extent permitted under applicable law, you hereby waive, and agree not to assert, all of your “moral rights” in or relating to your Contributions for the benefit of Expensify, its assigns, and their respective direct and indirect sublicensees.

**Third Party Content/Rights.** If your Contribution includes or is based on any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that were not authored by you (“Third Party Content”) or if you are aware of any third party intellectual property or proprietary rights associated with your Contribution (“Third Party Rights”), then you agree to include with the submission of your Contribution full details respecting such Third Party Content and Third Party Rights, including, without limitation, identification of which aspects of your Contribution contain Third Party Content or are associated with Third Party Rights, the owner/author of the Third Party Content and Third Party Rights, where you obtained the Third Party Content, and any applicable third party license terms or restrictions respecting the Third Party Content and Third Party Rights. For greater certainty, the foregoing obligations respecting the identification of Third Party Content and Third Party Rights do not apply to any portion of a Project that is incorporated into your Contribution to that same Project.

**Representations.** You represent that, other than the Third Party Content and Third Party Rights identified by you in accordance with this Agreement, you are the sole author of your Contributions and are legally entitled to grant the foregoing licenses and waivers in respect of your Contributions. If your Contributions were created in the course of your employment with your past or present employer(s), you represent that such employer(s) has authorized you to make your Contributions on behalf of such employer(s) or such employer(s) has waived all of their right, title or interest in or to your Contributions.

**No Obligation.** You acknowledge that Expensify is under no obligation to use or incorporate your Contributions into any of the Projects. The decision to use or incorporate your Contributions into any of the Projects will be made at the sole discretion of Expensify or its authorized delegates.

**Assignment.** You agree that Expensify may assign this Agreement, and all of its rights, obligations and licenses hereunder.

74 changes: 74 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
jest: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
tsconfigRootDir: __dirname,
},
extends: ['eslint:recommended', 'airbnb', 'plugin:@typescript-eslint/recommended', 'plugin:react/jsx-runtime', 'plugin:jsx-a11y/recommended', 'plugin:react/recommended', 'prettier'],
plugins: ['@typescript-eslint', 'react', 'jsx-a11y'],
ignorePatterns: ['dist', 'node_modules', '.git'],
rules: {
'arrow-parens': [
'error',
'as-needed',
{
requireForBlockBody: true,
},
],
'no-invalid-this': 'error',
'react/function-component-definition': [
'error',
{
namedComponents: 'function-declaration',
unnamedComponents: 'arrow-function',
},
],
'no-restricted-syntax': [
'error',
// The following four selectors prevent the usage of async/await
{
selector: 'AwaitExpression',
message: 'async/await is not allowed',
},
{
selector: 'FunctionDeclaration[async=true]',
message: 'async functions are not allowed',
},
{
selector: 'FunctionExpression[async=true]',
message: 'async functions are not allowed',
},
{
selector: 'ArrowFunctionExpression[async=true]',
message: 'async functions are not allowed',
},
{
selector: 'MethodDefinition[async=true]',
message: 'async methods are not allowed',
},
],
},
overrides: [
{
files: ['*.ts', '*.tsx'],
plugins: ['@typescript-eslint'],
extends: ['plugin:@typescript-eslint/recommended-type-checked', 'airbnb-typescript', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
},
},
],
settings: {
react: {
version: 'detect',
},
},
};
8 changes: 8 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# OSX
.DS_Store

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

13 changes: 13 additions & 0 deletions example/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
"@babel/preset-env",
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
"@babel/preset-typescript"
],
"sourceMaps": true
}
Loading