This file contains 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
{ | |
"name": "npm-scripts-example", | |
"version": "1.0.0", | |
"description": "npm scripts example", | |
"scripts": { | |
"clean": "rimraf ./dist && mkdir dist", | |
"prebuild": "npm run clean", | |
"build": "cross-env NODE_ENV=production webpack" | |
} | |
} |
This file contains 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 { useEffect, useRef, useState } from "react"; | |
/** | |
* Provides the functionality of React.useState() with the only difference that | |
* it sets a state only if its parent component is still mounted, aka "safe setState". | |
*/ | |
export default function useSafeState(initialState) { | |
const mountedRef = useRef(false); | |
const [state, setState] = useState(initialState); |
This file contains 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
{ | |
"recommendations": [ | |
"dbaeumer.vscode-eslint", | |
"esbenp.prettier-vscode", | |
"streetsidesoftware.code-spell-checker", | |
"GitHub.vscode-pull-request-github", | |
"ms-playwright.playwright", | |
"pflannery.vscode-versionlens", | |
"ZixuanChen.vitest-explorer" | |
] |
This file contains 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
{ | |
"name": "npm-scripts-example", | |
"version": "1.0.0", | |
"description": "npm scripts example", | |
"scripts": { | |
"prebuild": "echo I run before the build script", | |
"build": "cross-env NODE_ENV=production webpack", | |
"postbuild": "echo I run after the build script" | |
} | |
} |
This file contains 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
// This file assures that a Jest test file and Cypress test file exists for each component. | |
import path from "path"; | |
import fs from "fs"; | |
function getFiles(filepath: string) { | |
return fs.readdirSync(filepath).filter(function (file) { | |
return fs.statSync(path.join(filepath, file)).isFile(); | |
}); | |
} |
This file contains 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
/** Return this when the user signs in */ | |
type GetUserPermissionsResponse = { | |
featurePermissions: FeaturePermission[]; | |
projectPermissions: ProjectPermission[]; | |
}; | |
type FeaturePermission = { | |
subModuleId: number; | |
permissions: Permission[]; | |
}; |
This file contains 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 { useEffect, useState } from "react"; | |
type Cameras = { | |
back: boolean; | |
front: boolean; | |
}; | |
/** Returns a device's cameras and their location */ | |
export default function useHasCamera() { | |
const [cameras, setCameras] = useState<Cameras | null>(null); |
This file contains 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
export const schema = { | |
"type": "object", | |
"properties": { | |
"users": { | |
"type": "array", | |
"minItems": 3, | |
"maxItems": 5, | |
"items": { | |
"type": "object", | |
"properties": { |
This file contains 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 path from 'path'; | |
export default { | |
debug: true, | |
devtool: 'inline-source-map', | |
noInfo: false, | |
entry: [ | |
path.resolve(__dirname, 'src/index') | |
], | |
target: 'web', |
This file contains 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
Show hidden characters
{ | |
"root": true, | |
"extends": [ | |
"eslint:recommended", | |
"plugin:import/errors", | |
"plugin:import/warnings" | |
], | |
"parserOptions": { | |
"ecmaVersion": 7, | |
"sourceType": "module" |
NewerOlder