This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| 'use strict'; | |
| var require$$0$5 = require('os'); | |
| var require$$1$3 = require('fs'); | |
| var require$$2$2 = require('url'); | |
| var require$$3$2 = require('path'); | |
| function getDefaultExportFromCjs (x) { | |
| return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| const path = require("path"); | |
| const { minimatch } = require("minimatch"); | |
| // Function to parse CODEOWNERS file | |
| function parseCodeowners(codeownersFile) { | |
| const rules = []; | |
| const lines = fs.readFileSync(codeownersFile, "utf-8").split("\n"); | |
| lines.forEach((line) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const useWhyDidYouUpdate = (name: string, props: any) => { | |
| const previousProps = useRef<any>({}); | |
| useEffect(() => { | |
| if (previousProps.current) { | |
| const allKeys = Object.keys({ | |
| ...(previousProps.current || {}), | |
| ...props | |
| }); | |
| const changesObj = {} as any; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const MaterialForm = () => { | |
| const handleSubmit = React.useCallback((values: IFormValues, actions) => { | |
| signUp(values); | |
| actions.setSubmitting(false); | |
| }, []); | |
| return ( | |
| <Formik<IFormValues> | |
| initialValues={{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FieldAttributes } from "formik"; | |
| import * as React from "react"; | |
| import { get } from "lodash"; | |
| import { TextField as BaseTextField } from "@material-ui/core"; | |
| interface IProps extends FieldAttributes<any> {} | |
| const TextField = (props: IProps) => { | |
| const { field, form, ...rest } = props; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from "react"; | |
| import { Formik, Form, FastField, ErrorMessage } from "formik"; | |
| import * as Yup from "yup"; | |
| interface IProps {} | |
| interface IFormValues { | |
| username: string; | |
| name: string; | |
| email: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isUsernameValid = (username: string): Promise<boolean> => | |
| new Promise(resolve => { | |
| const fakeUsernames = ["phuchoang2710", "abc123"]; | |
| setTimeout(() => { | |
| resolve(fakeUsernames.indexOf(username) < 0); | |
| }, 1000); | |
| }); | |
| const validationSchema = Yup.object().shape<IFormValues>({ | |
| name: Yup.string().required("Please enter your name"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const validationSchema = Yup.object().shape<IFormValues>({ | |
| name: Yup.string().required("Please enter your name"), | |
| email: Yup.string() | |
| .email("Please enter valid email") | |
| .required("Please enter your email"), | |
| username: Yup.string() | |
| .required("Please enter username") | |
| .min(5, "Your username is too short") | |
| .max(30, "Your username is too long"), | |
| password: Yup.string() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const BasicForm = () => { | |
| const handleSubmit = React.useCallback((values: IFormValues) => { | |
| console.log(values); | |
| }, []); | |
| return ( | |
| <Formik<IFormValues> | |
| initialValues={{ | |
| username: "", | |
| name: "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const BasicForm = () => { | |
| const handleSubmit = React.useCallback((values: IFormValues) => { | |
| console.log(values); | |
| }, []); | |
| return ( | |
| <Formik<IFormValues> | |
| initialValues={{ | |
| username: "", | |
| name: "", |
NewerOlder