diff --git a/.eslintrc.js b/.eslintrc.js index 796226a..b18364b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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"] }, diff --git a/contracts/Government.sol b/contracts/Government.sol index 032be5b..228bcb0 100644 --- a/contracts/Government.sol +++ b/contracts/Government.sol @@ -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; diff --git a/contracts/Medical.sol b/contracts/Medical.sol index ef0728b..557dc03 100644 --- a/contracts/Medical.sol +++ b/contracts/Medical.sol @@ -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); @@ -75,7 +76,9 @@ contract Medical is IMedical { _doctorAddressToName[_doctorAddress] = _name; //医師の名前をマッピングで登録 } - function getMedicalData(address _patientAddress) + function getMedicalData( + address _patientAddress + ) external view returns ( @@ -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; @@ -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; diff --git a/contracts/SocialNetwork.sol b/contracts/SocialNetwork.sol index ed7d5d0..e0e8e88 100644 --- a/contracts/SocialNetwork.sol +++ b/contracts/SocialNetwork.sol @@ -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) { diff --git a/contracts/interfaces/IGovernment.sol b/contracts/interfaces/IGovernment.sol index a447d69..ae954ef 100644 --- a/contracts/interfaces/IGovernment.sol +++ b/contracts/interfaces/IGovernment.sol @@ -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. diff --git a/contracts/interfaces/IMedical.sol b/contracts/interfaces/IMedical.sol index 1f49150..080105e 100644 --- a/contracts/interfaces/IMedical.sol +++ b/contracts/interfaces/IMedical.sol @@ -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 ( diff --git a/contracts/interfaces/ISocialNetwork.sol b/contracts/interfaces/ISocialNetwork.sol index 97bed4f..2cdd911 100644 --- a/contracts/interfaces/ISocialNetwork.sol +++ b/contracts/interfaces/ISocialNetwork.sol @@ -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;