Skip to content

Commit

Permalink
Add linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiascaricato committed May 6, 2023
1 parent b2a8587 commit 6fe8fcc
Show file tree
Hide file tree
Showing 9 changed files with 2,268 additions and 1,861 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"browser": true,
"es2022": true,
"node": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"comma-dangle": [2, "always-multiline"],
"quotes": [2, "single", { "avoidEscape": true }]
}
}
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{
"files": "*.sol",
"options": {
"singleQuote": false
}
}
]
}
9 changes: 2 additions & 7 deletions contracts/USDM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract USDM is
uint256 private constant BASE = 1e18;
uint256 public rewardMultiplier;

mapping (address => uint256) private _shares;
mapping(address => uint256) private _shares;
mapping(address => bool) private _blocklist;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => CountersUpgradeable.Counter) private _nonces;
Expand Down Expand Up @@ -260,7 +260,6 @@ contract USDM is
require(!paused(), "Transfers not allowed while paused");
}


/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
Expand Down Expand Up @@ -435,11 +434,7 @@ contract USDM is
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) private {
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");

Expand Down
32 changes: 18 additions & 14 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomiclabs/hardhat-solhint";
import "@nomicfoundation/hardhat-chai-matchers";
import "@openzeppelin/hardhat-upgrades";
import dotenv from "dotenv";
import { HardhatUserConfig } from 'hardhat/config';
import '@nomicfoundation/hardhat-toolbox';
import '@nomicfoundation/hardhat-chai-matchers';
import '@openzeppelin/hardhat-upgrades';
import dotenv from 'dotenv';

dotenv.config();

Expand Down Expand Up @@ -40,11 +39,11 @@ const etherscanConfig = {

const config: HardhatUserConfig = {
solidity: {
version: "0.8.18",
version: '0.8.18',
settings: {
optimizer: {
enabled: true,
runs: 200
runs: 200,
},
},
},
Expand All @@ -62,13 +61,18 @@ const config: HardhatUserConfig = {
// ...(MAINNET_PRIVATE_KEY ? { accounts: [MAINNET_PRIVATE_KEY] } : {}),
// },
hardhat: {
chainId: 1337 // We set 1337 to make interacting with MetaMask simpler
}
chainId: 1337, // We set 1337 to make interacting with MetaMask simpler
},
},
gasReporter: gasReport ? gasReporterConfig : {},
mocha: {
timeout: 120000,
},
};

export default isTestEnv ? {
...config,
...testConfig
} : config;
export default isTestEnv
? {
...config,
...testConfig,
}
: config;
Loading

0 comments on commit 6fe8fcc

Please sign in to comment.