🔥 eslint & prettier 설정하기

$ yarn add --dev eslint prettier eslint-plugin-prettier eslint-config-prettier

.eslintrc.js

module.exports = {
  root: true,
  parser: '@typescript-eslint/parser',
  plugins: ['react', 'react-hooks', 'import', 'prettier', '@typescript-eslint'],
  extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
  env: {
    browser: true,
    es6: true,
  },
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
    project: './tsconfig.json',
  },
  rules: {
    "react/jsx-filename-extension": [
      1,
      { "extensions": [".js", "ts", ".jsx", "tsx"] }
    ]{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "files.eol": "\\n"
}
	},
};

.prettierrc

{
  "trailingComma": "all",
  "singleQuote": true,
  "printWidth": 80,
  "tabWidth": 2
}

settings.json

{
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "files.eol": "\\n"
}

react-native eslint & prettier 설정 (with airbnb-style)

[React.js] ESLint와 Prettier를 이용한 React 환경 설정 (VSCode)

🔥 airbnb + react-native-community eslint style 적용하기

$ npx install-peerdeps --dev eslint-config-airbnb
$ yarn add --dev @react-native-community/eslint-config