Skip to content

Instantly share code, notes, and snippets.

View DanielHoffmann's full-sized avatar

Daniel Hoffmann Bernardes DanielHoffmann

  • Northvolt AB
  • Stockholm, Sweden
View GitHub Profile
/* eslint-env node */
/* eslint-disable import/no-nodejs-modules */
/* eslint-disable import/no-commonjs */
/* eslint-disable import/no-dynamic-require */
const glob = require('glob')
const path = require('path')
function getPackageJsons(directory) {
const packagePaths = glob.sync('**/package.json', {
cwd: directory,
type A = {
a: string
b: string
}
const c = {
a: 'a',
b: 'b',
c: 'c',
type A = {
a: string
b: string
}
const c = {
a: 'a',
b: 'b',
c: 'c'
import { createBrowserRouter, RouteObject } from 'react-router-dom'
const routes = [
myRoute1,
myRoute2,
myRoute3,
] satisfies RouteObject[]
type Route = {
import { Suspense, useEffect, useState } from 'react'
import { ErrorBoundary } from './components/ErrorBoundary'
import { Loader } from './components/Loader'
export function App() {
const [search, setSearch] = useState<string>('')
const [debouncedSearch, setDebouncedSearch] = useState<string>('')
useEffect(() => {
const timeout = setTimeout(() => {
// used so eslint-plugin-import can properly resolve dependencies using yarn2
let pnp
try {
pnp = require(`./.pnp.cjs`)
} catch (error) {
// not a problem
}
module.exports = {
ignorePatterns: [
'config/**/*',
'**/build/**/*',
'**/.yarn/**/*',
'**/artifacts/**/*',
'**/storybook-static/**/*',
'**/node_modules/**/*',
'**/*.config.js',
'**/*rc.js',
const cwd = process.cwd()
module.exports = function requireResolve(moduleName) {
const resolveOpts = {
paths: [
// will prefer this folder:
path.resolve(cwd, '..', 'some-dep', 'node_modules'),
// over this folder:
path.resolve(cwd, 'node_modules'),
],
import React, { useContext, useMemo, useState } from 'react';
interface ExampleContextValue {
value: number;
setValue: (newValue: number) => void;
}
const ExampleContext = React.createContext<ExampleContextValue | undefined>(
undefined,
);
export GOPATH=/Users/danielhoffmannbernardes/dev/go
# ZSH stuff
export ZSH=/Users/danielhoffmannbernardes/.oh-my-zsh
ZSH_THEME="robbyrussell"
plugins=(
git
)
source $ZSH/oh-my-zsh.sh