airbnb style guide

React

React | do not nest ternary expression (Nextjs , typescript, airbnb style guide)

작업환경 - nextjs - typescript - airbnb styleguide 에러 발생 상황 부모 컴포넌트로부터 props로 num 을 받아오는 자식 컴포넌트인 item 컴포넌트에서 props 값에 따른 각기 다른 css 스타일 적용을 위해 삼항연산자를 사용하였는데, do not nest ternary expression 라는 에러가 발생하였다. 아마도 airbnb 스타일 가이드 때문에 발생한 에러가 아닌가 싶다. 첫번째 시도 삼항연산자를 switch 문으로 대체 하였으나 string 값 자체가 클래스명으로 적용되어서 module.css 가 적용되지 않았다. let types = 'styles.typeOne'; switch (num) { case '01': types = 'styles.typeOn..

React

React | CRA + TypeScript + Airbnb style guide 초기세팅

1. 프로젝트 파일 생성 npx create-react-app --template typescript 2. ESLint 설치 npm install -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser 2-1) .eslintrc 파일 생성 { "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], "extends": ["plugin:@typescript-eslint/recommended"] } 2-2) package.json 에 script 추가 //pagckage.json { ... "scripts": { "lint": "eslint './src/**/*.{t..

3jun
'airbnb style guide' 태그의 글 목록