Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
node_modules/**
node_modules/**
lib/**
coverage/**
*.min.js
*.bundle.js
*.snap
*.log
*.lock
*.map
149 changes: 80 additions & 69 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2021,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
es2021: true,
"jest/globals": true,
"react-native/react-native": true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:prettier/recommended",
],
ignorePatterns: [
"**/*/*.js",
"*.js",
"*.svg",
"*.json",
"*.png",
"package.json",
"package-lock.json",
],
parser: "@typescript-eslint/parser",
plugins: [
"import",
"react",
"react-native",
"prettier",
"react-hooks",
"jest",
"@typescript-eslint",
"promise",
"unused-imports",
"import",
],
env: {
browser: true,
es2021: true,
"react-native/react-native": true,
},
settings: {
react: {
version: "detect",
Expand Down Expand Up @@ -58,23 +59,59 @@ module.exports = {
],
},
},
// Ensure the import plugin does not try to parse node_modules with the TS parser
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
// Treat react-native as a core module and skip deep parsing
"import/core-modules": ["react-native"],
// And in general, do not attempt to parse files in node_modules
"import/ignore": ["node_modules/"],
},
ignorePatterns: [
"**/*/*.js",
"*.js",
"*.svg",
"*.json",
"package.json",
"package-lock.json",
"lib/**",
],
rules: {
"prettier/prettier": [
"error",
{
endOfLine: "auto",
},
],
quotes: [
"error",
"double",
{
avoidEscape: true,
},
],
"max-len": ["error", 120],
"no-useless-catch": "off",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{ prefer: "type-imports" },
],
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
"react/react-in-jsx-scope": "off",
"react-native/no-unused-styles": "error",
"react-native/split-platform-components": "error",
"react-native/no-inline-styles": "off",
"react-native/no-color-literals": "off",
"react-native/no-raw-text": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"import/extensions": [
"error",
"never",
Expand All @@ -85,51 +122,25 @@ module.exports = {
png: "always",
jpg: "always",
json: "always",
constant: "always",
},
],
"react-hooks/exhaustive-deps": [
"error",
{ additionalHooks: "(useMemoOne)" },
],
"max-len": ["error", 120],
"@typescript-eslint/ban-ts-comment": 2,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/explicit-module-boundary-types": 0,
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2,
"react-native/no-inline-styles": 0,
"react-native/no-color-literals": 0,
"react-native/no-raw-text": 0,
"import/no-extraneous-dependencies": 2,
"import/no-named-as-default-member": 2,
"import/order": 0,
"import/no-duplicates": 2,
"import/no-useless-path-segments": 2,
"import/no-cycle": 2,
"import/prefer-default-export": 0,
"import/no-anonymous-default-export": 0,
"import/named": 0,
"@typescript-eslint/no-empty-interface": 0,
"import/namespace": 0,
"import/default": 0,
"import/no-named-as-default": 0,
"import/no-unused-modules": 0,
"import/no-deprecated": 0,
"@typescript-eslint/indent": 0,
"react-hooks/rules-of-hooks": 2,
"unused-imports/no-unused-imports": 2,
"unused-imports/no-unused-vars": 2,
camelcase: 2,
"prefer-destructuring": 2,
"no-nested-ternary": 2,
"prettier/prettier": [
"error",
{
endOfLine: "auto",
},
],
"import/no-extraneous-dependencies": "error",
"import/no-named-as-default-member": "error",
"import/no-duplicates": "error",
"import/no-useless-path-segments": "error",
"import/no-cycle": "error",
"import/prefer-default-export": "off",
"import/no-anonymous-default-export": "off",
"import/named": "off",
"import/namespace": "off",
"import/default": "off",
"import/no-named-as-default": "off",
"import/no-unused-modules": "off",
"import/no-deprecated": "off",
"@typescript-eslint/indent": "off",
"react-hooks/rules-of-hooks": "error",
camelcase: "error",
"prefer-destructuring": "error",
"no-nested-ternary": "error",
},
};
107 changes: 107 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: CI

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
typecheck:
name: Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run typecheck
run: npm run typecheck

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run ESLint
run: npm run lint:ci

- name: Run Prettier check
run: npm run prettier:ci

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests with coverage
run: npm run test:coverage

- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: coverage/
retention-days: 7

build:
name: Build
runs-on: ubuntu-latest
needs: [typecheck, lint, test]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build library
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: lib
path: lib/
retention-days: 7
34 changes: 13 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# OSX
#
# macOS
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
Expand All @@ -21,43 +19,37 @@ DerivedData
*.ipa
*.xcuserstate

# Android/IntelliJ
#
build/
# Android / IntelliJ
.idea
.gradle
local.properties
*.iml

# Visual Studio Code
#
.vscode/

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

# Build output (generated by react-native-builder-bob)
lib/

# Test coverage
coverage/

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
# Bundle artifacts
*.jsbundle

# CocoaPods
/ios/Pods/

# TypeScript incremental
*.tsbuildinfo
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit
npx --no-install commitlint --edit $1
6 changes: 1 addition & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run prettier
npm run lint
npx lint-staged
Loading
Loading