diff --git a/src/test/examples/longFile.tsx b/src/test/examples/longFile.tsx index 282e91c1..f05f5b9e 100644 --- a/src/test/examples/longFile.tsx +++ b/src/test/examples/longFile.tsx @@ -1,36 +1,37 @@ +// @ts-nocheck /* eslint-disable */ // Import necessary modules -import { useState } from "react"; +import { useState } from "react" // Define the interface for the form data interface FormData { - name: string; - age: string; - dateOfBirth: string; - streetAddress: string; - city: string; - country: string; - postCode: string; - favouriteDog: string; - favouriteCat: string; - lastMovie: string; - lastBook: string; - dreamVacation: string; - favouriteTree: string; - favouriteFood: string; - dreamJob: string; - favoriteColor: string; - hobby: string; - carBrand: string; - movieGenre: string; - musicGenre: string; - favoriteSport: string; - favoriteArtist: string; - dreamCity: string; - favoriteHoliday: string; - bestFriend: string; - favoriteBookGenre: string; - favoriteSeason: string; + name: string + age: string + dateOfBirth: string + streetAddress: string + city: string + country: string + postCode: string + favouriteDog: string + favouriteCat: string + lastMovie: string + lastBook: string + dreamVacation: string + favouriteTree: string + favouriteFood: string + dreamJob: string + favoriteColor: string + hobby: string + carBrand: string + movieGenre: string + musicGenre: string + favoriteSport: string + favoriteArtist: string + dreamCity: string + favoriteHoliday: string + bestFriend: string + favoriteBookGenre: string + favoriteSeason: string } // Define the initial form data @@ -61,89 +62,77 @@ const initialFormData: FormData = { favoriteHoliday: "", bestFriend: "", favoriteBookGenre: "", - favoriteSeason: "", -}; + favoriteSeason: "" +} // Define the interface for an item interface Item { - id: number; - name: string; - checked: boolean; + id: number + name: string + checked: boolean } // Define the component const LongForm = () => { // Initialize state - const [formData, setFormData] = useState(initialFormData); + const [formData, setFormData] = useState(initialFormData) // Add a state variable for the count - const [count, setCount] = useState(0); + const [count, setCount] = useState(0) // Add a state variable for the toggle - const [isToggled, setIsToggled] = useState(false); + const [isToggled, setIsToggled] = useState(false) // Define a state variable for the rating - const [rating, setRating] = useState(null); + const [rating, setRating] = useState(null) // Define a state variable for the items - const [items, setItems] = useState([]); + const [items, setItems] = useState([]) // Define a state variable for the new item name - const [newItemName, setNewItemName] = useState(""); + const [newItemName, setNewItemName] = useState("") // Handle input changes const handleChange = (event: React.ChangeEvent) => { setFormData({ ...formData, - [event.target.name]: event.target.value, - }); - }; + [event.target.name]: event.target.value + }) + } // Add a function to increment the count const incrementCount = () => { - setCount(count + 1); - }; + setCount(count + 1) + } const handleToggle = () => { - setIsToggled(!isToggled); - }; + setIsToggled(!isToggled) + } // Define a function to handle the rating change const handleRatingChange = (event: React.ChangeEvent) => { - setRating(Number(event.target.value)); - }; + setRating(Number(event.target.value)) + } // Define a function to add a new item const addNewItem = () => { - setItems([ - ...items, - { id: items.length, name: newItemName, checked: false }, - ]); - setNewItemName(""); - }; + setItems([...items, { id: items.length, name: newItemName, checked: false }]) + setNewItemName("") + } // Define a function to handle the change of the new item name - const handleNewItemNameChange = ( - event: React.ChangeEvent - ) => { - setNewItemName(event.target.value); - }; + const handleNewItemNameChange = (event: React.ChangeEvent) => { + setNewItemName(event.target.value) + } // Define a function to handle the change of an item's checked state const handleItemCheckedChange = (id: number) => { - setItems( - items.map((item) => - item.id === id ? { ...item, checked: !item.checked } : item - ) - ); - }; + setItems(items.map(item => (item.id === id ? { ...item, checked: !item.checked } : item))) + } // Render the component return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-