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
80 changes: 0 additions & 80 deletions .github/workflows/frontend_lint_and_test.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/lint_frontend_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Frontend

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint-frontend-package:
uses: equinor/armada/.github/workflows/lint_frontend_package.yml@main
permissions:
contents: read
with:
working-directory: frontend
run-prettier: true
run-eslint: true
run-build: true
run-unused-exports: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Frontend
frontend/node_modules/
frontend/dist/
frontend/out/

# Editors
.vscode
Expand Down
2 changes: 1 addition & 1 deletion frontend/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
npm start
npm run dev

build:
npm run build
Expand Down
2 changes: 1 addition & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ npm ci
To start the app, run the following command in the root folder:

```
npm start
npm run dev
```

This command runs the app in development mode. Open [http://localhost:3001/robotics-frontend](http://localhost:3001/robotics-frontend) to view it in the browser.
Expand Down
2 changes: 1 addition & 1 deletion frontend/best_practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ npx prettier --write [path to source]

We also avoid any warnings or errors from ESLint before we merge in any code. These warnings appear
when compiling the code using
npm start
npm run dev
but can also be run with
npx eslint [path to src]

Expand Down
48 changes: 30 additions & 18 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import pluginReact from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2024,
globals: globals.browser,
},
plugins: {
react: pluginReact,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...pluginReact.configs.flat.recommended.rules,

/** @type {import('eslint').Linter.Config[]} */
export default [
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
"react/react-in-jsx-scope": "off",
"react/display-name": "off",
"@typescript-eslint/no-explicit-any": "off",
'react/react-in-jsx-scope': 'off',
'react/display-name': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
}
}
];
)
4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
To begin the development, run `npm run dev`.
To create a production bundle, use `npm run build`.
--></body>
</html>
50 changes: 50 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
"vite-plugin-svgr": "^4.5.0"
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"serve": "vite preview",
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"test": "vitest",
"lint": "eslint src",
"prettier_check": "npx prettier --check src"
},
"browserslist": {
Expand All @@ -60,6 +61,8 @@
"@types/styled-components": "^5.1.36",
"eslint": "^9.39.3",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^6.0.0",
"eslint-plugin-react-refresh": "^0.4.26",
"globals": "^17.4.0",
"jsdom": "^28.1.0",
"ts-unused-exports": "^11.0.1",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/Contexts/InspectionsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const InspectionsProvider: FC<Props> = ({ children }) => {
}, [registerEvent, connectionReady])

const fetchImageData = (inspectionId: string): IImageData => {
// eslint-disable-next-line react-hooks/rules-of-hooks -- pre-existing design issue, tracked in #2698
const result = useQuery({
queryKey: ['fetchInspectionData', inspectionId],
queryFn: async () => {
Expand All @@ -77,6 +78,7 @@ export const InspectionsProvider: FC<Props> = ({ children }) => {
}

const fetchAnalysisData = (inspectionId: string): IImageData => {
// eslint-disable-next-line react-hooks/rules-of-hooks -- pre-existing design issue, tracked in #2698
const result = useQuery({
queryKey: ['fetchAnalysisData', inspectionId],
queryFn: async () => {
Expand All @@ -91,6 +93,7 @@ export const InspectionsProvider: FC<Props> = ({ children }) => {
}

const fetchValueData = (inspectionId: string): IValueData => {
// eslint-disable-next-line react-hooks/rules-of-hooks -- pre-existing design issue, tracked in #2698
const result = useQuery({
queryKey: ['fetchValueData', inspectionId],
queryFn: async () => {
Expand Down
Loading