Commit 326a2aaa authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: lint

parent de7d5f6e
...@@ -8,7 +8,8 @@ import layoutLock from '../layout-lock.json' ...@@ -8,7 +8,8 @@ import layoutLock from '../layout-lock.json'
* Can be configured as the first argument to the script or * Can be configured as the first argument to the script or
* defaults to the forge-artifacts directory. * defaults to the forge-artifacts directory.
*/ */
const directoryPath = process.argv[2] || path.join(__dirname, '..', 'forge-artifacts'); const directoryPath =
process.argv[2] || path.join(__dirname, '..', 'forge-artifacts')
/** /**
* Returns true if the contract should be skipped when inspecting its storage layout. * Returns true if the contract should be skipped when inspecting its storage layout.
...@@ -30,7 +31,6 @@ const parseFqn = (name: string): string => { ...@@ -30,7 +31,6 @@ const parseFqn = (name: string): string => {
return parts[parts.length - 1] return parts[parts.length - 1]
} }
/** /**
* Parses out variable info from the variable structure in standard compiler json output. * Parses out variable info from the variable structure in standard compiler json output.
* *
...@@ -95,7 +95,7 @@ const main = async () => { ...@@ -95,7 +95,7 @@ const main = async () => {
const paths = [] const paths = []
const readFilesRecursively = (dir: string) => { const readFilesRecursively = (dir: string) => {
const files = fs.readdirSync(dir); const files = fs.readdirSync(dir)
for (const file of files) { for (const file of files) {
const filePath = path.join(dir, file) const filePath = path.join(dir, file)
...@@ -109,13 +109,14 @@ const main = async () => { ...@@ -109,13 +109,14 @@ const main = async () => {
} }
} }
readFilesRecursively(directoryPath); readFilesRecursively(directoryPath)
for (const filePath of paths) { for (const filePath of paths) {
if (filePath.includes('t.sol')) { if (filePath.includes('t.sol')) {
continue continue
} }
const artifact = require(filePath) const raw = fs.readFileSync(filePath, 'utf8').toString()
const artifact = JSON.parse(raw)
// Handle contracts without storage // Handle contracts without storage
const storageLayout = artifact.storageLayout || {} const storageLayout = artifact.storageLayout || {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment