Skip to content

Commit 56e2e34

Browse files
authored
feat: migrate to exports field (#306)
1 parent c27e785 commit 56e2e34

File tree

7 files changed

+34
-73
lines changed

7 files changed

+34
-73
lines changed

.changeset/modern-pumpkins-explain.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-config-prettier": minor
3+
---
4+
5+
feat: migrate to exports field

.github/workflows/check.yml

-3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,3 @@ jobs:
4040

4141
- name: Prettier
4242
run: yarn prettier --check .
43-
44-
- name: Build
45-
run: yarn build

package.json

+20-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,26 @@
1010
],
1111
"license": "MIT",
1212
"packageManager": "[email protected]",
13-
"bin": "build/bin/cli.js",
14-
"main": "build/index.js",
15-
"types": "build/index.d.ts",
13+
"bin": "bin/cli.js",
14+
"main": "index.js",
15+
"exports": {
16+
".": {
17+
"types": "./index.d.ts",
18+
"default": "./index.js"
19+
},
20+
"./prettier": {
21+
"types": "./prettier.d.ts",
22+
"default": "./prettier.js"
23+
},
24+
"./package.json": "./package.json"
25+
},
26+
"types": "index.d.ts",
1627
"files": [
17-
"build"
28+
"bin",
29+
"index.d.ts",
30+
"index.js",
31+
"prettier.d.ts",
32+
"prettier.js"
1833
],
1934
"keywords": [
2035
"eslint",
@@ -24,9 +39,8 @@
2439
"prettier"
2540
],
2641
"scripts": {
27-
"build": "node scripts/build.js",
2842
"prettier": "prettier --write .",
29-
"release": "yarn build && clean-pkg-json && changeset publish",
43+
"release": "clean-pkg-json && changeset publish",
3044
"test": "yarn test:prettier && ESLINT_CONFIG_PRETTIER_NO_DEPRECATED=true yarn test:with-env && ESLINT_USE_FLAT_CONFIG=false yarn test:with-env && yarn build",
3145
"test:cli-sanity": "node ./bin/cli.js index.js",
3246
"test:cli-sanity-warning": "node ./bin/cli.js react.js ./bin/cli.js",

prettier.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const rules: Record<string, 0>;

prettier.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
"use strict";
22

3-
module.exports = {
4-
rules: {
5-
// These are safe to use as long as the `"prettier/prettier"` rule from
6-
// eslint-plugin-prettier isn’t enabled.
7-
// These are also included in `"plugin:prettier/recommended"`:
8-
// https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
9-
"arrow-body-style": 0,
10-
"prefer-arrow-callback": 0,
11-
},
3+
exports.rules = {
4+
// These are safe to use as long as the `"prettier/prettier"` rule from
5+
// eslint-plugin-prettier isn’t enabled.
6+
// These are also included in `"plugin:prettier/recommended"`:
7+
// https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
8+
"arrow-body-style": 0,
9+
"prefer-arrow-callback": 0,
1210
};

scripts/build.js

-54
This file was deleted.

yarn.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -2703,7 +2703,7 @@ __metadata:
27032703
peerDependencies:
27042704
eslint: ">=7.0.0"
27052705
bin:
2706-
eslint-config-prettier: build/bin/cli.js
2706+
eslint-config-prettier: bin/cli.js
27072707
languageName: unknown
27082708
linkType: soft
27092709

0 commit comments

Comments
 (0)