Skip to content

Commit 4664d33

Browse files
committed
fix lint
1 parent dfeb0f5 commit 4664d33

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

apps/demos/Demos/Scheduler/Templates/Angular/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export class AppComponent {
8080
};
8181
}
8282

83-
getMovieById = (id: number | undefined): MovieData | undefined => id
84-
? query(this.moviesData).filter(['id', '=', id]).toArray()[0]
83+
getMovieById = (id: number | undefined): MovieData | null => id
84+
? query(this.moviesData).filter(['id', '=', id]).toArray()[0] ?? null
8585
: null;
8686

8787
getEditorStylingMode = (): 'filled' | 'outlined' => {
@@ -139,7 +139,7 @@ export class AppComponent {
139139
};
140140

141141
onMovieValueChanged = (e: DxSelectBoxTypes.ValueChangedEvent): void => {
142-
const form = this.formInstance!;
142+
const form = this.formInstance;
143143
const movie = this.getMovieById(e.value);
144144
this.currentSelectedMovie = movie;
145145

apps/demos/Demos/Scheduler/Templates/React/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const views: SchedulerTypes.ViewType[] = ['day', 'week', 'timelineDay'];
2525
const groups = ['theatreId'];
2626

2727
const getMovieById = (id: number | undefined): MovieResource | null => id
28-
? query(moviesData).filter(['id', '=', id]).toArray()[0]
28+
? query(moviesData).filter(['id', '=', id]).toArray()[0] ?? null
2929
: null;
3030

3131
const getEditorStylingMode = (): 'filled' | 'outlined' => {
@@ -56,7 +56,7 @@ const App = () => {
5656
}), [onPopupOptionChanged]);
5757

5858
const updateEndDate = useCallback((movie: MovieResource): void => {
59-
const form = formInstanceRef.current!;
59+
const form = formInstanceRef.current;
6060
const formData = form.option('formData');
6161
const { startDate } = formData;
6262

@@ -67,7 +67,7 @@ const App = () => {
6767
}, []);
6868

6969
const onFormInitialized = useCallback((e: FormTypes.InitializedEvent) => {
70-
const form = e.component!;
70+
const form = e.component;
7171
formInstanceRef.current = form;
7272

7373
form.on('fieldDataChanged', (fieldEvent: FormTypes.FieldDataChangedEvent) => {
@@ -83,7 +83,7 @@ const App = () => {
8383
}, [updateEndDate]);
8484

8585
const onMovieValueChanged = useCallback((e: SelectBoxTypes.ValueChangedEvent) => {
86-
const form = formInstanceRef.current!;
86+
const form = formInstanceRef.current;
8787
const movie = getMovieById(e.value);
8888

8989
if (movie) {

apps/demos/Demos/Scheduler/Templates/React/MovieInfoContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ type MovieInfoContainerProps = {
1010
};
1111

1212
const getMovieById = (id: number | undefined): MovieResource | null => id
13-
? query(moviesData).filter(['id', '=', id]).toArray()[0]
13+
? query(moviesData).filter(['id', '=', id]).toArray()[0] ?? null
1414
: null;
1515

1616
const MovieInfoContainer: React.FC<MovieInfoContainerProps> = ({ formInstanceRef }) => {
1717
const [movie, setMovie] = useState<MovieResource | null>(null);
1818

1919
useEffect(() => {
20-
const form = formInstanceRef.current!;
20+
const form = formInstanceRef.current;
2121
const formData = form.option('formData');
2222

2323
const currentMovie = getMovieById(formData.movieId);

apps/demos/Demos/Scheduler/Templates/ReactJs/App.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import { data, moviesData, theatreData } from './data.js';
1515
const currentDate = new Date(2025, 3, 27);
1616
const views = ['day', 'week', 'timelineDay'];
1717
const groups = ['theatreId'];
18-
const getMovieById = (id) => (id ? query(moviesData).filter(['id', '=', id]).toArray()[0] : null);
18+
const getMovieById = (id) =>
19+
id ? query(moviesData).filter(['id', '=', id]).toArray()[0] ?? null : null;
1920
const getEditorStylingMode = () => {
2021
const isMaterialOrFluent = document.querySelector('.dx-theme-fluent, .dx-theme-material');
2122
return isMaterialOrFluent ? 'filled' : 'outlined';

apps/demos/Demos/Scheduler/Templates/ReactJs/MovieInfoContainer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import React, { useState, useEffect } from 'react';
22
import { query } from 'devextreme-react/common/data';
33
import { moviesData } from './data.js';
44

5-
const getMovieById = (id) => (id ? query(moviesData).filter(['id', '=', id]).toArray()[0] : null);
5+
const getMovieById = (id) =>
6+
id ? query(moviesData).filter(['id', '=', id]).toArray()[0] ?? null : null;
67
const MovieInfoContainer = ({ formInstanceRef }) => {
78
const [movie, setMovie] = useState(null);
89
useEffect(() => {

apps/demos/Demos/Scheduler/Templates/Vue/App.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,16 @@ const scheduler = ref<DxScheduler['instance']>();
119119
const currentDate = new Date(2025, 3, 27);
120120
const dataSource = data;
121121
122-
const currentMovie = ref<MovieResource | null | undefined>(null);
122+
const currentMovie = ref<MovieResource | null>(null);
123123
const formInstance = ref<dxForm | null>(null);
124124
125125
const onContentReady = (e: DxSchedulerTypes.ContentReadyEvent) => {
126126
scheduler.value = e.component;
127127
};
128128
129-
const getMovieById = (resourceId: number): MovieResource | undefined =>
130-
query(moviesData)
131-
.filter(['id', '=', resourceId])
132-
.toArray()[0];
129+
const getMovieById = (id: number | undefined): MovieResource | null => id
130+
? query(moviesData).filter(['id', '=', id]).toArray()[0] ?? null
131+
: null;
133132
134133
const getEditorStylingMode = (): 'filled' | 'outlined' => {
135134
const isMaterialOrFluent = document.querySelector('.dx-theme-fluent, .dx-theme-material');

0 commit comments

Comments
 (0)