Skip to content

Instantly share code, notes, and snippets.

View michal-wrzosek's full-sized avatar
🇳🇱
Coding from Rotterdam

Michał Wrzosek michal-wrzosek

🇳🇱
Coding from Rotterdam
View GitHub Profile
@michal-wrzosek
michal-wrzosek / package.json
Last active September 18, 2019 20:11
Create React App Boilerplate - ./package.json (scripts)
{
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test:unit": "react-scripts test",
"test:lint": "eslint --ext .ts --ext .tsx .",
"test:lint:fix": "npm run lint -- --fix",
"test": "npm run test:lint && npm run test:unit"
}
}
@michal-wrzosek
michal-wrzosek / settings.json
Created September 18, 2019 20:01
Create React App Boilerplate - ./.vscode/settings.json
{
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
],
"editor.renderWhitespace": "boundary"
@michal-wrzosek
michal-wrzosek / .prettierrc.js
Created September 18, 2019 19:59
Create React App Boilerplate - ./.prettierrc.js
module.exports = {
semi: true,
trailingComma: 'all',
singleQuote: true,
printWidth: 120,
tabWidth: 2,
};
@michal-wrzosek
michal-wrzosek / .eslintrc.js
Created September 18, 2019 19:58
Create React App Boilerplate - ./.eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2018,
@michal-wrzosek
michal-wrzosek / .eslintignore
Last active September 18, 2019 19:56
Create React App Boilerplate - ./.eslintignore
src/serviceWorker.ts
@michal-wrzosek
michal-wrzosek / composeHOCsTypescript.tsx
Last active August 5, 2022 15:45
Typing compose with multiple React HOCs (Typescript, HOC, React)
import { compose } from 'ramda';
export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type ABCProps = {
a: string;
b: string;
c: string;
};
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Theme = {
fontColor: string;
};
const theme = {
fontColor: 'red',
};
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Theme = {
fontColor: string;
};
type WithThemeProps = {
theme: Theme;
};
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type ExampleProps = {
items: string[];
providedByHOC: string;
alsoProvidedByHOC: number;
};
type ExamplePropsWithoutHOCProps = Omit<ExampleProps, 'providedByHOC' | 'alsoProvidedByHOC'>;
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Theme = {
fontColor: string;
};
type WithThemeProps = {
theme: Theme;
};