From 0d0b1ac58956e902d31278dfdf6652be6ada4227 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Mon, 30 Nov 2020 22:24:24 +0100 Subject: [PATCH] Fix local eslint require --- bin/cli.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/cli.js b/bin/cli.js index e0da87d..9e16cfb 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -4,9 +4,14 @@ const fs = require("fs"); const path = require("path"); -const { ESLint } = require("eslint"); const validators = require("./validators"); +// Require locally installed eslint, for `npx eslint-config-prettier` support +// with no local eslint-config-prettier installation. +const { ESLint } = require(require.resolve("eslint", { + paths: [process.cwd(), ...require.resolve.paths("eslint")], +})); + const SPECIAL_RULES_URL = "https://github.com/prettier/eslint-config-prettier#special-rules";