• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

eslint

21.08.25 15:02 작성 조회수 214

0

저는 왜 제로초님처럼 didpatch가 없는 걸 잡아 주지않을까요?..
느낌이 recommended 했던때랑 비슷한거 같아요..
확장 프로그램으로는 Eslint, Prettier-eslint 깔려있어요
밑에는 제 파일들 입니다.
<eslint>
{
  "parser""babel-eslint",
  "parserOptions": {
    "ecmaVersion"2021,
    "sourceType""module",
    "ecmaFeatures": {
      "jsx"true
    },
    "env": {
      "browser"true,
      "node"true,
      "es6"true
    },
    "extends": [
      "airbnb",
      "plugin:prettier/recommended"
    ],
    "plugins" : [
      "import",
      "react-hooks",
      "prettier"
    ],
    "rules": {
      "prettier/prettier""error",
      "jsx-a11y/label-has-associated-control""off",
      "jsx-a11y/anchor-is-valid""off",
      "no-console""off",
      "no-underscore-dangle""off",
      "react/forbid-prop-types""off",
      "react/jsx-filename-extension""off",
      "react/jsx-one-expression-per-line""off",
      "object-curly-newline""off",
      "linebreak-style""off",
      "no-param-reassign""off"
    }
  }
}
<package.json>
{
  "name""react-nodebird-front",
  "version""1.0.0",
  "description""",
  "main""index.js",
  "scripts": {
    "dev""next"
  },
  "author""",
  "license""MIT",
  "dependencies": {
    "@ant-design/icons""^4.6.2",
    "antd""^4.16.6",
    "axios""^0.21.1",
    "next""^10.2.3",
    "next-redux-wrapper""^7.0.2",
    "prop-types""^15.7.2",
    "react""^17.0.2",
    "react-dom""^17.0.2",
    "react-hook-form""^7.11.0",
    "react-redux""^7.2.4",
    "react-slick""^0.28.1",
    "redux""^4.1.0",
    "redux-devtools-extension""^2.13.9",
    "redux-saga""^1.1.3",
    "styled-components""^5.3.0"
  },
  "devDependencies": {
    "babel-eslint""^10.1.0",
    "eslint""^7.30.0",
    "eslint-config-airbnb""^18.2.1",
    "eslint-config-prettier""^8.3.0",
    "eslint-plugin-import""^2.23.4",
    "eslint-plugin-jsx-a11y""^6.4.1",
    "eslint-plugin-prettier""^3.4.1",
    "eslint-plugin-react""^7.24.0",
    "eslint-plugin-react-hooks""^4.2.0",
    "prettier-eslint""^13.0.0"
  }
}
<setting.json>
{
    "javascript.updateImportsOnFileMove.enabled""always",
    "editor.wordWrap""on",
    "workbench.preferredLightColorTheme""Dracula Soft",
    "workbench.iconTheme""material-icon-theme",
    "javascript.preferences.quoteStyle""single",
    "typescript.preferences.quoteStyle""single",
    "liveServer.settings.donotShowInfoMsg"true,
    "editor.fontSize"17,
    "files.autoSaveDelay"500,
    "editor.mouseWheelZoom"true,
    "liveServer.settings.fullReload"true,
    "editor.tabSize"2,
    "javascript.format.enable"false,
    "workbench.sideBar.location""right",
    "explorer.confirmDelete"false,
    "explorer.confirmDragAndDrop"false,
    "terminal.integrated.tabs.enabled"true,
    "editor.accessibilitySupport""off",
    "eslint.alwaysShowStatus"true,
    "eslint.workingDirectories": [
    {
        "mode""auto"
    }
],
"window.zoomLevel"1,
"workbench.colorTheme""Default Light+",
"files.autoSave""afterDelay",
"[json]": {

    "editor.quickSuggestions": {
        "strings"true
    },
    "editor.suggest.insertMode""replace"
}
}

답변 4

·

답변을 작성해보세요.

0

hee0735님의 프로필

hee0735

2021.09.09

저도 eslint를 써도 dispatch없는걸 잡아내지 못하네요 .. 왜그러지 ㅠㅠㅠ 

제 깃헙이랑 버전 똑같이 맞추고 npm i 해서도 에러가 뜨지 않는다면 에디터 설정 문제입니다.

0

"rules": {
      "no-undef""error",
      "prettier/prettier""error",
      "jsx-a11y/label-has-associated-control""off",
      "jsx-a11y/anchor-is-valid""off",
      "no-console""off",
      "no-underscore-dangle""off",
      "react/forbid-prop-types""off",
      "react/jsx-filename-extension""off",
      "react/jsx-one-expression-per-line""off",
      "object-curly-newline""off",
      "linebreak-style""off",
      "no-param-reassign""off"
   }
추가했는데 에러가 안뜨네요 ㅜㅡㅜ.. 왜 에러를 내고 싶은데 못내게 하는지..아이러니,,

0

아 그 영상에서 CommentForm 파일에서 제로초님이 useDispatch 모르고 안적으셨을때 dispatch변수 아래에 줄이 그여있었어서 저도 실험해볼려고 useDispatch 주석 처리해봤는데 dispatch에 줄이 안그이더라구요.. 그래서 ..

아 그리고 저 "jsx-a11y"는 위에서는 추가 안했었는데 방금 추가 했어요!

ESLint: 'dispatch' is not defined.(no-undef)

이 에러가 떠야하긴 합니다.

rules에 "no-undef": "error" 추가해보세요.

0

dispatch가 어디에 없는 것을 말씀하시는 건가요??