Skip to content

Commit

Permalink
Merge pull request #148 from ethereum-attestation-service/eslint
Browse files Browse the repository at this point in the history
Upgrade to eslint 9
  • Loading branch information
lbeder authored Aug 8, 2024
2 parents f00a7e1 + 2c5dc50 commit b84f183
Show file tree
Hide file tree
Showing 12 changed files with 1,262 additions and 1,437 deletions.
43 changes: 0 additions & 43 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'

- name: Install Dependencies
Expand Down
3 changes: 2 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"func-visibility": ["error", { "ignoreConstructors": true }],
"func-named-parameters": "off",
"immutable-vars-naming": "off",
"compiler-version": ["error", "^0.8.0"]
"compiler-version": ["error", "^0.8.0"],
"imports-order": "warn"
}
}
2 changes: 0 additions & 2 deletions components/Contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const attachOnly = <F extends ContractFactory>(
};
};

/* eslint-disable camelcase */
const getContracts = (signer?: Signer) => ({
connect: (signer: Signer) => getContracts(signer),

Expand All @@ -102,6 +101,5 @@ const getContracts = (signer?: Signer) => ({
TokenResolver: deployOrAttach(TokenResolver__factory, signer),
ValueResolver: deployOrAttach(ValueResolver__factory, signer)
});
/* eslint-enable camelcase */

export default getContracts();
5 changes: 2 additions & 3 deletions contracts/eip1271/EIP1271Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

pragma solidity 0.8.26;

import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import { SignatureChecker } from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { DeadlineExpired, NO_EXPIRATION_TIME, Signature, InvalidSignature } from "./../Common.sol";

// prettier-ignore
import {
Expand All @@ -14,8 +15,6 @@ import {
RevocationRequestData
} from "../IEAS.sol";

import { DeadlineExpired, NO_EXPIRATION_TIME, Signature, InvalidSignature } from "../Common.sol";

/// @title EIP1271Verifier
/// @notice EIP1271Verifier typed signatures verifier for EAS delegated attestations.
abstract contract EIP1271Verifier is EIP712 {
Expand Down
4 changes: 2 additions & 2 deletions contracts/resolver/ISchemaResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity ^0.8.0;

import { ISemver } from "../ISemver.sol";
import { Attestation } from "../Common.sol";
import { Attestation } from "./../Common.sol";
import { ISemver } from "./../ISemver.sol";

/// @title ISchemaResolver
/// @notice The interface of an optional schema resolver.
Expand Down
7 changes: 3 additions & 4 deletions contracts/resolver/SchemaResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

pragma solidity ^0.8.4;

import { IEAS, Attestation } from "../IEAS.sol";
import { AccessDenied, InvalidEAS, InvalidLength, uncheckedInc } from "../Common.sol";
import { Semver } from "../Semver.sol";

import { AccessDenied, InvalidEAS, InvalidLength, uncheckedInc } from "./../Common.sol";
import { IEAS, Attestation } from "./../IEAS.sol";
import { Semver } from "./../Semver.sol";
import { ISchemaResolver } from "./ISchemaResolver.sol";

/// @title SchemaResolver
Expand Down
5 changes: 2 additions & 3 deletions contracts/tests/TestSchemaResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

pragma solidity 0.8.26;

import { SchemaResolver } from "../resolver/SchemaResolver.sol";

import { IEAS, Attestation } from "../IEAS.sol";
import { IEAS, Attestation } from "./../IEAS.sol";
import { SchemaResolver } from "./../resolver/SchemaResolver.sol";

contract TestSchemaResolver is SchemaResolver {
constructor(IEAS eas) SchemaResolver(eas) {}
Expand Down
52 changes: 52 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import prettier from 'eslint-config-prettier';
import chaiFriendly from 'eslint-plugin-chai-friendly';
import tseslint from 'typescript-eslint';

export default [
...tseslint.configs.recommended,
prettier,
chaiFriendly.configs.recommendedFlat,
{
files: ['**/*.ts'],
rules: {
'max-len': ['error', 150, 2],
camelcase: [
'error',
{
ignoreImports: true
}
],
indent: [
'error',
2,
{
SwitchCase: 1
}
],
semi: ['error', 'always'],
quotes: ['error', 'single', { avoidEscape: true }],
'no-plusplus': 'off',
'no-await-in-loop': 'off',
'no-restricted-syntax': 'off',
'no-continue': 'off',
'arrow-body-style': 'off',
'no-loop-func': 'off',
'no-unused-expressions': 'off',
'chai-friendly/no-unused-expressions': 'error',
'require-await': 'error',
'no-return-await': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-expressions': 'off'
},
languageOptions: {
globals: {
assert: true,
expect: true,
artifacts: true,
contract: true
}
}
}
];
38 changes: 17 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"verify:linea-goerli": "HARDHAT_NETWORK=linea-goerli hardhat etherscan-verify --license MIT --api-url https://api-goerli.lineascan.build",
"lint": "pnpm lint:sol && pnpm lint:ts",
"lint:sol": "solhint --max-warnings 0 contracts/**/*.sol",
"lint:ts": "pnpm eslint components data deploy test utils",
"lint:ts": "pnpm eslint components/**/*.ts data/**/*.ts deploy/**/*.ts scripts/**/*.ts test/**/*.ts utils/**/*.ts",
"format": "prettier --check --write contracts/**/*.sol *.ts components/**/*.ts data/**/*.ts deploy/**/*.ts scripts/**/*.ts test/**/*.ts utils/**/*.ts --config .prettierrc",
"size": "hardhat size-contracts",
"verify": "hardhat verify",
Expand All @@ -100,51 +100,47 @@
"prepare:release": "pnpm prepare && pnpm export-types && pnpm lint && pnpm test"
},
"dependencies": {
"hardhat": "2.22.4"
"hardhat": "2.22.8"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@matterlabs/hardhat-zksync-deploy": "^1.3.0",
"@matterlabs/hardhat-zksync-solc": "^1.1.4",
"@matterlabs/hardhat-zksync-verify": "^1.4.3",
"@nomicfoundation/hardhat-ethers": "^3.0.6",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomiclabs/hardhat-solhint": "^3.1.0",
"@nomiclabs/hardhat-solhint": "^4.0.0",
"@openzeppelin/contracts": "5.0.2",
"@typechain/ethers-v6": "^0.5.1",
"@types/chai": "^4.3.16",
"@types/chai": "^4.3.17",
"@types/chance": "^1.1.6",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@types/mocha": "^10.0.7",
"@types/node": "^22.1.0",
"chai-bigint": "^0.2.0",
"chance": "^1.1.11",
"chance": "^1.1.12",
"copyfiles": "^2.4.1",
"decimal.js": "^10.4.3",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-chai-friendly": "^1.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.7.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"ethereumjs-util": "^7.1.5",
"ethers": "^6.12.1",
"glob": "^10.3.15",
"ethers": "^6.13.2",
"glob": "^11.0.0",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-deploy": "^0.12.4",
"hardhat-deploy-ethers": "^0.4.2",
"mocha": "^10.4.0",
"mocha": "^10.7.0",
"mocha-silent-reporter": "^1.0.0",
"prettier": "^3.2.5",
"prettier": "^3.3.3",
"prettier-package-json": "^2.8.0",
"prettier-plugin-solidity": "^1.3.1",
"solc": "0.8.26",
"solhint": "^5.0.1",
"solhint": "^5.0.3",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.1",
"zksync-ethers": "^6.7.1"
}
}
Loading

0 comments on commit b84f183

Please sign in to comment.