Skip to content
Open
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
48 changes: 0 additions & 48 deletions .eslintrc.json

This file was deleted.

134 changes: 134 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import js from '@eslint/js';
import eslintReact from '@eslint-react/eslint-plugin';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
import importXPlugin from 'eslint-plugin-import-x';
import simpleImportSort from 'eslint-plugin-simple-import-sort';

const reactFiles = ['src/**/*.{js,jsx}', 'server/**/*.js'];

export default [
{ ignores: ['build/', 'dist/', 'node_modules/', 'coverage/'] },

// @eslint-react (replaces eslint-plugin-react; supports ESLint 10)
{ files: reactFiles, ...eslintReact.configs['recommended-typescript'] },
{ files: reactFiles, ...eslintReact.configs['disable-conflict-eslint-plugin-react-hooks'] },
{
files: reactFiles,
rules: {
'@eslint-react/exhaustive-deps': 'off',
'@eslint-react/set-state-in-effect': 'off',
'@eslint-react/naming-convention-ref-name': 'off',
'@eslint-react/use-state': 'off',
'@eslint-react/no-context-provider': 'off',
'@eslint-react/web-api-no-leaked-timeout': 'off',
'@eslint-react/rules-of-hooks': 'off',
'@eslint-react/no-use-context': 'off',
'@eslint-react/purity': 'off',
'@eslint-react/no-forward-ref': 'off',
},
},

// Shared plugins/rules for src + server
{
files: reactFiles,
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
plugins: {
'react-hooks': reactHooksPlugin,
'jsx-a11y': jsxA11yPlugin,
'import-x': importXPlugin,
'simple-import-sort': simpleImportSort,
},
rules: {
...js.configs.recommended.rules,
...reactHooksPlugin.configs.flat['recommended-latest'].rules,
...jsxA11yPlugin.flatConfigs.recommended.rules,
...importXPlugin.flatConfigs.recommended.rules,
'array-bracket-spacing': ['warn', 'never'],
'max-len': ['warn', { code: 120 }],
'no-plusplus': 'error',
'no-undef': 'warn',
'no-unused-vars': 'warn',
'no-useless-assignment': 'off',
'jsx-a11y/no-autofocus': 'off',
'object-curly-spacing': ['warn', 'always'],
'import-x/named': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// eslint-plugin-react-hooks v7 recommended-latest adds rules that
// require a wider codebase pass. Disable here to keep the plugin
// bump scoped; adopt them in follow-up work.
'react-hooks/set-state-in-effect': 'off',
'react-hooks/refs': 'off',
'react-hooks/immutability': 'off',
'react-hooks/error-boundaries': 'off',
},
},

// src — browser globals
{
files: ['src/**/*.{js,jsx}'],
languageOptions: {
globals: {
...globals.browser,
globalThis: 'readonly',
},
},
},

// server — Node.js globals + build-time injected constants
{
files: ['server/**/*.js'],
languageOptions: {
globals: {
...globals.node,
GIT_TAG: 'readonly',
GIT_COMMIT: 'readonly',
},
},
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.

// test files — vitest globals
{
files: [
'src/**/*.{test,spec}.{js,jsx}',
'src/**/__tests__/**/*.{js,jsx}',
],
languageOptions: {
globals: {
...globals.jest,
vi: 'readonly',
},
},
},

// Files using CommonJS require() — SSR-safe leaflet loading + test bootstrap
{
files: ['src/views/MapView/**/*.js', 'src/setupTests.js'],
languageOptions: {
globals: {
require: 'readonly',
},
},
},

// serviceWorker — dead CRA scaffolding not currently imported anywhere;
// process.env is the CRA-era pattern preserved for potential reactivation.
{
files: ['src/serviceWorker.js'],
languageOptions: {
globals: {
process: 'readonly',
},
},
},
];
25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "servicemap-ui",
"version": "2.16.0",
"private": true,
"packageManager": "pnpm@11.1.3",
"packageManager": "pnpm@11.9.0",
"engines": {
"node": ">=22.13.1",
"pnpm": ">=11.1.3"
"pnpm": ">=11.9.0"
},
"dependencies": {
"@emotion/css": "^11.11.2",
Expand All @@ -17,8 +17,8 @@
"@mui/material": "^6.1.4",
"@mui/styles": "^6.1.4",
"@mui/utils": "^6.1.4",
"@sentry/node": "^10.27.0",
"@sentry/react": "^10.20.0",
"@sentry/node": "^10.62.0",
"@sentry/react": "^10.62.0",
"@turf/area": "^6.5.0",
"@turf/boolean-equal": "^6.5.0",
"@turf/boolean-point-in-polygon": "^6.5.0",
Expand All @@ -32,6 +32,7 @@
"compression": "^1.8.1",
"core-js": "^3.25.1",
"d3": "^7.9.0",
"dompurify": "^3.4.11",
"dotenv": "^16.6.1",
"esrun": "^3.2.30",
"express": "^4.21.2",
Expand Down Expand Up @@ -78,8 +79,8 @@
"dev": "pnpm update-runtime-env && pnpm dev:client:watch & pnpm dev:server:watch & sleep 5 && nodemon dist --watch dist",
"dev:client:watch": "vite build --watch",
"dev:server:watch": "BUILD_TARGET=server vite build --ssr --watch",
"lint": "eslint src/ server/ --ext .js,.jsx && prettier src/ server/ --check",
"lint:fix": "eslint src/ server/ --ext .js,.jsx --fix && prettier src/ server/ --write",
"lint": "eslint src/ server/ && prettier src/ server/ --check",
"lint:fix": "eslint src/ server/ --fix && prettier src/ server/ --write",
"preview": "vite preview",
"start": "node dist",
"test": "NODE_ENV=test pnpm update-runtime-env && vitest --config vitest.config.js",
Expand All @@ -105,18 +106,22 @@
"@commitlint/cli": "^20.1.0",
"@commitlint/config-conventional": "^20.0.0",
"@emotion/server": "^11.10.0",
"@eslint-react/eslint-plugin": "^5.10.0",
"@eslint/js": "^10.0.0",
"@playwright/test": "^1.60.0",
"@sentry/vite-plugin": "^4.6.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@typescript-eslint/parser": "^8.0.0",
"axe-html-reporter": "^2.2.11",
"eslint": "^8.43.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint": "^10.0.0",
"eslint-plugin-import-x": "^4.0.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react-hooks": "^7.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-vitest-globals": "^1.6.1",
"globals": "^16.0.0",
Comment thread
mikkojamG marked this conversation as resolved.
"identity-obj-proxy": "^3.0.0",
"jsdom": "^27.0.0",
"nodemon": "^2.0.20",
Expand Down
Loading
Loading