Skip to content

Instantly share code, notes, and snippets.

View eps1lon's full-sized avatar
:atom:
mt?!" “ .I.r '2 f

Sebastian "Sebbie" Silbermann eps1lon

:atom:
mt?!" “ .I.r '2 f
View GitHub Profile
@eps1lon
eps1lon / lazyForwardRef.js
Created March 14, 2019 11:46
React lazy + forwardRef
const Component = React.lazy(() => {
return import("./Component").then(({ default: Component }) => {
return {
default: React.forwardRef((props, ref) => (
<Component ref={ref} {...props} />
))
};
});
});
@eps1lon
eps1lon / areDocsConvertedToTSYet.js
Last active August 12, 2021 07:43
are material-ui docs converted to ts yet
/* eslint-disable no-console */
/**
* usage:
* `node scripts/areDocsConvertedToTSYet.js > converted.md`
* replace content of the <details /> (keep the <summary />) with
* `converted.md`
*
*/
const fse = require('fs-extra');
const glob = require('glob');
@eps1lon
eps1lon / link.js
Created March 20, 2019 09:50
runs link for packages in Material-UI workspace
@eps1lon
eps1lon / astexplorer.txt
Created March 26, 2019 16:20
eslint-plugin-material-ui/test-cleanup
https://astexplorer.net/#/gist/bc9e876927f9593ecbaa9d0fc115ac86/32ca9f448d2f4a02400b08a49922e7e6719d7d8b
declare module 'material-ui-popup-state' {
import React from 'react';
type Maybe<T> = T | null | undefined;
export type Variant = 'popover' | 'popper';
export interface InjectedProps {
open: (eventOrAnchorEl: React.SyntheticEvent<unknown> | HTMLElement) => void;
close: () => void;
/**
* usage:
* 1. edit scripts/getPrAuthors and past a newline separated list of pr numbers
* 2. $ GH_API_TOKEN=YOUR_TOKEN node scripts/getPrAuthors
*/
const { graphql } = require('@octokit/graphql');
const token = process.env.GH_API_TOKEN;
run().catch(error => {
@eps1lon
eps1lon / pre-push
Last active March 6, 2020 01:19
material-ui maintainer git-hooks. they're not in the repo because of false positives and not everybody knows no-verify
#!/bin/bash
# -e Exit immediately if a command exits with a non-zero status.
set -e
circleci config validate
yarn prettier check-changed
yarn lint
// Press ctrl+space for code completion
module.exports = function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.CallExpression)
.filter(path => {
return path.get("callee").get("name").value === "warning";
})
.forEach(path => {
With #13229 we got the proper infrastructure to present our demos both in JavaScript and TypeScript. We want to continue this effort with the goal to have all demos available in TypeScript.
If you want to make contributions to this repository and know a bit of TypeScript we would appreciate you helping us.
## Getting started
TL;DR: Use #14739, #14485 or #14535 as example workflows.
0. Set up your fork (See ['getting started"](https://github.com/mui-org/material-ui/blob/next/CONTRIBUTING.md#getting-started) in the contributing guide).
1. Choose a demo you want to convert. For this example, we'll use: https://next.material-ui.com/demos/lists/#nested-list
2. go to `./docs/src/pages/demos/lists/lists.md` and find the section. You're looking for a `{{ "demo": "some-path" }}` block: