From ac3a006683dde5d1f9dc5b06d8d79859e26dbe56 Mon Sep 17 00:00:00 2001 From: matzkoh Date: Fri, 16 Feb 2024 07:45:55 +0900 Subject: [PATCH] fix: .js to .cjs for compatibility with { "type": "module" } --- lib/{index.js => index.cjs} | 0 lib/index.test.js | 6 +++--- package.json | 2 +- prettier.config.js => prettier.config.cjs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename lib/{index.js => index.cjs} (100%) rename prettier.config.js => prettier.config.cjs (83%) diff --git a/lib/index.js b/lib/index.cjs similarity index 100% rename from lib/index.js rename to lib/index.cjs diff --git a/lib/index.test.js b/lib/index.test.js index 1128489..65b3010 100644 --- a/lib/index.test.js +++ b/lib/index.test.js @@ -40,7 +40,7 @@ describe('format', () => { Promise.resolve( prettier.format(uglyJson, { filepath: 'package.json', - plugins: ['./lib/index.js'], + plugins: ['./lib/index.cjs'], }), ), ).resolves.toMatchSnapshot()) @@ -51,7 +51,7 @@ describe('format', () => { prettier.format(uglyJson, { parser: 'json-stringify', filepath: 'foo.json', - plugins: ['./lib/index.js'], + plugins: ['./lib/index.cjs'], }), ), ).resolves.toBe(uglyJson)) @@ -64,7 +64,7 @@ describe('format', () => { Promise.resolve( prettier.format(uglyJson, { filepath: 'package.json', - plugins: ['./lib/index.js'], + plugins: ['./lib/index.cjs'], }), ), ).resolves.toBe('{}\n') diff --git a/package.json b/package.json index 9ac693a..2f607fb 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ ], "repository": "github:matzkoh/prettier-plugin-packagejson", "license": "MIT", - "main": "lib", + "main": "lib/index.cjs", "directories": { "lib": "lib" }, diff --git a/prettier.config.js b/prettier.config.cjs similarity index 83% rename from prettier.config.js rename to prettier.config.cjs index 0585ffd..55e174c 100644 --- a/prettier.config.js +++ b/prettier.config.cjs @@ -5,5 +5,5 @@ module.exports = { semi: false, singleQuote: true, trailingComma: 'all', - plugins: ['./lib/index.js'], + plugins: ['./lib/index.cjs'], }