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:
- sonar-scanner
- build
test:
lint-test:
stage: test
before_script:
- yarn install
script:
- yarn lint
- yarn test --coverage --watchAll=false --verbose --collectCoverageFrom="src/**/*.tsx"
artifacts:
paths:
......@@ -25,7 +26,7 @@ test:
sonar-scanner:
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
entrypoint: ['']
stage: sonar-scanner
script:
- sonar-scanner
......@@ -44,12 +45,12 @@ android:
- 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
artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
name: '$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME'
paths:
- $CI_PROJECT_NAME-$CI_COMMIT_REF_NAME.apk
except:
changes:
- "README.md"
- 'README.md'
only:
- staging
- master
......@@ -9,7 +9,9 @@
"test": "jest --coverage --watchAll=false --verbose --collectCoverageFrom=\"src/**/*.tsx\"",
"test-only": "jest -t",
"lint": "eslint . --ext .ts,.tsx --fix",
"prettify": "prettier --write src"
"prettify": "prettier --write src",
"prep": "npx mrm lint-staged",
"prepare": "husky install"
},
"dependencies": {
"@react-native-community/async-storage": "^1.12.1",
......@@ -45,7 +47,7 @@
"babel-jest": "^25.1.0",
"babel-plugin-module-resolver": "^4.0.0",
"eslint": "^6.5.1",
"husky": "^5.2.0",
"husky": "^6.0.0",
"jest": "^25.1.0",
"jest-transform-stub": "^2.0.0",
"lint-staged": "^10.5.4",
......@@ -56,15 +58,11 @@
"resolutions": {
"@types/react": "^16"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"./src/*.{ts,tsx}": [
"yarn run lint",
"yarn run prettify"
]
],
"*.{ts,tsx}": "eslint --cache --fix"
}
}
import React from 'react';
import { act, create } from 'react-test-renderer';
import { fireEvent, render } from '@testing-library/react-native';
import BigButton from '.';
......
......@@ -24,7 +24,9 @@ const ResultCard: FC<Props> = ({ infos, status, testID }) => {
const cardColor = getColorFromStatus(status);
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;
}, []);
......
import { DietProfileResponse } from 'services/dietelaQuiz/models';
import { ResultPageContent } from '../types';
const detailEnergiSehari = (
response: DietProfileResponse,
): ResultPageContent => ({
const detailEnergiSehari = (): ResultPageContent => ({
title: 'Aktivitas fisik',
mainInfo: {
infos: [
......
import { allAccessQuestions } from 'scenes/questionnaire/AllAccessQuestionnaire/schema';
import { DietProfileResponse } from 'services/dietelaQuiz/models';
import { sayurBuahStatus } from 'services/dietelaQuiz/quizResult';
import { ResultPageContent } from '../types';
......
......@@ -3683,10 +3683,10 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
husky@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/husky/-/husky-5.2.0.tgz#fc5e1c2300d34855d47de4753607d00943fc0802"
integrity sha512-AM8T/auHXRBxlrfPVLKP6jt49GCM2Zz47m8G3FOMsLmTv8Dj/fKVWE0Rh2d4Qrvmy131xEsdQnb3OXRib67PGg==
husky@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e"
integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==
iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24:
version "0.4.24"
......
Markdown is supported
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