Skip to content

Instantly share code, notes, and snippets.

View alexilyaev's full-sized avatar

Alex Ilyaev alexilyaev

View GitHub Profile
@alexilyaev
alexilyaev / typescript-guidelines.md
Last active December 7, 2022 20:15
TypeScript Guideliens

Style Guides

Guidelines

  • Avoid using any as much as possible.
    • If you want a type meaning "any object", use Record<string, unknown> instead.
  • If you want a type meaning "any value", you probably want unknown instead.
@alexilyaev
alexilyaev / emotion-guidelines.md
Last active May 16, 2022 13:50
CSS in JS - Emotion Guidelines

CSS-in-JS

This repo uses a CSS-in-JS library called Emotion for its styling.

Why Emotion?

Emotion is a performant and flexible CSS-in-JS library. Building on many other CSS-in-JS libraries, it allows us to style apps quickly with string or object styles. It has predictable composition to avoid specificity issues in CSS. With source maps and labels, Emotion has a great developer experience and performance with heavy caching in production.

Also, Material UI v5 will most likely use Emotion instead of JSS:
material-ui - [RFC] v5 styling solution

@alexilyaev
alexilyaev / css-guidelines.md
Created December 10, 2020 10:11
CSS Styling Guidelines

CSS Styling Guidelines

  • Use rem units for font-size and line-height.
    • The user preferences are respected.
    • We can change the apparent px value of rem to whatever we'd like.
  • Use px, % or vw for layout purposes.
    • For example, when using margin, padding, width, height, etc.
    • Easier to implement design requirements.
    • Why not rem here as well?
  • Layout can break when changing the base browser font-size.
@alexilyaev
alexilyaev / prettier-config.md
Created November 26, 2020 18:57
Prettier Config

trailingComma: es5 (default)

https://prettier.io/docs/en/options.html#trailing-commas

When set to none...

  • Often forgetting to add a comma when adding entries to an Object.
  • Commenting a property in an object currently removes the comma from the property above it.
  • Moving the last property of an object up requires an extra step to add a comma at the end.
  • Messes up Git diff and sometimes creates conflicts.
@alexilyaev
alexilyaev / react-folder-structure-ideas.md
Last active December 10, 2020 12:16
React Folder Structure Ideas

React Folder Structure Ideas

Suggested structure

components/
  NavBar/
    BrandLogo.jsx
    NavBar.jsx
 NavBar.text.jsx
@alexilyaev
alexilyaev / user-settings.json
Last active May 8, 2022 14:06
VS Code Common Settings
{
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@alexilyaev
alexilyaev / date-fns-issues.md
Last active October 31, 2023 19:19
Moment.js deprecated, date-fns issues
@alexilyaev
alexilyaev / eslint-no-null.md
Last active March 4, 2021 21:41
ESLint `no-null` rule from `eslint-plugin-unicorn`
@alexilyaev
alexilyaev / deploy-ci.sh
Last active May 19, 2020 16:55
Git CI authentication with SSH keys
#!/usr/bin/env bash
# References:
# https://docs.travis-ci.com/user/environment-variables
#
# Inspired by:
# https://gist.github.com/willprice/e07efd73fb7f13f917ea
# But using SSH keys instead of Personal Access Token:
# https://gist.github.com/alexilyaev/2672fe6d99756377fbffaabad6db1f45