ESLint broken: 제안이 있는 규칙은 "meta.has Suggestions" 속성을 "true"로 설정해야 합니다.
VSCode를 사용하고 있으며 회선을 추가할 때'react-hooks/exhaustive-deps': 'warn'
.eslintrc.js 에 대해서는, ESLint 출력으로 다음의 정보가 표시됩니다.
Rules with suggestions must set the `meta.hasSuggestions` property to `true`. Occurred while linting
C:\Users\filepath.jsx:72 Rule: "react-hooks/exhaustive-deps"
다른 모든 보풀이 깨진다..eslintrc.js에 다음 항목을 추가하려고 했습니다.
meta: {
hasSuggestions: true
},
다음과 같은 오류가 발생합니다.
UnhandledPromiseRejectionWarning: Error: ESLint configuration in .eslintrc.js is invalid:
- Unexpected top-level property "meta".
어떤 도움이라도 주시면 감사하겠습니다.
다음은 저의 .eslintrc.js입니다.
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
settings: {
'react': {
'version': 'detect'
}
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 13,
sourceType: 'module',
},
plugins: ['react-hooks', 'react'],
rules: {
'react/prop-types': [0],
quotes: ['error', 'single'],
semi: [1],
'react/jsx-indent': [1],
'no-multi-spaces': [1],
'indent': [2],
'react/jsx-newline': [2, { prevent: true }],
'no-trailing-spaces': [1],
'no-multiple-empty-lines': [1, { max: 1 }],
'space-infix-ops': [1],
'object-curly-spacing': [1, 'always'],
'comma-spacing': [1],
'react-hooks/rules-of-hooks': 'error',
'react/self-closing-comp': 1,
'react/jsx-closing-tag-location': 1,
'no-unreachable': 1,
'react-hooks/exhaustive-deps': 'warn'
},
};
여기 제 소포가 있습니다.json:
{
"name": "app",
"private": true,
"dependencies": {
"@babel/preset-react": "^7.14.5",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@mui/icons-material": "^5.0.4",
"@mui/material": "^5.0.3",
"@mui/styles": "^5.0.1",
"@rails/actioncable": "^6.1.4-1",
"@rails/activestorage": "^6.1.4-1",
"@rails/ujs": "^6.1.4-1",
"@rails/webpacker": "^6.0.0-rc.5",
"babel-plugin-macros": "^3.1.0",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-on-rails": "12.3.0",
"react-player": "^2.9.0",
"turbolinks": "^5.2.0",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0"
},
"version": "0.1.0",
"babel": {
"presets": [
"./node_modules/@rails/webpacker/package/babel/preset.js"
]
},
"browserslist": [
"defaults"
],
"devDependencies": {
"@webpack-cli/serve": "^1.6.0",
"eslint": "^8.0.0",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"webpack-dev-server": "^4.3.1"
}
}
ESLint 8.0.0에는 제안사항을 제공하는 규칙에 대한 변경사항이 포함되어 있습니다.이 변경 후 업데이트되지 않은 규칙을 사용하면 .eslintrc.js에 .eslintrc.js를 삽입할 수 없습니다.
할 수 있는 일:
- 플러그인이 ESLint 8과 함께 작동하도록 업데이트될 때까지 ESLint 7을 사용합니다.
- 의 경우
eslint-plugin-react-hooks
문제가 되는 규칙은 이미 갱신되어 있습니다(GitHub의 이 행을 확인해 주세요).그 이후로 패키지의 릴리스가 안정되어 있지 않을 뿐입니다.단, 매일 알파 릴리즈가 있었습니다.작성 시점의 최신 버전은 다음과 같습니다.4.2.1-alpha-c3a19e5af-20211014
ESLint 8과 이 플러그인이 꼭 필요한 경우 다음 안정 버전이 나올 때까지 알파 버전을 사용할 수 있습니다.
나는 규칙을 삭제해야만 했다."react/require-default-props": "off",
문제를 없애기 위해서요.완전한 수정은 아니지만 현재 리액트 v18에서는 동작하고 있습니다.
react-scripts를 4.x에서 5.0.1로 범핑한 후 동일한 오류가 발생하였습니다.패키지에 "eslint-config-react-app"도 포함되어 있었기 때문입니다.제이슨, 수정은 이것도 전류로 바꾸는 거였어. 우리 경우는 7.0.1이야.이것이 당신이 같은 문제를 접하는 데 도움이 되기를 바랍니다.
언급URL : https://stackoverflow.com/questions/69578685/eslint-broken-rules-with-suggestions-must-set-the-meta-hassuggestions-propert
'programing' 카테고리의 다른 글
json_encode()가 잘못된 문자를 가진 문자열을 삭제하지 않도록 하는 방법 (0) | 2023.03.19 |
---|---|
PHP fopen() 오류: 스트림을 열지 못했습니다.권한 거부 (0) | 2023.03.19 |
부트스트랩 파일에서 다른 스프링 프로파일을 올바르게 설정하려면 어떻게 해야 합니까(다른 클라우드 구성 서버를 대상으로 하는 스프링 부트용)? (0) | 2023.03.19 |
Angular UI-Router의 한 상태에서 더 많은 옵션 파라미터 (0) | 2023.03.19 |
Wordpress rest api에서 초안 가져오기 금지 (0) | 2023.03.19 |