React 프로젝트에서 Airbnb의 Javascript 표준을 사용하여 linting을 설정하려고합니다. webpack을 사용합니다.React와 Webpack으로 Airbnb ESLint 설정하기
의견을 기반으로 최신 패키지로 업데이트되었습니다.
"babel-eslint": "^6.1.2",
"eslint": "^3.2.2",
"eslint-config-airbnb": "^10.0.0",
"eslint-plugin-import": "^1.12.0",
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-react": "^6.0.0",
"jshint": "^2.9.2",
"jshint-loader": "^0.8.3",
"json-loader": "^0.5.4",
나는 또한 내 웹팩 설정에
preLoaders: [
{
test: /\.jsx?$/,
loaders: ['eslint'],
// define an include so we check just the files we need
include: PATHS.app
}
],
을 프리 로더의 설정을 가지고 그리고는 가
나는 또한 다음을 가진 .eslintrc
파일이 스크립트
"lint": "eslint . --ext .js --ext .jsx --ignore-path .gitignore --cache",
을 실행하기위한 설정 다음
{
"extends": "airbnb",
"env": {
"node": true,
"es6": true
}
}
이 나에게 다음과 같은 오류 제공 :
Configuration for rule "react/jsx-sort-props" is invalid:
Value "data["0"].shorthandLast" has additional properties.
은 내가 충돌 수 있습니다 생각 .eslintrc
파일을 제거하는 경우를, 나는 다음과 같은 오류 얻을 :
error Parsing error: The keyword 'const' is reserved
작업을 일으키는 NPM 오류로 이어가 나가기 위해서.
도움이 될 것입니다.
eslint 3로 시도해 보셨습니까? 최근의 특정 변경 사항이 있었고 오류가 원인 인 이유에 따라 변경되었습니다. 어떤 이유로 든 eslint 3을 사용할 수 없다면 이전 버전의 호환 가능한 사전 설정을 사용해야합니다. –
나는 실제로 eslint를 가지고있다. 3.9.5 @ JuhoVepsäläinen을 설치하면 늦은 버전 일까? – Ash
''eslint ":"^ 2.13.1 ", 그것이 전 세계적으로 설치되어 있다고해도 선택합니다. –