Skip to content

Commit

Permalink
Updated build scripts & configs, fixed linting & types
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlac committed Jun 8, 2021
1 parent 297cf00 commit 2d9d43d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fabric.properties
## Build generated
ios/build/
ios/DerivedData/
dist/

## Various settings
*.pbxuser
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
"react-native": "src/index",
"source": "src/index",
"scripts": {
"build": "tsc --project tsconfig.json",
"clean": "rm -rf dist/",
"test": "jest",
"lint": "yarn eslint -c .eslintrc.js",
"start": "watchman watch-del-all && node node_modules/react-native/local-cli/cli.js start",
"example": "yarn --cwd example",
"pods": "cd example && pod-install --quiet",
"bootstrap": "yarn example && yarn && yarn pods"
},
"main": "src/index.js",
"main": "dist/index.js",
"module": "dist/index.js",
"dependencies": {
"lodash": "^4.14.2"
},
Expand Down
7 changes: 4 additions & 3 deletions src/CameraScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default class CameraScreen extends Component<Props, State> {
if (this.props.cameraRatioOverlay) {
ratios = this.props.cameraRatioOverlay.ratios || [];
}
// eslint-disable-next-line react/no-did-mount-set-state
this.setState({
ratios: ratios || [],
ratioArrayPosition: ratios.length > 0 ? 0 : -1,
Expand Down Expand Up @@ -245,13 +246,13 @@ export default class CameraScreen extends Component<Props, State> {
);
}

sendBottomButtonPressedAction(type, captureRetakeMode, image) {
sendBottomButtonPressedAction(type: string, captureRetakeMode: boolean, image: null) {
if (this.props.onBottomButtonPressed) {
this.props.onBottomButtonPressed({ type, captureImages: this.state.captureImages, captureRetakeMode, image });
}
}

onButtonPressed(type) {
onButtonPressed(type: string) {
const captureRetakeMode = this.isCaptureRetakeMode();
if (captureRetakeMode) {
if (type === 'left') {
Expand All @@ -262,7 +263,7 @@ export default class CameraScreen extends Component<Props, State> {
}
}

renderBottomButton(type) {
renderBottomButton(type: string) {
const showButton = true;
if (showButton) {
const buttonNameSuffix = this.isCaptureRetakeMode() ? 'CaptureRetakeButtonText' : 'ButtonText';
Expand Down
37 changes: 20 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationDir": "./dist/",
"esModuleInterop": true,
"jsx": "react",
"lib": ["ESNext"],
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"jsx": "react-native",
"lib": ["ES6"],
"module": "ES6",
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "esnext",
"resolveJsonModule": true, // Required for JSON files
"skipLibCheck": true, // Skips *.d.ts files
"strictFunctionTypes": false,
"noImplicitAny": false,
"outDir": "./lib",
"baseUrl": "app",
"paths": {
"*": ["*", "*.ios", "*.android"]
}
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"outDir": "./dist",
"rootDir": "./src",
"sourceMap": true,
"removeComments": true,
"strictNullChecks": true,
"target": "ES6",
"skipLibCheck": true
},
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js", "**/*.json", "**/*.spec.ts"]
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
"exclude": ["**/__tests__/*", "*.test.tsx"]
}

0 comments on commit 2d9d43d

Please sign in to comment.