Skip to content

Commit 8210e44

Browse files
authoredDec 21, 2023
fix: add package.json exports field (#623)
This allows users to use esm `import cfg from 'eslint-plugin-prettier/recommended'
1 parent 5a51733 commit 8210e44

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎.changeset/slimy-boats-fold.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'eslint-plugin-prettier': patch
3+
---
4+
5+
Add exports mapping to package.json, to allow `import eslintPluginRecommended from 'eslint-plugin-prettier/recommended'` to work as expected.
6+
7+
Strictly speaking this is a breaking change as it removes the ability for people to import from "eslint-plugin-prettier/eslint-plugin-prettier.js" and "eslint-plugin-prettier/recommended.js" but the former was never recommended in the first place and the latter has only been available for a few days.

‎package.json

+10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
"node": "^14.18.0 || >=16.0.0"
1616
},
1717
"main": "eslint-plugin-prettier.js",
18+
"exports": {
19+
".": {
20+
"types": "./eslint-plugin-prettier.d.ts",
21+
"default": "./eslint-plugin-prettier.js"
22+
},
23+
"./recommended": {
24+
"types": "./recommended.d.ts",
25+
"default": "./recommended.js"
26+
}
27+
},
1828
"types": "eslint-plugin-prettier.d.ts",
1929
"files": [
2030
"eslint-plugin-prettier.d.ts",

0 commit comments

Comments
 (0)
Please sign in to comment.