Fakultas Ilmu Komputer UI

Commit 8ee0307f authored by Doan Andreas Nathanael's avatar Doan Andreas Nathanael
Browse files

Configure Pre-commit & CI Linter

parent e987312e
...@@ -12,11 +12,12 @@ stages: ...@@ -12,11 +12,12 @@ stages:
- sonar-scanner - sonar-scanner
- build - build
test: lint-test:
stage: test stage: test
before_script: before_script:
- yarn install - yarn install
script: script:
- yarn lint
- yarn test --coverage --watchAll=false --verbose --collectCoverageFrom="src/**/*.tsx" - yarn test --coverage --watchAll=false --verbose --collectCoverageFrom="src/**/*.tsx"
artifacts: artifacts:
paths: paths:
...@@ -25,7 +26,7 @@ test: ...@@ -25,7 +26,7 @@ test:
sonar-scanner: sonar-scanner:
image: image:
name: sonarsource/sonar-scanner-cli:latest name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""] entrypoint: ['']
stage: sonar-scanner stage: sonar-scanner
script: script:
- sonar-scanner - sonar-scanner
...@@ -44,12 +45,12 @@ android: ...@@ -44,12 +45,12 @@ android:
- chmod +x gradlew && ./gradlew clean && ./gradlew assembleRelease - chmod +x gradlew && ./gradlew clean && ./gradlew assembleRelease
- cd .. && cp android/app/build/outputs/apk/release/app-release.apk $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk - cd .. && cp android/app/build/outputs/apk/release/app-release.apk $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
artifacts: artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME" name: '$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME'
paths: paths:
- $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk - $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
except: except:
changes: changes:
- "README.md" - 'README.md'
only: only:
- staging - staging
- master - master
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
"test": "jest --coverage --watchAll=false --verbose --collectCoverageFrom=\"src/**/*.tsx\"", "test": "jest --coverage --watchAll=false --verbose --collectCoverageFrom=\"src/**/*.tsx\"",
"test-only": "jest -t", "test-only": "jest -t",
"lint": "eslint . --ext .ts,.tsx --fix", "lint": "eslint . --ext .ts,.tsx --fix",
"prettify": "prettier --write src" "prettify": "prettier --write src",
"prep": "npx mrm lint-staged",
"prepare": "husky install"
}, },
"dependencies": { "dependencies": {
"@react-native-community/async-storage": "^1.12.1", "@react-native-community/async-storage": "^1.12.1",
...@@ -45,7 +47,7 @@ ...@@ -45,7 +47,7 @@
"babel-jest": "^25.1.0", "babel-jest": "^25.1.0",
"babel-plugin-module-resolver": "^4.0.0", "babel-plugin-module-resolver": "^4.0.0",
"eslint": "^6.5.1", "eslint": "^6.5.1",
"husky": "^5.2.0", "husky": "^6.0.0",
"jest": "^25.1.0", "jest": "^25.1.0",
"jest-transform-stub": "^2.0.0", "jest-transform-stub": "^2.0.0",
"lint-staged": "^10.5.4", "lint-staged": "^10.5.4",
...@@ -56,15 +58,11 @@ ...@@ -56,15 +58,11 @@
"resolutions": { "resolutions": {
"@types/react": "^16" "@types/react": "^16"
}, },
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": { "lint-staged": {
"./src/*.{ts,tsx}": [ "./src/*.{ts,tsx}": [
"yarn run lint", "yarn run lint",
"yarn run prettify" "yarn run prettify"
] ],
"*.{ts,tsx}": "eslint --cache --fix"
} }
} }
import React from 'react'; import React from 'react';
import { act, create } from 'react-test-renderer'; import { act, create } from 'react-test-renderer';
import { fireEvent, render } from '@testing-library/react-native';
import BigButton from '.'; import BigButton from '.';
......
...@@ -24,7 +24,9 @@ const ResultCard: FC<Props> = ({ infos, status, testID }) => { ...@@ -24,7 +24,9 @@ const ResultCard: FC<Props> = ({ infos, status, testID }) => {
const cardColor = getColorFromStatus(status); const cardColor = getColorFromStatus(status);
const infoPairs = infos.reduce(function (result, value, index, array) { const infoPairs = infos.reduce(function (result, value, index, array) {
if (index % 2 === 0) result.push(array.slice(index, index + 2)); if (index % 2 === 0) {
result.push(array.slice(index, index + 2));
}
return result; return result;
}, []); }, []);
......
import { DietProfileResponse } from 'services/dietelaQuiz/models';
import { ResultPageContent } from '../types'; import { ResultPageContent } from '../types';
const detailEnergiSehari = ( const detailEnergiSehari = (): ResultPageContent => ({
response: DietProfileResponse,
): ResultPageContent => ({
title: 'Aktivitas fisik', title: 'Aktivitas fisik',
mainInfo: { mainInfo: {
infos: [ infos: [
......
import { allAccessQuestions } from 'scenes/questionnaire/AllAccessQuestionnaire/schema';
import { DietProfileResponse } from 'services/dietelaQuiz/models'; import { DietProfileResponse } from 'services/dietelaQuiz/models';
import { sayurBuahStatus } from 'services/dietelaQuiz/quizResult'; import { sayurBuahStatus } from 'services/dietelaQuiz/quizResult';
import { ResultPageContent } from '../types'; import { ResultPageContent } from '../types';
......
...@@ -3683,10 +3683,10 @@ human-signals@^1.1.1: ...@@ -3683,10 +3683,10 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
husky@^5.2.0: husky@^6.0.0:
version "5.2.0" version "6.0.0"
resolved "https://registry.yarnpkg.com/husky/-/husky-5.2.0.tgz#fc5e1c2300d34855d47de4753607d00943fc0802" resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e"
integrity sha512-AM8T/auHXRBxlrfPVLKP6jt49GCM2Zz47m8G3FOMsLmTv8Dj/fKVWE0Rh2d4Qrvmy131xEsdQnb3OXRib67PGg== integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==
iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24: iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24:
version "0.4.24" version "0.4.24"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment