Dev setup

This commit is contained in:
Marc Rousavy 2021-02-19 18:19:32 +01:00
parent d86a021441
commit 5ba1df8c08
5 changed files with 1930 additions and 1 deletions

113
example/.eslintrc.js Normal file
View File

@ -0,0 +1,113 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
globals: {
Logger: true,
performance: true,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react', 'react-native', '@react-native-community', 'prettier', 'react-hooks'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
'@react-native-community',
'plugin:react-hooks/recommended',
],
rules: {
// eslint
semi: 'off',
curly: ['warn', 'multi-or-nest', 'consistent'],
'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
'no-async-promise-executor': 'warn',
'require-await': 'warn',
'no-return-await': 'warn',
'no-await-in-loop': 'warn',
'comma-dangle': 'off', // prettier already detects this
'no-restricted-syntax': [
'error',
{
selector: 'TSEnumDeclaration',
message: "Enums have various disadvantages, use TypeScript's union types instead.",
},
],
// prettier
'prettier/prettier': ['warn'],
// typescript
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false,
varsIgnorePattern: '^_',
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true,
},
],
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unsafe-assignment': 'error',
// react plugin
'react/no-unescaped-entities': 'off',
// react native plugin
'react-native/no-unused-styles': 'warn',
'react-native/split-platform-components': 'warn',
'react-native/no-inline-styles': 'warn',
'react-native/no-color-literals': 'warn',
'react-native/no-raw-text': 'off',
'react-native/no-single-element-style-arrays': 'warn',
// react hooks
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks: '(useDerivedValue|useAnimatedStyle|useAnimatedProps|useWorkletCallback)',
},
],
},
env: {
node: true,
'react-native/react-native': true,
},
settings: {
react: {
version: 'latest',
},
'import/resolver': {
extensions: [
'.js',
'.jsx',
'.ts',
'.tsx',
'.d.ts',
'.android.js',
'.android.jsx',
'.android.ts',
'.android.tsx',
'.ios.js',
'.ios.jsx',
'.ios.ts',
'.ios.tsx',
'.web.js',
'.web.jsx',
'.web.ts',
'.web.tsx',
],
},
},
};

10
example/.prettierrc.js Normal file
View File

@ -0,0 +1,10 @@
module.exports = {
bracketSpacing: true,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
semi: true,
tabWidth: 2,
useTabs: false,
printWidth: 150
};

1760
example/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,20 @@
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@react-native-community/eslint-plugin": "^1.1.0",
"@types/react": "^17.0.2",
"@types/react-native": "^0.63.50",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"babel-plugin-module-resolver": "^4.0.0",
"metro-react-native-babel-preset": "^0.64.0"
"eslint": "^7.20.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.10.0",
"metro-react-native-babel-preset": "^0.64.0",
"prettier": "^2.2.1",
"typescript": "^4.1.5"
}
}

33
example/tsconfig.json Normal file
View File

@ -0,0 +1,33 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"react-native-vision-camera": ["./src/index"]
},
"allowJs": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"esModuleInterop": true,
"importsNotUsedAsValues": "error",
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["esnext"],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noStrictGenericChecks": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "esnext"
},
"exclude": [
"node_modules",
"babel.config.js",
"jest.config.js",
".eslintrc.js"
]
}