codeforbtv / baby-equipment-exchange

MIT License
0 stars 8 forks source link

Add dependencies and configuration files. #1

Closed NathanWEdwards closed 1 year ago

NathanWEdwards commented 1 year ago

This request adds several classes to support a data model, configurations for TypeScript and linting, and methods for interacting with Firebase.

CI integration was excluded from this request. The project needs to be initialized in a CI/CD environment. A Google Cloud Service Account with appropriate permissions needs to be added.

Entities are provided as classes over types for use with the Firebase API. Accessor methods are provided for each entity to promote use of calling methods to access an entity's data members. A models directory contains plain objects for the following entities:

api/firebase-donation.ts and api/firebase-images.ts outline how entities may be retrieved as documents and collections from storage.

Initial tests present in this request are situated side-by-side the the feature/file they test. A dedicated test directory for .spec/test files is not included. Test support includes development dependencies for:

ESLint is provided as the linter of choice with the following configuration:

module.exports = {
    parser: '@typescript-eslint/parser',
    extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:@typescript-eslint/recommended'],
    plugins: ['@typescript-eslint', 'react-hooks', 'prettier'],
    parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module',
        ecmaFeatures: {
            jsx: true
        }
    },
    env: {
        browser: true,
        node: true,
        es6: true,
        jest: true
    },
    rules: {
        'no-control-regex': 0,
        'no-undef': 0,
        'no-unused-vars': 'off',
        'react/prop-types': 0,
        '@typescript-eslint/camelcase': 0,
        '@typescript-eslint/no-unused-vars': 1,
        '@typescript-eslint/no-use-before-define': 0,
        '@typescript-eslint/ban-ts-comment': 0,
        '@typescript-eslint/ban-ts-ignore': 0,
        '@typescript-eslint/explicit-member-accessibility': 0,
        '@typescript-eslint/member-delimiter-style': 0,
        '@typescript-eslint/no-empty-function': 0,
        '@typescript-eslint/no-explicit-any': 0,
        '@typescript-eslint/no-non-null-assertion': 'off',
        'react-hooks/rules-of-hooks': 'error',
        'react-hooks/exhaustive-deps': 'warn'
    },
    settings: {
        react: {
            version: 'detect'
        }
    }
}