diff --git a/.eslintrc.js b/.eslintrc.js index d745936ef..ec35821c5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -177,6 +177,7 @@ module.exports = { rules: { 'n/no-process-exit': 'off', 'n/no-missing-require': 'off', // `require` of `elm.json`. + 'n/no-extraneous-require': ['error', {allowModules: ['fs-extra']}], '@typescript-eslint/ban-ts-comment': 'off' // `require` of `elm.json`. } }, diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 63b8ed864..2ae767b12 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -51,9 +51,6 @@ updates: - dependency-name: 'eslint-plugin-unicorn' update-types: - version-update:semver-major - - dependency-name: 'glob' - update-types: - - version-update:semver-major - dependency-name: 'which' update-types: - version-update:semver-major diff --git a/lib/elm-files.js b/lib/elm-files.js index d39112613..011127720 100644 --- a/lib/elm-files.js +++ b/lib/elm-files.js @@ -5,7 +5,7 @@ */ const path = require('node:path'); const chalk = require('chalk'); -const {glob} = require('glob'); +const {glob} = require('tinyglobby'); const Anonymize = require('./anonymize'); const Benchmark = require('./benchmark'); const Cache = require('./cache'); @@ -308,9 +308,9 @@ async function findForCliArguments(directory, path_) { // For finding files when `directory` is a direct Elm file, like "src/File.elm" return { files: await glob(path_, { - nocase: true, + caseSensitiveMatch: false, ignore: globIgnore, - nodir: true + onlyFiles: false }), directory }; @@ -342,9 +342,9 @@ async function findForCliArguments(directory, path_) { async function findFromFolder(directory, path_) { return { files: await glob(`${path_}/**/*.elm`, { - nocase: true, + caseSensitiveMatch: false, ignore: globIgnore, - nodir: false + onlyFiles: false }), directory }; diff --git a/lib/new-package.js b/lib/new-package.js index e4c02c394..d61823bfd 100644 --- a/lib/new-package.js +++ b/lib/new-package.js @@ -465,8 +465,8 @@ function packageJson(options, packageName) { 'elm-test': '^0.19.1-revision10', 'elm-tooling': '^1.13.1', 'fs-extra': '^9.0.0', - glob: '^9.3.1', - 'npm-run-all': '^4.1.5' + 'npm-run-all': '^4.1.5', + tinyglobby: '^0.2.10' } }; } diff --git a/lib/new-rule.js b/lib/new-rule.js index 4a0be5d4c..11de10190 100644 --- a/lib/new-rule.js +++ b/lib/new-rule.js @@ -4,9 +4,9 @@ */ const path = require('node:path'); const chalk = require('chalk'); -const {glob} = require('glob'); const fs = require('graceful-fs'); const prompts = require('prompts'); +const {globSync} = require('tinyglobby'); const ErrorMessage = require('./error-message'); const FS = require('./fs-wrapper'); const OsHelpers = require('./os-helpers'); @@ -234,12 +234,12 @@ async function addRule(options, elmJson, ruleName, ruleType) { } } - const globbed = glob.sync( + const globbed = globSync( OsHelpers.makePathOsAgnostic(`${dir}/preview*/**/elm.json`), { - nocase: true, + caseSensitiveMatch: false, ignore: ['**/elm-stuff/**'], - nodir: false + onlyFiles: false } ); diff --git a/lib/suppressed-errors.js b/lib/suppressed-errors.js index c48161353..f744cb7ad 100644 --- a/lib/suppressed-errors.js +++ b/lib/suppressed-errors.js @@ -6,7 +6,7 @@ const childProcess = require('node:child_process'); const path = require('node:path'); const chalk = require('chalk'); -const {glob} = require('glob'); +const {glob} = require('tinyglobby'); const exit = require('../vendor/exit'); const ErrorMessage = require('./error-message'); const FS = require('./fs-wrapper'); @@ -139,9 +139,9 @@ async function read(options) { `${options.suppressedErrorsFolder()}/**/*.json` ); let files = await glob(pattern, { - nocase: true, + caseSensitiveMatch: false, ignore: ['**/elm-stuff/**'], - nodir: false + onlyFiles: false }); if (options.rulesFilter) { diff --git a/new-package/elm-review-package-tests/helpers/find-configurations.js b/new-package/elm-review-package-tests/helpers/find-configurations.js index 7e92a6bd6..ba46e3b16 100644 --- a/new-package/elm-review-package-tests/helpers/find-configurations.js +++ b/new-package/elm-review-package-tests/helpers/find-configurations.js @@ -1,5 +1,5 @@ const path = require('node:path'); -const {glob} = require('glob'); +const {globSync} = require('tinyglobby'); const root = path .resolve(__dirname, '../../') @@ -10,12 +10,10 @@ const root = path * @returns {string[]} */ function findPreviewConfigurations() { - return glob - .sync(`${root}/preview*/**/elm.json`, { - ignore: ['**/elm-stuff/**'], - nodir: true - }) - .map((val) => path.dirname(val)); + return globSync(`${root}/preview*/**/elm.json`, { + ignore: ['**/elm-stuff/**'], + onlyFiles: false + }).map((val) => path.dirname(val)); } module.exports = { diff --git a/package.json b/package.json index 4b3cc753e..4245eaf20 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "fastest-levenshtein": "^1.0.16", "find-up": "^4.1.0 || ^5.0.0", "folder-hash": "^3.3.0", - "glob": "^10.2.6", "got": "^11.8.5", "graceful-fs": "^4.2.11", "minimist": "^1.2.6", diff --git a/test/run-snapshots/elm-review-something-for-new-rule/elm-review-package-tests/helpers/find-configurations.js b/test/run-snapshots/elm-review-something-for-new-rule/elm-review-package-tests/helpers/find-configurations.js index 7e92a6bd6..ba46e3b16 100644 --- a/test/run-snapshots/elm-review-something-for-new-rule/elm-review-package-tests/helpers/find-configurations.js +++ b/test/run-snapshots/elm-review-something-for-new-rule/elm-review-package-tests/helpers/find-configurations.js @@ -1,5 +1,5 @@ const path = require('node:path'); -const {glob} = require('glob'); +const {globSync} = require('tinyglobby'); const root = path .resolve(__dirname, '../../') @@ -10,12 +10,10 @@ const root = path * @returns {string[]} */ function findPreviewConfigurations() { - return glob - .sync(`${root}/preview*/**/elm.json`, { - ignore: ['**/elm-stuff/**'], - nodir: true - }) - .map((val) => path.dirname(val)); + return globSync(`${root}/preview*/**/elm.json`, { + ignore: ['**/elm-stuff/**'], + onlyFiles: false + }).map((val) => path.dirname(val)); } module.exports = { diff --git a/test/run-snapshots/elm-review-something-for-new-rule/package.json b/test/run-snapshots/elm-review-something-for-new-rule/package.json index f3024db52..c97b839bf 100644 --- a/test/run-snapshots/elm-review-something-for-new-rule/package.json +++ b/test/run-snapshots/elm-review-something-for-new-rule/package.json @@ -19,8 +19,8 @@ "elm-test": "^0.19.1-revision10", "elm-tooling": "^1.13.1", "fs-extra": "^9.0.0", - "glob": "^9.3.1", - "npm-run-all": "^4.1.5" + "npm-run-all": "^4.1.5", + "tinyglobby": "^0.2.10" }, "license": "BSD-3-Clause" } \ No newline at end of file diff --git a/test/run-snapshots/elm-review-something/elm-review-package-tests/helpers/find-configurations.js b/test/run-snapshots/elm-review-something/elm-review-package-tests/helpers/find-configurations.js index 7e92a6bd6..ba46e3b16 100644 --- a/test/run-snapshots/elm-review-something/elm-review-package-tests/helpers/find-configurations.js +++ b/test/run-snapshots/elm-review-something/elm-review-package-tests/helpers/find-configurations.js @@ -1,5 +1,5 @@ const path = require('node:path'); -const {glob} = require('glob'); +const {globSync} = require('tinyglobby'); const root = path .resolve(__dirname, '../../') @@ -10,12 +10,10 @@ const root = path * @returns {string[]} */ function findPreviewConfigurations() { - return glob - .sync(`${root}/preview*/**/elm.json`, { - ignore: ['**/elm-stuff/**'], - nodir: true - }) - .map((val) => path.dirname(val)); + return globSync(`${root}/preview*/**/elm.json`, { + ignore: ['**/elm-stuff/**'], + onlyFiles: false + }).map((val) => path.dirname(val)); } module.exports = { diff --git a/test/run-snapshots/elm-review-something/package.json b/test/run-snapshots/elm-review-something/package.json index f3024db52..c97b839bf 100644 --- a/test/run-snapshots/elm-review-something/package.json +++ b/test/run-snapshots/elm-review-something/package.json @@ -19,8 +19,8 @@ "elm-test": "^0.19.1-revision10", "elm-tooling": "^1.13.1", "fs-extra": "^9.0.0", - "glob": "^9.3.1", - "npm-run-all": "^4.1.5" + "npm-run-all": "^4.1.5", + "tinyglobby": "^0.2.10" }, "license": "BSD-3-Clause" } \ No newline at end of file