Skip to content

Commit

Permalink
feat: migrate to exports field (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin authored Mar 7, 2025
1 parent c27e785 commit 56e2e34
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 73 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-pumpkins-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-config-prettier": minor
---

feat: migrate to exports field
3 changes: 0 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,3 @@ jobs:

- name: Prettier
run: yarn prettier --check .

- name: Build
run: yarn build
26 changes: 20 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@
],
"license": "MIT",
"packageManager": "yarn@4.7.0",
"bin": "build/bin/cli.js",
"main": "build/index.js",
"types": "build/index.d.ts",
"bin": "bin/cli.js",
"main": "index.js",
"exports": {
".": {
"types": "./index.d.ts",
"default": "./index.js"
},
"./prettier": {
"types": "./prettier.d.ts",
"default": "./prettier.js"
},
"./package.json": "./package.json"
},
"types": "index.d.ts",
"files": [
"build"
"bin",
"index.d.ts",
"index.js",
"prettier.d.ts",
"prettier.js"
],
"keywords": [
"eslint",
Expand All @@ -24,9 +39,8 @@
"prettier"
],
"scripts": {
"build": "node scripts/build.js",
"prettier": "prettier --write .",
"release": "yarn build && clean-pkg-json && changeset publish",
"release": "clean-pkg-json && changeset publish",
"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",
"test:cli-sanity": "node ./bin/cli.js index.js",
"test:cli-sanity-warning": "node ./bin/cli.js react.js ./bin/cli.js",
Expand Down
1 change: 1 addition & 0 deletions prettier.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const rules: Record<string, 0>;
16 changes: 7 additions & 9 deletions prettier.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"use strict";

module.exports = {
rules: {
// These are safe to use as long as the `"prettier/prettier"` rule from
// eslint-plugin-prettier isn’t enabled.
// These are also included in `"plugin:prettier/recommended"`:
// https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
"arrow-body-style": 0,
"prefer-arrow-callback": 0,
},
exports.rules = {
// These are safe to use as long as the `"prettier/prettier"` rule from
// eslint-plugin-prettier isn’t enabled.
// These are also included in `"plugin:prettier/recommended"`:
// https://github.com/prettier/eslint-plugin-prettier#recommended-configuration
"arrow-body-style": 0,
"prefer-arrow-callback": 0,
};
54 changes: 0 additions & 54 deletions scripts/build.js

This file was deleted.

2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@ __metadata:
peerDependencies:
eslint: ">=7.0.0"
bin:
eslint-config-prettier: build/bin/cli.js
eslint-config-prettier: bin/cli.js
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 56e2e34

Please sign in to comment.