Skip to content

Commit

Permalink
apply lint & prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
neila committed Jan 22, 2024
1 parent 5cb545c commit be504f5
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
"error",
{ ignores: ["modules"] },
],
"node/no-unpublished-import": "warn",
"node/no-missing-import": "warn",
},
settings: {
node: { tryExtensions: [".js", ".json", ".node", ".ts", ".d.ts"] },
Expand Down
8 changes: 3 additions & 5 deletions contracts/Government.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ contract Government is IGovernment {
return _winner;
}

function numberOfVotes(address _candidateAddress)
external
view
returns (uint256)
{
function numberOfVotes(
address _candidateAddress
) external view returns (uint256) {
for (uint256 i = 0; i < _candidates.length; i++) {
if (_candidates[i].candidate == _candidateAddress) {
return _candidates[i].numOfVotes;
Expand Down
25 changes: 9 additions & 16 deletions contracts/Medical.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ contract Medical is IMedical {
}

// 医師の登録も実装されている
function updateDoctorInfo(address _doctorAddress, string memory _name)
external
{
function updateDoctorInfo(
address _doctorAddress,
string memory _name
) external {
require(_doctorAddressToId[_doctorAddress] == 0, "already exist."); //未作成時のみ実行可能
Doctor memory _newDoctor = Doctor(_doctorAddress, _name, _doctorId);
doctors.push(_newDoctor);
Expand All @@ -75,7 +76,9 @@ contract Medical is IMedical {
_doctorAddressToName[_doctorAddress] = _name; //医師の名前をマッピングで登録
}

function getMedicalData(address _patientAddress)
function getMedicalData(
address _patientAddress
)
external
view
returns (
Expand Down Expand Up @@ -117,13 +120,7 @@ contract Medical is IMedical {
function viewPatientProfile()
external
view
returns (
string memory,
string memory,
uint256,
address,
string memory
)
returns (string memory, string memory, uint256, address, string memory)
{
require(_patientAddressToId[msg.sender] > 0, "not registered yet");
uint256 _ownerId = _patientAddressToId[msg.sender] - 1;
Expand All @@ -142,11 +139,7 @@ contract Medical is IMedical {
function viewDoctorProfile()
external
view
returns (
string memory,
uint256,
address
)
returns (string memory, uint256, address)
{
require(_doctorAddressToId[msg.sender] > 0, " not registered yet");
uint256 _ownerId = _doctorAddressToId[msg.sender] - 1;
Expand Down
10 changes: 4 additions & 6 deletions contracts/SocialNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,12 @@ contract SocialNetwork is ISocialNetwork {
return posts[posts.length - 1].id;
}

function getPost(uint256 _postId)
function getPost(
uint256 _postId
)
external
view
returns (
string memory message,
uint256 totalLikes,
uint256 time
)
returns (string memory message, uint256 totalLikes, uint256 time)
{
for (uint256 i = 0; i < posts.length; i++) {
if (posts[i].id == _postId) {
Expand Down
7 changes: 3 additions & 4 deletions contracts/interfaces/IGovernment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ interface IGovernment {
function isCandidate(address _verifyAddress) external view returns (bool);

// Returns the number of votes for the candidate passed in the argument.
function numberOfVotes(address _candidateAddress)
external
view
returns (uint256);
function numberOfVotes(
address _candidateAddress
) external view returns (uint256);

// A citizen can vote to candidate.
// ATTENTION: Revert transaction if the caller have already voted or abstained.
Expand Down
4 changes: 3 additions & 1 deletion contracts/interfaces/IMedical.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ interface IMedical {
function register(string memory _name, string memory _bloodType) external;

// Returns the patient's medical data.
function getMedicalData(address _patientAddress)
function getMedicalData(
address _patientAddress
)
external
view
returns (
Expand Down
10 changes: 4 additions & 6 deletions contracts/interfaces/ISocialNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ interface ISocialNetwork {
function getLastPostId() external view returns (uint256);

// Returns the data of the post by its id.
function getPost(uint256 _postId)
function getPost(
uint256 _postId
)
external
view
returns (
string memory message,
uint256 totalLikes,
uint256 time
);
returns (string memory message, uint256 totalLikes, uint256 time);

// Like a post by its id.
function like(uint256 _postId) external;
Expand Down

0 comments on commit be504f5

Please sign in to comment.