diff --git a/.eslintrc.json b/.eslintrc.json index b6b000d44..74d1e8f86 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,137 +1,54 @@ { - "plugins": [ - "import", - "react", - "@typescript-eslint", - "prettier", - "sonarjs", - "jsx-a11y" - ], - "extends": ["plugin:@typescript-eslint/recommended", "prettier"], - "rules": { - "react/display-name": "error", - "react/no-unescaped-entities": "off", - "import/no-anonymous-default-export": "error", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-explicit-any": "error", - "@typescript-eslint/no-non-null-assertion": "off", - // add new line above comment - "no-duplicate-case": "error", - "jsx-a11y/interactive-supports-focus": [ - "error", - { - "tabbable": [ - "button", - "checkbox", - "link", - "searchbox", - "spinbutton", - "switch", - "textbox" - ] - } -], - "jsx-a11y/role-has-required-aria-props": "warn", - "jsx-a11y/alt-text": [ - 2, - { - "elements": ["img"], - "img": ["Image"] - } - ], - "jsx-a11y/no-static-element-interactions": [ - "error", - { - "handlers": [ - "onClick", - "onMouseDown", - "onMouseUp", - "onKeyPress", - "onKeyDown", - "onKeyUp" - ], - "allowExpressionValues": true - } - ], - "jsx-a11y/control-has-associated-label": [ 1, { - "labelAttributes": ["label"], - "controlComponents": ["CustomButton"], - "ignoreElements": [ - "audio", - "canvas", - "embed", - "input", - "textarea", - "tr", - "video" - ], - "ignoreRoles": [ - "grid", - "listbox", - "menu", - "menubar", - "radiogroup", - "row", - "tablist", - "toolbar", - "tree", - "treegrid" - ], - "depth": 3 - }], - "lines-around-comment": [ - "error", - { - "beforeLineComment": true, - "beforeBlockComment": true, - "allowBlockStart": true, - "allowClassStart": true, - "allowObjectStart": true, - "allowArrayStart": true - } - ], - // add new line above return - "newline-before-return": "error", - // add new line below import - "import/newline-after-import": [ - "error", - { - "count": 1 - } - ], - "@typescript-eslint/ban-types": [ - "error", - { - "extendDefaults": true, - "types": { - "{}": false - } - } - ], - "no-console": ["error", { "allow": ["warn", "error", "info"] }], - "indent": ["error", "tab"], - // SonarJS rules - "sonarjs/no-identical-expressions": "error", - "no-useless-catch": "error" - }, - "settings": { - "import/parsers": { - "@typescript-eslint/parser": [".ts", ".tsx"] + "plugins": ["import", "react", "@typescript-eslint", "prettier", "jsx-a11y"], + "extends": ["plugin:@typescript-eslint/recommended", "prettier", "plugin:jsx-a11y/recommended"], + "rules": { + "react/display-name": "error", + "react/no-unescaped-entities": "off", + "import/no-anonymous-default-export": "error", + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-non-null-assertion": "off", + "no-duplicate-case": "error", + "newline-before-return": "error", + "import/newline-after-import": [ + "error", + { + "count": 1 + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true, + "types": { + "{}": false + } + } + ], + "no-console": ["error", { "allow": ["warn", "error", "info"] }], + "indent": ["error", "tab"] + }, + "settings": { + "react": { + "version": "18.x" }, - "import/resolver": { - "typescript": { - "alwaysTryTypes": true, - "project": ["./tsconfig.json"] - } - } - }, - "overrides": [ - { - "files": ["src/iconify-bundle/*"], - "rules": { - "@typescript-eslint/no-var-requires": "off" - } - } - ] + "import/parsers": { + "@typescript-eslint/parser": [".ts", ".tsx"] + }, + "import/resolver": { + "typescript": { + "alwaysTryTypes": true, + "project": ["./tsconfig.json"] + } + } + }, + "overrides": [ + { + "files": ["src/iconify-bundle/*"], + "rules": { + "@typescript-eslint/no-var-requires": "off" + } + } + ] } diff --git a/.github/workflows/PR_Validation.yml b/.github/workflows/PR_Validation.yml index afced5373..3dcccfb65 100644 --- a/.github/workflows/PR_Validation.yml +++ b/.github/workflows/PR_Validation.yml @@ -5,6 +5,7 @@ on: branches: - dev - main + - dev5.4 jobs: basic-checks: @@ -24,12 +25,6 @@ jobs: - name: Install dependencies run: npm install - # - name: Execute Unit tests - # run: | - # npm ci - # npm install @rollup/rollup-linux-x64-gnu - # npm run test:unit - - name: Run ESLint run: npm run lint diff --git a/README.md b/README.md index eceef3d4d..68a09580a 100644 --- a/README.md +++ b/README.md @@ -64,26 +64,26 @@ Delib-5 uses a technological stack consisting of React-Redux-PWA (built with Vit 4. **Set up Firebase configuration** - In the Firebase console, create a new project named "delib-5" and copy the project ID. - - In the `.firebaserc` file, replace the project ID with the one you just created. + - Set up the `.firebaserc` file according to template in "firebase-config-files.txt", replace the project ID with the one you just created. - Run `firebase use ` to select the new project. -5. **Create `configKey.ts` file** + - Set up your `firebase.json` file by copying the template from "firebase-config-files.txt". You do not have to adjust any attributes. - Under `src/functions/db/`, create a new file named `configKey.ts` and add the following code, replacing the placeholders with your actual Firebase project configuration: +5. **Create `.env` files** - ```typescript - export const keys = { - apiKey: "your-api-key", - authDomain: "your-auth-domain", - databaseURL: "your-database-url", - projectId: "your-project-id", - storageBucket: "your-storage-bucket", - messagingSenderId: "your-messaging-sender-id", - appId: "your-app-id", - measurementId: "your-measurement-id" - } + In the project root create two files, `.env.development` & `.env.production` (Only if specified by project leader). replacing the placeholders with your actual Firebase project configuration: - export const vapidKey = 'your-vapid-key'; + ```env + VITE_FIREBASE_API_KEY=__YOUR_CONFIG__ + VITE_FIREBASE_AUTH_DOMAIN=__YOUR_CONFIG__ + VITE_FIREBASE_DATABASE_URL=__YOUR_CONFIG__ + VITE_FIREBASE_PROJECT_ID=__YOUR_CONFIG__ + VITE_FIREBASE_STORAGE_BUCKET=__YOUR_CONFIG__ + VITE_FIREBASE_MESSAGING_SENDER_ID=__YOUR_CONFIG__ + VITE_FIREBASE_APP_ID=__YOUR_CONFIG__ + VITE_FIREBASE_MEASUREMENT_ID=__YOUR_CONFIG__ + + VITE_FIREBASE_VAPID_KEY=__YOUR_CONFIG__ ``` Note: This file is not uploaded to GitHub, and you'll need to create it yourself. diff --git a/cypress.config.ts b/cypress.config.ts deleted file mode 100644 index 0100eefec..000000000 --- a/cypress.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { defineConfig } from "cypress"; - -export default defineConfig({ - projectId: 'wchvep', - e2e: { - baseUrl: "https://delib-v3-dev.web.app", - - // baseUrl: "http://localhost:5173", - - setupNodeEvents(on, config) { - - // implement node event listeners here - on('before:browser:launch', (browser, launchOptions) => { - if (browser.name === 'chrome') { - launchOptions.args.push('--disable-site-isolation-trials'); - - return launchOptions; - } - }); - - on('task', { - log(message) { - console.log(message); - - return null; - }, - }); - - return config; - }, - }, -}); diff --git a/cypress/1-getting-started/todo.cy.js b/cypress/1-getting-started/todo.cy.js deleted file mode 100644 index 4768ff923..000000000 --- a/cypress/1-getting-started/todo.cy.js +++ /dev/null @@ -1,143 +0,0 @@ -/// - -// Welcome to Cypress! -// -// This spec file contains a variety of sample tests -// for a todo list app that are designed to demonstrate -// the power of writing tests in Cypress. -// -// To learn more about how Cypress works and -// what makes it such an awesome testing tool, -// please read our getting started guide: -// https://on.cypress.io/introduction-to-cypress - -describe('example to-do app', () => { - beforeEach(() => { - // Cypress starts out with a blank slate for each test - // so we must tell it to visit our website with the `cy.visit()` command. - // Since we want to visit the same URL at the start of all our tests, - // we include it in our beforeEach function so that it runs before each test - cy.visit('https://example.cypress.io/todo') - }) - - it('displays two todo items by default', () => { - // We use the `cy.get()` command to get all elements that match the selector. - // Then, we use `should` to assert that there are two matched items, - // which are the two default items. - cy.get('.todo-list li').should('have.length', 2) - - // We can go even further and check that the default todos each contain - // the correct text. We use the `first` and `last` functions - // to get just the first and last matched elements individually, - // and then perform an assertion with `should`. - cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') - cy.get('.todo-list li').last().should('have.text', 'Walk the dog') - }) - - it('can add new todo items', () => { - // We'll store our item text in a variable so we can reuse it - const newItem = 'Feed the cat' - - // Let's get the input element and use the `type` command to - // input our new list item. After typing the content of our item, - // we need to type the enter key as well in order to submit the input. - // This input has a data-test attribute so we'll use that to select the - // element in accordance with best practices: - // https://on.cypress.io/selecting-elements - cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) - - // Now that we've typed our new item, let's check that it actually was added to the list. - // Since it's the newest item, it should exist as the last element in the list. - // In addition, with the two default items, we should have a total of 3 elements in the list. - // Since assertions yield the element that was asserted on, - // we can chain both of these assertions together into a single statement. - cy.get('.todo-list li') - .should('have.length', 3) - .last() - .should('have.text', newItem) - }) - - it('can check off an item as completed', () => { - // In addition to using the `get` command to get an element by selector, - // we can also use the `contains` command to get an element by its contents. - // However, this will yield the