Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions e2e/autofix-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const chai = require('chai')
const { expect } = chai
const fs = require('fs-extra')
const fs = require('fs')
const os = require('os')
const path = require('path')
const shell = require('shelljs')
Expand Down Expand Up @@ -566,10 +566,12 @@ function useFixture(dir) {
const tmpDirContainer = os.tmpdir()
this.testDirPath = path.join(tmpDirContainer, `solhint-tests-${dir}`)

fs.ensureDirSync(this.testDirPath)
fs.emptyDirSync(this.testDirPath)
fs.mkdirSync(this.testDirPath, { recursive: true })
for (const entry of fs.readdirSync(this.testDirPath)) {
fs.rmSync(path.join(this.testDirPath, entry), { recursive: true, force: true });
}

fs.copySync(fixturePath, this.testDirPath)
fs.cpSync(fixturePath, this.testDirPath, { recursive: true })

shell.cd(this.testDirPath)
})
Expand Down
10 changes: 6 additions & 4 deletions e2e/formatters-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const chai = require('chai')
const { expect } = chai
const fs = require('fs-extra')
const fs = require('fs')
const shell = require('shelljs')
const url = require('url')
const os = require('os')
Expand Down Expand Up @@ -705,10 +705,12 @@ function useFixture(dir) {
const tmpDirContainer = os.tmpdir()
this.testDirPath = path.join(tmpDirContainer, `solhint-tests-${dir}`)

fs.ensureDirSync(this.testDirPath)
fs.emptyDirSync(this.testDirPath)
fs.mkdirSync(this.testDirPath, { recursive: true })
for (const entry of fs.readdirSync(this.testDirPath)) {
fs.rmSync(path.join(this.testDirPath, entry), { recursive: true, force: true });
}

fs.copySync(fixturePath, this.testDirPath)
fs.cpSync(fixturePath, this.testDirPath, { recursive: true })

shell.cd(this.testDirPath)
})
Expand Down
11 changes: 7 additions & 4 deletions e2e/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { expect } = require('chai')
const cp = require('child_process')
const fs = require('fs-extra')
const fs = require('fs')
const getStream = require('get-stream')
const os = require('os')
const path = require('path')
Expand Down Expand Up @@ -478,9 +478,12 @@ function useFixtureFolder(ctx, dir) {

ctx.testDirPath = testDirPath

fs.ensureDirSync(testDirPath)
fs.emptyDirSync(testDirPath)
fs.copySync(fixturePath, testDirPath)
fs.mkdirSync(testDirPath, { recursive: true })
for (const entry of fs.readdirSync(testDirPath)) {
fs.rmSync(path.join(testDirPath, entry), { recursive: true, force: true });
}

fs.cpSync(fixturePath, testDirPath, { recursive: true })

shell.cd(testDirPath)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/cache/cache-manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const crypto = require('crypto')
const path = require('path')

Expand Down
2 changes: 1 addition & 1 deletion lib/common/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const path = require('path')

const getLocFromIndex = (text, index) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/config/config-file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const path = require('path')
const _ = require('lodash')
const { cosmiconfigSync } = require('cosmiconfig')
Expand Down
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const path = require('path')
const parser = require('@solidity-parser/parser')
const glob = require('glob')
Expand Down Expand Up @@ -100,7 +100,7 @@ function processFile(file, config, rootDir = process.cwd(), explicitConfigPath)
const { report, updatedCache } = processAndCache(file, finalConfig, cacheState)

if (finalConfig.cache && updatedCache) {
fs.ensureDirSync(path.dirname(cachePath)) // make sure the directory exists
fs.mkdirSync(path.dirname(cachePath), { recursive: true }) // make sure the directory exists
writeCache(cachePath, updatedCache)
}

Expand Down Expand Up @@ -135,7 +135,7 @@ function processPath(pattern, config, rootDir = process.cwd(), explicitConfigPat
}

if (useCache) {
fs.ensureDirSync(path.dirname(cachePath)) // make sure the directory exists
fs.mkdirSync(path.dirname(cachePath), { recursive: true }) // make sure the directory exists
writeCache(cachePath, updatedCache)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/rules/miscellaneous/import-path-check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const path = require('path')
const BaseChecker = require('../base-checker')
const { severityDescription } = require('../../doc/utils')
Expand Down
43 changes: 3 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@solidity-parser/parser": "^0.20.0",
"ajv": "^6.12.6",
"ajv-errors": "^1.0.1",
"better-ajv-errors": "^2.0.2",
"antlr4": "^4.13.1-patch-1",
"ast-parents": "^0.0.1",
"better-ajv-errors": "^2.0.2",
"chalk": "^4.1.2",
"commander": "^10.0.0",
"cosmiconfig": "^8.0.0",
Expand All @@ -60,8 +60,7 @@
"semver": "^7.5.2",
"strip-ansi": "^6.0.1",
"table": "^6.8.1",
"text-table": "^0.2.0",
"fs-extra": "^11.1.0"
"text-table": "^0.2.0"
},
"devDependencies": {
"assert": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-rule-docs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!env node
const fs = require('fs-extra')
const fs = require('fs')
const { exec, mkdir } = require('shelljs')
const semver = require('semver')
const path = require('path')
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-rulesets.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')

const { loadRules } = require('../lib/load-rules')

Expand Down
2 changes: 1 addition & 1 deletion solhint.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
const program = require('commander')
const _ = require('lodash')
const fs = require('fs-extra')
const fs = require('fs')
const process = require('process')
const readline = require('readline')
const chalk = require('chalk')
Expand Down
2 changes: 1 addition & 1 deletion test/common/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const os = require('os')
const path = require('path')

Expand Down
2 changes: 1 addition & 1 deletion test/rules/miscellaneous/config-hierarchy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs-extra')
const fs = require('fs')
const path = require('path')
const os = require('os')
const rimraf = require('rimraf')
Expand Down
2 changes: 1 addition & 1 deletion test/rules/miscellaneous/import-path-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('import-path-check (mocked fs)', () => {
}

beforeEach(() => {
existsStub = sinon.stub(require('fs-extra'), 'existsSync').callsFake((filePath) => {
existsStub = sinon.stub(require('fs'), 'existsSync').callsFake((filePath) => {
return currentFakeFileSystem.has(normalizePath(filePath))
})
})
Expand Down
Loading