Skip to content

Instantly share code, notes, and snippets.

🐢
Better but slow

Yeongsu Han heyman333

🐢
Better but slow
Block or report user

Report or block heyman333

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@heyman333
heyman333 / ts-precommit.bash
Created Mar 19, 2020 — forked from dcurletti/ts-precommit.bash
Bash script to typecheck project on TypeScript file changes
View ts-precommit.bash
#!/bin/bash
# You can make the script more generic by changing the matching pattern
SRC_PATTERN=".*\.(ts|tsx)$"
# needed bc env vars change when run inside a git hook
# https://stackoverflow.com/questions/3542854/calling-git-pull-from-a-git-post-update-hook
# https://serverfault.com/questions/107608/git-post-receive-hook-with-git-pull-failed-to-find-a-valid-git-directory
unset $(git rev-parse --local-env-vars)
View diff2.diff
{
"compilerOptions": {
+ "baseUrl": "./src",
"esModuleInterop": true,
"jsx": "react",
"lib": ["es6"],
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "esnext",
View diff.diff
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
+ 'babel-module': {},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.native.js'],
},
View plugin.json
{
"plugins": [
[
"module-resolver",
{
"root": ["./src"],
"alias": {
"underscore": "lodash",
"icons": "./assets/icons",
"imgs": "./assets/imgs",
View config.js
// babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['./src'],
},
],
View gist:73bb0245247d8cec4dc797a63156ca97
// Use this:
import MyUtilFn from 'utils/MyUtilFn'
// Instead of that:
import MyUtilFn from '../../../../utils/MyUtilFn'
You can’t perform that action at this time.