Next.js + typescript 환경설정 (ESLint, Prettier)

huhu·2020년 2월 9일
0

Setup project with create-next-app -e with-typescript <project_name>
(details : https://medium.com/@ss_81611/how-to-setup-a-nextjs-project-with-typescript-4a8a966353f2)

.eslintrc.js

module.exports = {
  parser: '@typescript-eslint/parser',
  extends: [
    'plugin:react/recommended',
    'plugin:@typescript-eslint/recommended',
    'prettier/@typescript-eslint',
    'plugin:prettier/recommended'
  ],
  plugins: ['@typescript-eslint', 'react'],
  rules: {}
};

.prettierrc.js

module.exports = {
  printWidth: 80,
  singleQuote: true,
  jsxBracketSameLine: true,
  noSemi: false
};

package.json dev dependencies

 "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^1.13.0",
    "@typescript-eslint/parser": "^1.13.0",
    "babel-eslint": "^10.0.2",
    "eslint": "^5.16.0",
    "eslint-config-prettier": "^6.0.0",
    "eslint-config-react-app": "^4.0.1",
    "eslint-plugin-import": "^2.18.2",
    "eslint-plugin-prettier": "^3.1.0",
    "eslint-plugin-react": "^7.14.3",
    "eslint-plugin-react-hooks": "^1.6.1",
    "prettier": "^1.18.2",
    "webpack": "^4.38.0"
  }

from : https://gist.github.com/kevinrodriguez-io/fb5eda739b94e43fd07d13cccb2ef0ce#file-eslint-prettier-ts-react-setup-conf-L6 에서 일부 수정하여 사용

profile
후후

0개의 댓글