Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Update and refactor various parts of the frontend #67

Merged
merged 2 commits into from
Jan 22, 2025
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,6 @@ node_modules/

# Mac stuff
.DS_Store

# IntelliJ project files
.idea/
35 changes: 11 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ repos:
additional_dependencies:
- docformatter[tomli]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.1
rev: v0.9.2
hooks:
- id: ruff
args: [--extend-ignore=FIX, --fix]
- id: ruff-format
- repo: https://github.com/rhysd/actionlint
rev: v1.7.6
rev: v1.7.7
hooks:
- id: actionlint
- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down Expand Up @@ -136,30 +136,17 @@ repos:
hooks:
- id: prettier
name: prettier
entry: prettier --write
language: node
language: system
entry: sh -c 'make frontend/node_modules && ./frontend/node_modules/.bin/prettier --write "$@"' --
require_serial: true
types_or: [javascript, jsx, ts, css, html, markdown]
additional_dependencies:
- '[email protected]'
- '[email protected]'
- '[email protected]'
- '[email protected]'
- '[email protected]'
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.18.0
- repo: local
hooks:
- id: eslint
additional_dependencies:
- 'eslint@^8.57.0'
- 'eslint-config-prettier@^9.1.0'
- 'eslint-plugin-import@^2.29.1'
- 'eslint-plugin-unused-imports@^3.1.0'
- 'eslint-plugin-deprecation@^2.0.0'
- 'eslint-plugin-tailwindcss@^3.15.1'
- 'eslint-plugin-storybook@^0.8.0'
- 'eslint-plugin-react@^7.34.1'
- 'eslint-plugin-react-hooks@^4.6.2'
- 'eslint-plugin-react-refresh@^0.4.5'
args: ['--fix']
name: eslint
language: system
entry: sh -c 'make frontend/node_modules && ./frontend/node_modules/.bin/eslint "$@"' --
require_serial: true
args: ['--fix', '--config', 'frontend/eslint.config.js']
types: []
files: '^frontend/.*\.(js|jsx)$'
31 changes: 0 additions & 31 deletions frontend/.eslintrc.cjs

This file was deleted.

File renamed without changes.
10 changes: 1 addition & 9 deletions frontend/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ const config = {
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
{
name: '@storybook/addon-postcss',
options: {
postcssLoaderOptions: {
implementation: require('postcss')
}
}
}
'@storybook/addon-interactions'
],
framework: {
name: '@storybook/react-vite',
Expand Down
43 changes: 43 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright DB InfraGO AG and contributors
* SPDX-License-Identifier: Apache-2.0
*/

import globals from 'globals';
import pluginJs from '@eslint/js';
import pluginReact from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import eslintConfigPrettier from 'eslint-config-prettier';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ['**/*.{js,mjs,cjs,jsx}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat['jsx-runtime'],
{
rules: {
'react/jsx-no-target-blank': 'off',
'react/prop-types': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true }
],
'max-len': [
'error',
{ code: 100, ignoreUrls: true, ignoreStrings: true }
]
}
},
reactRefresh.configs.recommended,
// TODO: Simplify when https://github.com/facebook/react/issues/28313 is released
{
plugins: {
'react-hooks': reactHooks
},
rules: { ...reactHooks.configs.recommended.rules }
},
eslintConfigPrettier
];
Loading
Loading