eslint-config-prettier
Advanced tools
Comparing version 8.10.0 to 9.0.0
@@ -11,6 +11,16 @@ #!/usr/bin/env node | ||
// with no local eslint-config-prettier installation. | ||
const { ESLint } = require(require.resolve("eslint", { | ||
paths: [process.cwd(), ...require.resolve.paths("eslint")], | ||
})); | ||
const localRequire = (request) => | ||
require(require.resolve(request, { | ||
paths: [process.cwd(), ...require.resolve.paths("eslint")], | ||
})); | ||
let experimentalApi = {}; | ||
try { | ||
experimentalApi = localRequire("eslint/use-at-your-own-risk"); | ||
// eslint-disable-next-line unicorn/prefer-optional-catch-binding | ||
} catch (_error) {} | ||
const { ESLint, FlatESLint = experimentalApi.FlatESLint } = | ||
localRequire("eslint"); | ||
const SPECIAL_RULES_URL = | ||
@@ -31,4 +41,23 @@ "https://github.com/prettier/eslint-config-prettier#special-rules"; | ||
const eslint = new ESLint(); | ||
const flatESLint = FlatESLint === undefined ? undefined : new FlatESLint(); | ||
Promise.all(args.map((file) => eslint.calculateConfigForFile(file))) | ||
Promise.all( | ||
args.map((file) => { | ||
switch (process.env.ESLINT_USE_FLAT_CONFIG) { | ||
case "true": { | ||
return flatESLint.calculateConfigForFile(file); | ||
} | ||
case "false": { | ||
return eslint.calculateConfigForFile(file); | ||
} | ||
default: { | ||
// This turns synchronous errors (such as `.calculateConfigForFile` not existing) | ||
// and turns them into promise rejections. | ||
return Promise.resolve() | ||
.then(() => flatESLint.calculateConfigForFile(file)) | ||
.catch(() => eslint.calculateConfigForFile(file)); | ||
} | ||
} | ||
}) | ||
) | ||
.then((configs) => { | ||
@@ -35,0 +64,0 @@ const rules = configs.flatMap(({ rules }, index) => |
@@ -80,3 +80,2 @@ "use strict"; | ||
"template-tag-spacing": "off", | ||
"unicode-bom": "off", | ||
"wrap-iife": "off", | ||
@@ -83,0 +82,0 @@ "wrap-regex": "off", |
{ | ||
"name": "eslint-config-prettier", | ||
"version": "8.10.0", | ||
"version": "9.0.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Simon Lydell", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
20758
499
4