TWIL 2020-11 (2)

8601 단어 TWILTWIL

1. git error


🚨 The git repository at '/Users/jheeju' has too many active changes, only a subset of Git features will be enabled.

새 노트북에서 사이드 프로젝트를 위해 CRA로 폴더를 만들었는데 VSCode로 실행하니 제목과 같은 경고문구가 떴다. .git폴더의 위치가 잘못 설정되어 생기는 현상이라고 한다.

  • git rev-parse --show-toplevel으로 git root directory를 알아낸다.
  • cd /Users/jheeju git root directory로 이동
  • ls -a.git폴더 확인
  • rm -r -f .git.git폴더 삭제

.git

The .git folder contains all the information that is necessary for your project in version control and all the information about commits, remote repository address, etc. All of them are present in this folder. It also contains a log that stores your commit history so that you can roll back to history.

문제는 해결하였으나 .git 폴더가 왜 저 위치에 생성되었는지, 삭제하면 안 되는 경우도 있는지 등 깃에 대한 이해 부족에서 오는 궁금증들이 남아있다.

🔗 https://stackoverflow.com/questions/29217859/what-is-the-git-folder
🔗 https://seanlion.github.io/blog/25

❗️

.git폴더는 git init을 한 경우, 또는 npx create-reate-app을 한 경우에 생성된다. 프로젝트 리포지토리 안에 있는 것이 정상적인 위치이다. 이미 진행 중인 프로젝트라면 .git폴더에 모든 히스토리와 정보가 담겨있으므로 당연히 삭제해서는 안 될 것이고, 위의 경우는 새 리포지토리이므로 문제가 된 위치에서의 .git폴더 삭제 후 리포 안에서 git init으로 다시 .git폴더를 만들어 작업하면 된다.

2. Repository vs. Folder


리포지토리가 정확히 어떻게 폴더라는 용어와 구분되는지 궁금해서 찾아보았다.

A software repository, or “repo” for short, is a storage location for software packages.

소프트웨어 패키지를 보관하는 장소를 리포지토리(Repository, 저장소)라고 부른다.

🔗 Software repository

3. ESLint - enforce a maximum line length (max-len)


const list = action.items.map(item => {
  return {
    id: item.ID,
    specification: {
      id: item.ProductRequirementSpecificationProductRequirementSpecification.ID
    }
  };
});

API 응답으로 받은 프로퍼티 이름이 매우 긴데 어떠한 이유로 변경할 수 없어서(저렇게 긴 경우는 변경하는 것이 최선이지만) 린트 글자 수 제한에 걸리는 경우, join 메서드를 활용할 수 있다.

...
  const specification = [
    "ProductRequirementSpecification",
    "ProductRequirementSpecification"
  ].join("");

  const list = action.items.map(item => {
    return {
      id: item.ID,
      spcification: {
        id: item[specification].ID
      }
    };
  });

specification은 문자열을 담고 있으므로, item.specification이 아닌 item[specification]으로 값에 접근해야 한다.

Dot Notation vs. Bracket Notation

  • You can access properties on an object by specifying the name of the object, followed by a dot (period) followed by the property name. This is the syntax: objectName.propertyName;.

    When working with dot notation, property identifies can only be alphanumeric (and _ and $). Properties can’t start with a number.

  • You can access properties on an object by specifying the name of the object followed by the property name in brackets. Here’s the syntax: objectName["propertyName"].

    When working with bracket notation, property identifiers only have to be a String. They can include any characters, including spaces.

🔗 JavaScript Quickie— Dot Notation vs. Bracket Notation 👍

객체의 키는 무조건 문자열인가?

🔗 자바스크립트의 객체
🔗 Keys in Javascript objects can only be strings?

4. VSCode - markdown preview


VSCode에서 README.md 파일 작성 시 Command Palette > Markdown: Open Locked Preview to the Side 기능을 사용하면 velog처럼 결과물을 보며 작업할 수 있어서 편리하다.

5. React absolute path


리액트에서 baseUrl을 src로 지정하면 파일 경로가 아래처럼 간단해진다.

// import App from './components/App';
import App from 'components/App';

프로젝트 폴더 최상단에서 jsconfig.json 파일 생성하여 아래와 같이 입력하면 된다.

{
    "compilerOptions": {
        "baseUrl": "./src"
    }
}

6. iterm2 + oh my zsh


iterm2 cheatsheet

새 노트북에 iterm2 설치 중... ⌘+ Shift + D로 화면 분할하여 쓸 수 있는 것을 알았다.

🔗 iterm2 cheatsheet

oh my zsh 삭제

~/.zshrc에서 테마를 바꾸고 싶은데 뭔가 잘 못 되었는지 안에 아무 내용도 없고 테마 적용도 안되어서 삭제하고 재설치 하려는데 삭제 명령어uninstall_oh_my_zsh가 작동하지 않았다.

❗️sudo sh ~/.oh-my-zsh/tools/uninstall.sh로 해결
🔗 https://github.com/ohmyzsh/ohmyzsh/issues/848

좋은 웹페이지 즐겨찾기