Skip to content

Commit

Permalink
fix: add package.json exports field
Browse files Browse the repository at this point in the history
This allows users to use esm `import cfg from
'eslint-plugin-prettier/recommended'
  • Loading branch information
BPScott committed Dec 21, 2023
1 parent 5a51733 commit 134ed69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/slimy-boats-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'eslint-plugin-prettier': patch
---

Add exports mapping to package.json, to allow `import eslintPluginRecommended from 'eslint-plugin-prettier/recommended'` to work as expected.

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.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
"node": "^14.18.0 || >=16.0.0"
},
"main": "eslint-plugin-prettier.js",
"exports": {
".": {
"types": "./eslint-plugin-prettier.d.ts",
"default": "./eslint-plugin-prettier.js"
},
"./recommended": {
"types": "./recommended.d.ts",
"default": "./recommended.js"
}
},
"types": "eslint-plugin-prettier.d.ts",
"files": [
"eslint-plugin-prettier.d.ts",
Expand Down

0 comments on commit 134ed69

Please sign in to comment.