From d5d892e8f24f9beb0b5b7f8364ad262e981b64d2 Mon Sep 17 00:00:00 2001 From: Michael Avoyan Date: Sun, 14 Apr 2024 19:32:35 +0300 Subject: [PATCH] chore: eslint configuration --- .eslintrc.js | 107 +++++ example/src/App.tsx | 14 +- package.json | 17 +- src/api/VCLApi.ts | 2 +- yarn.lock | 945 ++++++++++++++++++++++++++++++++------------ 5 files changed, 820 insertions(+), 265 deletions(-) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..f097627 --- /dev/null +++ b/.eslintrc.js @@ -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' + } +}; diff --git a/example/src/App.tsx b/example/src/App.tsx index d4c4cfb..775016c 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -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, @@ -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, @@ -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( @@ -595,21 +595,21 @@ export default function App() {