git.delta.rocks / unique-network / refs/commits / 8e1a9b3c3bc4

difftreelog

misk: add prettier configuration for solidity files

Trubnikov Sergey2022-09-13parent: #8c337cf.patch.diff
in: master

7 files changed

modified.maintain/scripts/generate_sol.shdiffbeforeafterboth
--- a/.maintain/scripts/generate_sol.sh
+++ b/.maintain/scripts/generate_sol.sh
@@ -1,11 +1,16 @@
 #!/bin/sh
 set -eu
 
+PRETTIER_CONFIG="$(pwd)""/.prettierrc"
+
 tmp=$(mktemp)
 cargo test --package $PACKAGE -- $NAME --exact --nocapture --ignored | tee $tmp
 raw=$(mktemp --suffix .sol)
 sed -n '/=== SNIP START ===/, /=== SNIP END ===/{ /=== SNIP START ===/! { /=== SNIP END ===/! p } }' $tmp > $raw
+
 formatted=$(mktemp)
-prettier --use-tabs $raw > $formatted
+echo $raw
+echo $formatted
+prettier --config $PRETTIER_CONFIG $raw > $formatted
 
 mv $formatted $OUTPUT
added.prettierignorediffbeforeafterboth
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1 @@
+!**/*.sol
added.prettierrcdiffbeforeafterboth
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,16 @@
+{
+    "useTabs": true,
+    "tabWidth": 2,
+    "singleQuote": true,
+    "trailingComma": "all",
+    "overrides": [
+        {
+            "files": "*.sol",
+            "options": {
+                "singleQuote": false,
+                "printWidth": 120,
+                "explicitTypes": "always"
+            }
+        }
+    ]
+}
\ No newline at end of file
modifiedpallets/unique/src/eth/stubs/CollectionHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/unique/src/eth/stubs/CollectionHelpers.soldiffbeforeafterboth
--- a/pallets/unique/src/eth/stubs/CollectionHelpers.sol
+++ b/pallets/unique/src/eth/stubs/CollectionHelpers.sol
@@ -10,11 +10,7 @@
 }
 
 contract ERC165 is Dummy {
-	function supportsInterface(bytes4 interfaceID)
-		external
-		view
-		returns (bool)
-	{
+	function supportsInterface(bytes4 interfaceID) external view returns (bool) {
 		require(false, stub_error);
 		interfaceID;
 		return true;
@@ -23,10 +19,7 @@
 
 /// @dev inlined interface
 contract CollectionHelpersEvents {
-	event CollectionCreated(
-		address indexed owner,
-		address indexed collectionId
-	);
+	event CollectionCreated(address indexed owner, address indexed collectionId);
 }
 
 /// @title Contract, which allows users to operate with collections
@@ -106,11 +99,7 @@
 	/// @return bool Does the collection exist?
 	/// @dev EVM selector for this function is: 0xc3de1494,
 	///  or in textual repr: isCollectionExist(address)
-	function isCollectionExist(address collectionAddress)
-		public
-		view
-		returns (bool)
-	{
+	function isCollectionExist(address collectionAddress) public view returns (bool) {
 		require(false, stub_error);
 		collectionAddress;
 		dummy;
modifiedtests/src/eth/api/CollectionHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/CollectionHelpers.sol
+++ b/tests/src/eth/api/CollectionHelpers.sol
@@ -14,10 +14,7 @@
 
 /// @dev inlined interface
 interface CollectionHelpersEvents {
-	event CollectionCreated(
-		address indexed owner,
-		address indexed collectionId
-	);
+	event CollectionCreated(address indexed owner, address indexed collectionId);
 }
 
 /// @title Contract, which allows users to operate with collections
@@ -67,8 +64,5 @@
 	/// @return bool Does the collection exist?
 	/// @dev EVM selector for this function is: 0xc3de1494,
 	///  or in textual repr: isCollectionExist(address)
-	function isCollectionExist(address collectionAddress)
-		external
-		view
-		returns (bool);
+	function isCollectionExist(address collectionAddress) external view returns (bool);
 }
modifiedtests/src/eth/fractionalizer/Fractionalizer.soldiffbeforeafterboth

no syntactic changes