Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ repos:
hooks:
- id: prettier
args: ['--config', 'frontend/.prettierrc.json', './frontend']
- repo: local
hooks:
- id: pip-audit
name: pip-audit
entry: bash -c 'cd backend && if [ -f .venv/bin/python ]; then PIPAPI_PYTHON_LOCATION=$(pwd)/.venv/bin/python pip-audit; else pip-audit; fi'
language: system
pass_filenames: false
files: '^backend/requirements.*\.txt$'
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ignore-secrets: ## Ignore secrets
detect-vulnerabilities: ##Detect the vulnerabilities
bandit -qr api/api sdk/rapid


python-setup: ## Setup python to run the sdk and api
pyenv install --skip-existing $(PYTHON_VERSION)
pyenv local $(PYTHON_VERSION)
Expand Down Expand Up @@ -83,6 +84,14 @@ backend/setup: backend/venv backend/reqs
backend/format: ## Run the api code format with black
@cd backend/; . .venv/bin/activate; black api test rapid

backend/audit-dependencies: ## Audit Python dependencies for known vulnerabilities
@cd backend; \
if [ -f .venv/bin/activate ]; then \
. .venv/bin/activate; PIPAPI_PYTHON_LOCATION=$$(pwd)/.venv/bin/python pip-audit; \
else \
pip-audit; \
fi

##
##----- API -----
##
Expand Down
1 change: 1 addition & 0 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ pytest
requests-mock
setuptools
twine
pip-audit

-r ./requirements.txt
41 changes: 0 additions & 41 deletions frontend/.eslintrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import ThemeProvider from '../src/components/ThemeProvider'
import { setConfig } from 'next/config'
import { publicRuntimeConfig } from '../next.config'
setConfig({ publicRuntimeConfig })

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand Down
58 changes: 58 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import nextConfig from 'eslint-config-next';
import prettierConfig from 'eslint-config-prettier';
import testingLibraryPlugin from 'eslint-plugin-testing-library';
import jestDomPlugin from 'eslint-plugin-jest-dom';
import tseslint from 'typescript-eslint';

const config = [
{
ignores: ['node_modules/**', 'build/**', 'public/**', '.next/**'],
},
...nextConfig,
prettierConfig,
{
rules: {
'prefer-const': 0,
'react/jsx-uses-vars': 1,
'react/jsx-uses-react': 1,
'strict': 0,
'no-console': ['warn', { allow: ['error', 'info'] }],
'no-unused-vars': 'off',
'no-debugger': 'off',
'no-extra-semi': 0,
'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
'@typescript-eslint': tseslint.plugin,
},
rules: {
'@typescript-eslint/no-extra-semi': 0,
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{ args: 'all', argsIgnorePattern: '^_' },
],
},
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
plugins: {
'testing-library': testingLibraryPlugin,
'jest-dom': jestDomPlugin,
},
rules: {
...testingLibraryPlugin.configs.react.rules,
...jestDomPlugin.configs.recommended.rules,
'react/display-name': 0,
'testing-library/no-container': 'warn',
'testing-library/no-node-access': 'warn',
},
},
];

export default config;
1 change: 0 additions & 1 deletion frontend/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// jest.config.js
const nextJest = require('next/jest')

Expand Down
11 changes: 4 additions & 7 deletions frontend/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-var-requires */
// Optional: configure or set up a testing framework before each test.
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`

Expand All @@ -13,13 +12,11 @@ global.TextEncoder = TextEncoder

require('jest-fetch-mock').enableMocks()

jest.mock('next/config', () => () => ({
publicRuntimeConfig: {
apiUrl: 'http://myapp'
}
}))

jest.mock('next/router', () => ({
...jest.requireActual('next/router'),
useRouter: jest.fn(() => ({ locale: 'en', push: jest.fn(), replace: jest.fn() }))
}))

jest.mock('@tanstack/react-query-devtools', () => ({
ReactQueryDevtools: () => null
}))
52 changes: 50 additions & 2 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,61 @@
const path = require('path')
const apiProx = process.env.NEXT_PUBLIC_API_URL_PROXY || null
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
trailingSlash: false,
swcMinify: true,
turbopack: {
rules: {
'*.svg': {
loaders: [{
loader: '@svgr/webpack',
options: {
icon: true,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
{
name: 'removeDimensions',
},
],
},
},
}],
as: '*.js',
},
},
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: [{ loader: '@svgr/webpack', options: { icon: true } }]
use: [{
loader: '@svgr/webpack',
options: {
icon: true,
svgoConfig: {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
},
},
},
{
name: 'removeDimensions',
},
],
},
},
}]
})
return config
},
Expand Down
Loading
Loading