Merge branch '115-configure-eslint-analysis-for-sonarqube' into 'dev'

Resolve "Configure eslint analysis for sonarqube"

Closes #115

See merge request sa4-2020/the-sanmarinoes/frontend!147
This commit is contained in:
Matteo Omenetti 2020-05-11 14:58:41 +02:00
commit 87d82296ac
3 changed files with 61 additions and 2 deletions

View file

@ -31,7 +31,8 @@ sonar-scanner:
- dev
script:
- cd smart-hut
- yarn sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.projectName=$CI_PROJECT_PATH_SLUG -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.exclusion=cypress -Dsonar.sources=src -Dsonar.javascript.file.suffixes=.js,.jsx -Dsonar.sourceEncoding=UTF-8 -Dsonar.scm.disabled=True
- yarn eslint:report || true
- yarn sonar-scanner -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.projectName=$CI_PROJECT_PATH_SLUG -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.exclusion=cypress -Dsonar.sources=src -Dsonar.javascript.file.suffixes=.js,.jsx -Dsonar.sourceEncoding=UTF-8 -Dsonar.scm.disabled=True -Dsonar.eslint.reportPaths=eslint-report.json
smartHut_deploy:
stage: deploy

54
smart-hut/.eslintrc Normal file
View file

@ -0,0 +1,54 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules": {
"semi": "error",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/jsx-no-bind": [
"error",
{
"allowArrowFunctions": true,
"allowBind": false,
"ignoreRefs": true
}
],
"react/no-did-update-set-state": "error",
"react/no-unknown-property": "error",
"react/no-unused-prop-types": "error",
"react/prop-types": "error",
"react/react-in-jsx-scope": "error",
"no-unused-expressions": 0,
"chai-friendly/no-unused-expressions": 2,
"indent": [0, 4]
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"airbnb"
],
"env": {
"node": true,
"browser": true,
"jest": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["react", "chai-friendly"]
}

View file

@ -36,6 +36,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eslint": "eslint src",
"eslint:report": "eslint src -f json -o eslint-report.json",
"eject": "react-scripts eject"
},
"eslintConfig": {
@ -55,6 +57,8 @@
},
"devDependencies": {
"prettier": "2.0.1",
"sonarqube-scanner": "^2.6.0"
"sonarqube-scanner": "^2.6.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-chai-friendly": "^0.6.0"
}
}