Skip to content

Commit

Permalink
chore: eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelavoyan committed Apr 14, 2024
1 parent 81102d5 commit d5d892e
Show file tree
Hide file tree
Showing 5 changed files with 820 additions and 265 deletions.
107 changes: 107 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
module.exports = {
root: true,
extends: [
'@react-native',
'airbnb',
'airbnb/hooks',
'airbnb-typescript',
'prettier',
"plugin:@typescript-eslint/recommended"
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json'
},
plugins: [
'@typescript-eslint',
'prettier',
'prefer-arrow-functions',
'autofix',
'unused-imports'
],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
paths: ['./']
}
}
},
env: {
es6: true
},
rules: {
"no-console": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-throw-literal": "off",
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports-ts': 'error',
'unused-imports/no-unused-vars-ts': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_'
}
],
'autofix/no-debugger': 'error',
'prefer-destructuring': [
'error',
{
array: false,
object: true
},
{
enforceForRenamedProperties: false
}
],
'prefer-arrow-functions/prefer-arrow-functions': [
'warn',
{
classPropertiesAllowed: false,
disallowPrototype: false,
returnStyle: 'unchanged',
singleReturnOnly: false
}
],
'react/prop-types': 0,
'import/prefer-default-export': 0,
'react/jsx-props-no-spreading': 0,
'no-underscore-dangle': 0,
'@typescript-eslint/no-use-before-define': [
'error',
{variables: false, classes: true, functions: true}
],
'no-param-reassign': 0,
'no-underscore-dangle': [
'error',
{allowAfterThis: true, allow: ['_id']}
],
quotes: [2, 'single', {avoidEscape: true}],
'no-use-before-define': 0,
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'storybook/**',
'storybook/**/**/**',
'stories/**'
]
}
],
'global-require': 0,
'react/require-default-props': 'off',
'react/prop-types': 'off',
'react/function-component-definition': 'off',
'react/no-unstable-nested-components': 'off',
'react/jsx-no-useless-fragment': 'off',
'prettier/prettier': 'off',
'arrow-body-style': 'off',
'no-promise-executor-return': 'off',
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/return-await': 'off'
}
};
14 changes: 7 additions & 7 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import * as React from 'react';

import { StyleSheet, View, Text, Button } from 'react-native';

import { Utils } from './Utils';
import { Constants } from './Constants';
import vcl, {
type VCLCountries,
VCLCountryCodes,
Expand Down Expand Up @@ -50,6 +48,8 @@ import vcl, {
type VCLDidJwkDescriptor,
} from '@velocitycareerlabs/vcl-react-native';
import { useRef } from 'react';
import { Utils } from './Utils';
import { Constants } from './Constants';

export const enum InitState {
Initializing,
Expand All @@ -63,7 +63,7 @@ const didJwkDescriptor: VCLDidJwkDescriptor = {
signatureAlgorithm: VCLSignatureAlgorithm.ES256,
};

export default function App() {
export default () => {
const didJwkRef = useRef(null as unknown as VCLDidJwk);

const [initState, setInitState] = React.useState<InitState>(
Expand Down Expand Up @@ -595,21 +595,21 @@ export default function App() {
<Button title="Generate DID:JWK" onPress={generateDidJwk} />
</View>
);
} else if (initState === InitState.InitializationFailed) {
} if (initState === InitState.InitializationFailed) {
return (
<View style={styles.container}>
<Text>Initialization Failed</Text>
<Text>{JSON.stringify(error)}</Text>
</View>
);
} else {
}
return (
<View style={styles.container}>
<Text>Initializing...</Text>
</View>
);
}
}

};

const styles = StyleSheet.create({
container: {
Expand Down
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,21 @@
"commitlint": "^19.1.0",
"del-cli": "^5.1.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-prettier": "^5.0.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-autofix": "^1.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-jsx-a11y": "^6.8.0 ",
"eslint-plugin-prefer-arrow-functions": "^3.3.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-unused-imports": "^3.1.0",
"jest": "^29.7.0",
"prettier": "^3.0.3",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/api/VCLApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { NativeModules } from 'react-native';
import type { VCLCredentialManifest } from './entities/VCLCredentialManifest';
import type { VCLCredentialManifestDescriptor } from './entities/VCLCredentialManifestDescriptor';
import type { VCLCredentialTypeSchemas } from './entities/VCLCredentialTypeSchemas';
Expand Down Expand Up @@ -34,7 +35,6 @@ import type { VCLDidJwk } from './entities/VCLDidJwk';
import type { VCLCredentialTypes } from './entities/VCLCredentialTypes';
import type { VCLDidJwkDescriptor } from './entities/VCLDidJwkDescriptor';

import { NativeModules } from 'react-native';
import { VCLError } from './entities/error/VCLError';

const { VclReactNative } = NativeModules;
Expand Down
Loading

0 comments on commit d5d892e

Please sign in to comment.