Commit c321147
authored
HUL-48 | Adding new icons for sledging qualities (And migration to TypeScript) (#50)
* feat: add TypeScript support with incremental migration capability
- Install TypeScript and essential type definitions (@types/react, @types/redux, etc.)
- Add tsconfig.json with React/Redux configuration and path mapping
- Update webpack config to handle .ts/.tsx files with ts-loader
- Configure ESLint with TypeScript parser and plugins for .ts/.tsx files
- Update Jest to support TypeScript testing with babel-jest
- Add TypeScript preset to Babel configuration
- Add type-check script to package.json for type validation
- Update README.md with TypeScript migration guidelines
- Maintain backward compatibility with existing .js/.jsx files
* refactor: migrate Redux reducers and tests to TypeScript
- Convert reducers/index.js to TypeScript with proper Redux Reducer types
- Migrate test file from JS to TS with type-safe action definitions
* feat: add centralized test utilities
- Create test/testUtils.tsx with renderWithProviders helper
- Move shared test utilities from inline definitions to dedicated module
- Update Main.test.jsx to use centralized test utilities
- Provide reusable Redux store and React Router setup for component testing
* refactor: convert NotFound component to TypeScript
- Convert NotFound.js to NotFound.tsx with proper TypeScript syntax
- Modernize class component to functional component
* fix: add TypeScript support to webpack configurations
- Add ts-loader with transpileOnly option to cfg/dev.js for development builds
- Add ts-loader with transpileOnly option to cfg/dist.js for production builds
- Enables proper compilation of .ts and .tsx files in all webpack environments
* refactor: convert ObservationItem to TypeScript with comprehensive test suite
- Convert ObservationItem.js to ObservationItem.tsx with full TypeScript typing
- Add comprehensive unit tests
- Add UnitObservation interface in types.ts for proper typing
- Use moment.js with Finnish locale for authentic date formatting
* refactor: convert utils to TypeScript with comprehensive test suite
- Convert utils.js to utils.ts with proper TypeScript typing
- Add comprehensive unit tests
* refactor: migrate UnitStatusSummary from JS to TypeScript
- Convert UnitStatusSummary.js to UnitStatusSummary.tsx with proper TypeScript types
- Add comprehensive test suite for UnitStatusSummary component
- Update UnitMassEdit to use ObservationItem instead of legacy Observation component
* refactor: convert Redux actions to TypeScript with comprehensive testing
- Convert actions/index.js to TypeScript with proper typing
- Create dedicated types.ts files for action-specific interfaces
- Move ActionTypes constants to centralized constants.ts
- Add comprehensive unit tests for all action creators
* refactor: convert UnitDescriptiveStatusForm to TypeScript with comprehensive test suite
- Migrate UnitDescriptiveStatusForm from JS class component to TS functional component
- Add comprehensive unit tests
- Fix unitId parameter type from string to number in enqueueObservation action
- Update action type definitions to use consistent number types
- Improve component logic with optional chaining and cleaner conditionals
* refactor: convert municipal-services-client.js to TypeScript
Rename municipal-services-client.js → municipalServicesClient.ts with full
TypeScript conversion including proper type definitions, interfaces, and
function overloads.
Additional changes:
- Consolidate type system by moving shared types to src/types.ts
- Add comprehensive unit test suite
- Update all import paths throughout codebase
- Fix type inconsistencies in UnitObservation.value handling
- Add API_URL environment variable setup for tests
* refactor: convert UnitDetails component to TypeScript
- Convert UnitDetails.js to UnitDetails.tsx with full type safety
- Add proper TypeScript interfaces for component props
- Export ObservableProperty and ObservablePropertyPanel components with types
- Fix Redux selector performance issues with useMemo hooks
- Create comprehensive unit tests
* refactor: convert UnitList component to TypeScript
- Convert UnitList.js to UnitList.tsx with full TypeScript typing
- Replace withRouter HOC with useParams and useSelector hooks
- Optimize Redux selectors with useMemo to prevent unnecessary re-renders
- Add comprehensive unit tests
- Update component imports in DashBoard.js and UpdateQueue.js
* feat: migrate to ESLint flat config and fix linting errors
- Migrate from deprecated .eslintrc to eslint.config.mjs flat config
- Add comprehensive TypeScript ESLint support with @typescript-eslint rules
- Configure proper indentation rules with SwitchCase support
- Add Jest/testing environment globals for test files
- Fix TypeScript type errors in test files and components
* refactor: improve timezone handling and comments in ObservationItem tests
* feat: add missing 'open' and 'weak' entries to ICONS constant
- Add 'open': 'icon-smile-o' and 'weak': 'icon-meh-o' to ICONS mapping
- Update test to include the new icon entries
* fix: fix SonarQube errors
* refactor: convert UnitHistory to TypeScript with modern hooks
- Convert UnitHistory.js to UnitHistory.tsx with full TypeScript support
- Replace withRouter HOC with useParams hook from react-router-dom
- Replace connect HOC with useSelector and useDispatch hooks from react-redux
- Convert class component to functional component with hooks
- Add comprehensive unit tests
- Add renderWithRoute helper function to testUtils for route-based testing
* refactor: convert UpdateQueue to TypeScript with modern React hooks
- Convert UpdateQueue.js to UpdateQueue.tsx with full TypeScript support
- Replace connect HOC with useSelector/useDispatch hooks
- Add useMemo optimization to prevent unnecessary re-renders
- Add comprehensive unit tests
* refactor: convert UpdateConfirmation component from JS to TypeScript
- Convert class component to functional component using React hooks
- Replace withRouter HOC and connect HOC with useParams, useSelector, and useDispatch hooks
- Add comprehensive TypeScript typing for props, state, and function parameters
- Implement useMemo optimization for selector performance to prevent unnecessary rerenders
- Create extensive test suite covering all component functionality and edge cases
- Fix routing warnings in tests by adding missing route definitions
* refactor: convert DeleteConfirmation component to TypeScript
- Convert DeleteConfirmation.js to TypeScript functional component
- Replace class component with React hooks (useParams, useSelector, useDispatch, useMemo)
- Extract ConfirmButton and TextualDescription as typed sub-components
- Add comprehensive test suite
* refactor: modernize GroupList component to TypeScript
- Convert GroupList from JavaScript to TypeScript with proper types
- Replace connect() with modern useSelector hook for Redux integration
- Extract GroupListElement as typed functional sub-component
- Add comprehensive unit test suite
* feat: convert DashBoard component to TypeScript
- Convert DashBoard.js to DashBoard.tsx with proper TypeScript types
- Add comprehensive test suite for DashBoard component
- Improve type safety across actions and reducers
- Add jest-dom type declarations for better testing support
* refactor: fix TypeScript compilation errors and modernize ESLint config
- Replace manual global type declarations with globals package in ESLint config
- Add globals package dependency to package.json
- Restructure Redux action types with BaseAction interface for better compatibility
- Fix function overload typing in municipalServicesClient.ts
- Convert LoginScreen from JS to TypeScript with proper typing
- Update Jest DOM types to avoid conflicts with @testing-library/jest-dom
- Fix test mock data structures to match expected interfaces
- Add comprehensive unit tests for LoginScreen component
- Fix UserLocation type structure in action tests
- Enable stricter TypeScript checking with skipLibCheck: false
- Update test utilities with proper interface definitions
* refactor: organize test files by module structure
- Move component tests to src/components/__tests__/
- Move library tests to src/lib/__tests__/
* refactor: convert Main component to TypeScript
- Convert Main.js to Main.tsx with full TypeScript support
- Add proper TypeScript interfaces for AuthState and RootState
- Convert class-based component to functional component with React hooks
- Replace connect HOC with useSelector and useDispatch hooks
- Replace withRouter HOC with useNavigate hook
- Fix authentication logic to prevent data fetching when unauthenticated
- Add comprehensive test coverage
* refactor: convert UnitMassEditPropertySelect to TypeScript with comprehensive testing
- Convert UnitMassEditPropertySelect.js to TypeScript (.tsx)
- Replace class component with functional component using React hooks
- Replace connect HOC and withRouter HOC with useSelector and useParams hooks
- Add loading state handling to show proper loading indicator when data is fetching
- Add null-safety checks for observableProperties to prevent runtime errors
- Create comprehensive unit tests
- Add React Router future flags to test utilities to resolve v7 deprecation warnings
* refactor: convert UnitMassEdit to TypeScript and modernize test infrastructure
- Convert UnitMassEdit component to TypeScript with enhanced type safety
- Add proper interfaces for FormValues and AllowedValueWithProperty
- Improve function typing and maintain redux-actions compatibility
- Preserve all existing functionality with better type checking
- Modernize testing library patterns across all test files
- Replace fireEvent with userEvent for more realistic user interactions
- Add @testing-library/user-event v14.6.1 dependency
- Update 6 test files: DeleteConfirmation, LoginScreen, UnitDescriptiveStatusForm,
UnitMassEdit, UpdateConfirmation, UpdateQueue
- Convert to async/await patterns with userEvent.setup()
- Clean up legacy code
- Remove unused withRouter HOC from hooks/index.js
- Minor formatting improvements in testUtils.tsx
* refactor: exclude types.ts files from coverage collection
* refactor: consolidate action types and service groups into a single TypeScript file
* refactor: exclude mock_groups.js from coverage collection
* refactor: convert time utilities to TypeScript
- Convert src/util/time.js to TypeScript with proper type annotations
- Add Moment type imports and function parameter/return types
- Improve type safety for hoursToMinutes function with string|number input
- Add comprehensive unit tests for time utilities
* refactor: convert geolocation module to TypeScript
- Convert src/lib/geolocation.js to TypeScript with proper types and interfaces
- Add GeolocationCallback type and StagePositionOptions interface
- Fix module-level DISABLED constant to runtime check (isGeolocationDisabled)
- Add comprehensive unit tests
* refactor: convert queueHandler to TypeScript with comprehensive tests
- Convert src/actions/queueHandler.js to TypeScript
- Add comprehensive unit tests
* refactor: update Finnish labels in UnitMassEdit tests
* refactor: improve code quality with modern patterns and optimizations
- Replace _.filter() with _.find() for single item lookup in UnitMassEdit
- Use stable property keys instead of array indices in component mapping
- Convert nested if-else to else-if for cleaner control flow
- Implement nullish coalescing operator (??=) for more concise assignments
- Add proper error handling for geolocation with test environment detection
- Replace parseFloat with Number.parseFloat for consistency
* feat: enable type check in GitHub actions1 parent 6d7550a commit c321147
95 files changed
Lines changed: 12452 additions & 6295 deletions
File tree
- .github/workflows
- cfg
- src
- actions
- __tests__
- components
- __tests__
- constants
- hooks
- lib
- __tests__
- reducers
- __tests__
- util
- __tests__
- test
- __mocks__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
22 | 45 | | |
23 | 46 | | |
24 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
38 | 59 | | |
39 | 60 | | |
40 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
51 | 67 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
48 | 29 | | |
49 | 30 | | |
50 | 31 | | |
| 32 | + | |
51 | 33 | | |
| 34 | + | |
| 35 | + | |
52 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
53 | 40 | | |
54 | 41 | | |
55 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
56 | 83 | | |
57 | 84 | | |
58 | 85 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
0 commit comments