Repository: prettier/plugin-php
Pull request #2247 (2023-09-17 06:21:19)

fix: make `/standalone` entry work with `require()`
## Context
- https://github.com/prettier/plugin-php/issues/2246

## Problem
- closes: https://github.com/prettier/plugin-php/issues/2246 

## Solution

- Added cjs output in rollup config.

```bash
 $  yarn run build
yarn run v1.22.19
$ rollup --config build/rollup.config.js

/home/shuhei/develop/plugin-php/src/index.js → standalone.js, standalone.cjs...
created standalone.js, standalone.cjs in 5.8s
Done in 6.30s.

 $  ls standalone.cjs
.rw-rw-r-- 179k shuhei 17 Sep 15:03 standalone.cjs
```

- fix package.json to include standalone.cjs in package and add export mapping.

example code calling from cjs:

```js
$ vim test.js

const prettier = require("prettier");
const phpPlugin = require("@prettier/plugin-php/standalone.cjs");

(async () => {
  const result = await prettier.format("<?php $a = [1,2,3]; ?>", {
    parser: "php",
    plugins: [phpPlugin],
  });
  console.log(result);
})();

 $  node test.js
<?php $a = [1, 2, 3]; ?>
```

czosel: Thanks for contributing @shufo! This looks like a valid approach to me, but I’d still like to hear from @fisker and/or @loilo before we merge :)
loilo: No objections from my side. I'm not generally a proponent of exposing both ESM and CJS in a package, due to [dual package hazard](https://nodejs.org/api/packages.html#packages_dual_package_hazard), but I don't think Prettier plugins are in particular danger of being subject to that problem.
shufo: Thanks for confirming. I think it may be safe to use the dual package since Prettier also [offers](https://github.com/prettier/prettier/blob/4169dbb871f29023fdb8ed4594c7bb19a758771e/package.json#L18-L19) dual package.

```js
      "require": "./src/index.cjs",
      "default": "./src/index.js"
```


fisker: As I understand, standalone.js supposed to use with prettier standalone version which targets the browser, I don't think the cjs version should named as standalone.cjs.
fisker: I also don't really understand why you are using `require()` instead of `import`, at least `import` is obviously better choice in your example case, since you can use "Top Level Await".
shufo: Sorry, I should describe my use case first.
My use case is to use prettier/plugin-php from standalone version as described in [README.md#WithBundlers](https://github.com/prettier/plugin-php#with-bundlers).

>Remember that even when using a bundler, you still have to use the standalone builds:
```js
import prettier from "prettier/standalone";
import * as prettierPluginPhp from "@prettier/plugin-php/standalone";
```

My final build target is [VSCode Extension ](https://github.com/shufo/vscode-blade-formatter) and VSCode can only use CJS packages. While there is a [solution](https://github.com/prettier/prettier-vscode/pull/3016) to consume ESM packages from VSCode, it is a difficult process. Thus, I require the CJS version of this package.

And If we require a cjs version of this plugin, providing a stand-alone version through a rollup was the quickest and most convenient approach without changing the code base.
That's why I changed the build config and added standalone.cjs to exports in this PR.
fisker: > My final build target is VSCode Extension and VSCode can only use CJS packages. 

That make sense, actually current `standalone.js` is a UMD module, it should be able to `require()`, it doesn't work only because `type: "module"` in package.json makes `.js` treat as module. Maybe we can remove that and rename other `.js` files as `.mjs`?
loilo: > That make sense, actually current `standalone.js` is a UMD module, it should be able to `require()`

I had this thought as well, but didn't have time to do some research earlier.

Shouldn't we be able to just declare the existing `standalone.js` [under the the `"require"` exports key](https://nodejs.org/api/packages.html#conditional-exports)? I haven't done this yet, but from the docs it looks like this should work.
fisker: > Shouldn't we be able to just declare the existing standalone.js under the the "require" exports key?

I don't think that will work. But you can have a test.
fisker: In Prettier we ship package.json without `type`, so the UMD version can use `.js` , other module file uses `.mjs` extension.
loilo: > > Shouldn't we be able to just declare the existing standalone.js under the the "require" exports key?
> 
> I don't think that will work. But you can have a test.

You're right, this doesn't work. Dang it.
fisker: If we don't want bundle files for Node.js, I think

> remove that and rename other .js files as .mjs

is the best choice.
fisker: The another choice is simply rename current `standalone.js` as `standalone.cjs`, that may work but it really odd to have `.cjs` extension for browser. So I still suggest the solution above.
shufo: Thanks @fisker for suggesting the solution.
 
>remove that and rename other .js files as .mjs

This seems to have worked for me as well. Tested in my environment.

- remove `type` from package.json

```bash
 $  cat package.json | grep type
 $  echo $?
1
```

- rename all .js files to .mjs except `standalone.js`

```bash
 $  find -name "*.mjs" . | grep -v node_modules
./jest.config.mjs
./build/rollup.config.mjs
./tests_config/get_engine.mjs
./tests_config/run_spec.mjs
./src/needs-parens.mjs
./src/loc.mjs
./src/comments.mjs
./src/parser.mjs
./src/printer.mjs
./src/clean.mjs
./src/options.mjs
./src/pragma.mjs
./src/util.mjs
./src/index.mjs
./build/shims/buffer.mjs
./build/shims/assert.mjs
./tests/ignore/jsfmt.spec.mjs
./tests/offsetlookup/jsfmt.spec.mjs
./tests/traitalias/jsfmt.spec.mjs
./tests/attributes/jsfmt.spec.mjs
./tests/assign/jsfmt.spec.mjs
./tests/trailing_comma_func/jsfmt.spec.mjs
./tests/array/jsfmt.spec.mjs
./tests/uniontypes/jsfmt.spec.mjs
./tests/propertylookup/jsfmt.spec.mjs
./tests/exit/jsfmt.spec.mjs
./tests/staticlookup/jsfmt.spec.mjs
./tests/newline/jsfmt.spec.mjs
./tests/propertystatement/jsfmt.spec.mjs
./tests/encapsed/jsfmt.spec.mjs
./tests/program/jsfmt.spec.mjs
./tests/trailing_commas/jsfmt.spec.mjs
./tests/identifier-and-reference/jsfmt.spec.mjs
./tests/global/jsfmt.spec.mjs
./tests/include/jsfmt.spec.mjs
./tests/block/jsfmt.spec.mjs
./tests/goto/jsfmt.spec.mjs
./tests/boolean/jsfmt.spec.mjs
./tests/match/jsfmt.spec.mjs
./tests/bin/jsfmt.spec.mjs
./tests/use/jsfmt.spec.mjs
./tests/brace-style/jsfmt.spec.mjs
./tests/trailing_whitespace/jsfmt.spec.mjs
./tests/attributes-trail-comma/jsfmt.spec.mjs
./tests/functions/jsfmt.spec.mjs
./tests/clone/jsfmt.spec.mjs
./tests/shebang/jsfmt.spec.mjs
./tests/preserve_line/jsfmt.spec.mjs
./tests/interface/jsfmt.spec.mjs
./tests/number/jsfmt.spec.mjs
./tests/nullsafepropertylookup/jsfmt.spec.mjs
./tests/string/jsfmt.spec.mjs
./tests/property/jsfmt.spec.mjs
./tests/method/jsfmt.spec.mjs
./tests/for/jsfmt.spec.mjs
./tests/sys/jsfmt.spec.mjs
./tests/halt/jsfmt.spec.mjs
./tests/call/jsfmt.spec.mjs
./tests/while/jsfmt.spec.mjs
./tests/foreach/jsfmt.spec.mjs
./tests/arrowfunc/jsfmt.spec.mjs
./tests/magic/jsfmt.spec.mjs
./tests/formatting/jsfmt.spec.mjs
./tests/return/jsfmt.spec.mjs
./tests/insert-pragma/jsfmt.spec.mjs
./tests/unset/jsfmt.spec.mjs
./tests/enum/jsfmt.spec.mjs
./tests/echo/jsfmt.spec.mjs
./tests/string-single-quote/jsfmt.spec.mjs
./tests/inline/jsfmt.spec.mjs
./tests/isset/jsfmt.spec.mjs
./tests/namespace/jsfmt.spec.mjs
./tests/classconstant/jsfmt.spec.mjs
./tests/traituse/jsfmt.spec.mjs
./tests/require-pragma/jsfmt.spec.mjs
./tests/member_chain/jsfmt.spec.mjs
./tests/cast/jsfmt.spec.mjs
./tests/variadic/jsfmt.spec.mjs
./tests/namedarguments/jsfmt.spec.mjs
./tests/static/jsfmt.spec.mjs
./tests/print/jsfmt.spec.mjs
./tests/intersection-types/jsfmt.spec.mjs
./tests/parameter/jsfmt.spec.mjs
./tests/extensions/jsfmt.spec.mjs
./tests/continue/jsfmt.spec.mjs
./tests/list/jsfmt.spec.mjs
./tests/break/jsfmt.spec.mjs
./tests/traits/jsfmt.spec.mjs
./tests/syntax-error/jsfmt.spec.mjs
./tests/markdown/jsfmt.spec.mjs
./tests/comments/jsfmt.spec.mjs
./tests/statement/jsfmt.spec.mjs
./tests/variable/jsfmt.spec.mjs
./tests/retif/jsfmt.spec.mjs
./tests/declare/jsfmt.spec.mjs
./tests/do/jsfmt.spec.mjs
./tests/yield/jsfmt.spec.mjs
./tests/if/jsfmt.spec.mjs
./tests/eval/jsfmt.spec.mjs
./tests/assignref/jsfmt.spec.mjs
./tests/silent/jsfmt.spec.mjs
./tests/string-double-quote/jsfmt.spec.mjs
./tests/switch/jsfmt.spec.mjs
./tests/kitchen_sink/jsfmt.spec.mjs
./tests/case/jsfmt.spec.mjs
./tests/new/jsfmt.spec.mjs
./tests/constant/jsfmt.spec.mjs
./tests/class/jsfmt.spec.mjs
./tests/closure/jsfmt.spec.mjs
./tests/parens/jsfmt.spec.mjs
./tests/nowdoc/jsfmt.spec.mjs
./tests/empty/jsfmt.spec.mjs
./tests/errors/jsfmt.spec.mjs
./coverage/lcov-report/prettify.mjs
./coverage/lcov-report/block-navigation.mjs
./coverage/lcov-report/sorter.mjs

```

- Passed Test

```bash
 $  yarn run test
yarn run v1.22.19
$ yarn test:node && yarn test:standalone
$ jest
 PASS   test-node  tests/preserve_line/jsfmt.spec.mjs
 PASS   test-node  tests/class/jsfmt.spec.mjs
 PASS   test-node  tests/member_chain/jsfmt.spec.mjs
 PASS   test-node  tests/list/jsfmt.spec.mjs
 PASS   test-node  tests/insert-pragma/jsfmt.spec.mjs
 PASS   test-node  tests/newline/jsfmt.spec.mjs
 PASS   test-node  tests/brace-style/jsfmt.spec.mjs
 PASS   test-node  tests/require-pragma/jsfmt.spec.mjs
 PASS   test-node  tests/nowdoc/jsfmt.spec.mjs
 PASS   test-node  tests/functions/jsfmt.spec.mjs
 PASS   test-node  tests/staticlookup/jsfmt.spec.mjs
 PASS   test-node  tests/array/jsfmt.spec.mjs
 PASS   test-node  tests/declare/jsfmt.spec.mjs
 PASS   test-node  tests/assign/jsfmt.spec.mjs
 PASS   test-node  tests/retif/jsfmt.spec.mjs
 PASS   test-node  tests/identifier-and-reference/jsfmt.spec.mjs
 PASS   test-node  tests/switch/jsfmt.spec.mjs
 PASS   test-node  tests/bin/jsfmt.spec.mjs
 PASS   test-node  tests/case/jsfmt.spec.mjs
 PASS   test-node  tests/encapsed/jsfmt.spec.mjs
 PASS   test-node  tests/new/jsfmt.spec.mjs
 PASS   test-node  tests/return/jsfmt.spec.mjs
 PASS   test-node  tests/number/jsfmt.spec.mjs
 PASS   test-node  tests/match/jsfmt.spec.mjs
 PASS   test-node  tests/echo/jsfmt.spec.mjs
 PASS   test-node  tests/namespace/jsfmt.spec.mjs
 PASS   test-node  tests/offsetlookup/jsfmt.spec.mjs
 PASS   test-node  tests/propertylookup/jsfmt.spec.mjs
 PASS   test-node  tests/trailing_comma_func/jsfmt.spec.mjs
 PASS   test-node  tests/attributes/jsfmt.spec.mjs
 PASS   test-node  tests/closure/jsfmt.spec.mjs
 PASS   test-node  tests/variable/jsfmt.spec.mjs
 PASS   test-node  tests/classconstant/jsfmt.spec.mjs
 PASS   test-node  tests/markdown/jsfmt.spec.mjs
 PASS   test-node  tests/string/jsfmt.spec.mjs
 PASS   test-node  tests/call/jsfmt.spec.mjs
 PASS   test-node  tests/sys/jsfmt.spec.mjs
 PASS   test-node  tests/isset/jsfmt.spec.mjs
 PASS   test-node  tests/print/jsfmt.spec.mjs
 PASS   test-node  tests/ignore/jsfmt.spec.mjs
 PASS   test-node  tests/enum/jsfmt.spec.mjs
 PASS   test-node  tests/shebang/jsfmt.spec.mjs
 PASS   test-node  tests/cast/jsfmt.spec.mjs
 PASS   test-node  tests/namedarguments/jsfmt.spec.mjs
 PASS   test-node  tests/kitchen_sink/jsfmt.spec.mjs
 PASS   test-node  tests/halt/jsfmt.spec.mjs
 PASS   test-node  tests/syntax-error/jsfmt.spec.mjs
 PASS   test-node  tests/exit/jsfmt.spec.mjs
 PASS   test-node  tests/parameter/jsfmt.spec.mjs
 PASS   test-node  tests/silent/jsfmt.spec.mjs
 PASS   test-node  tests/assignref/jsfmt.spec.mjs
 PASS   test-node  tests/if/jsfmt.spec.mjs
 PASS   test-node  tests/inline/jsfmt.spec.mjs
 PASS   test-node  tests/constant/jsfmt.spec.mjs
 PASS   test-node  tests/variadic/jsfmt.spec.mjs
 PASS   test-node  tests/property/jsfmt.spec.mjs
 PASS   test-node  tests/string-double-quote/jsfmt.spec.mjs
 PASS   test-node  tests/yield/jsfmt.spec.mjs
 PASS   test-node  tests/foreach/jsfmt.spec.mjs
 PASS   test-node  tests/magic/jsfmt.spec.mjs
 PASS   test-node  tests/use/jsfmt.spec.mjs
 PASS   test-node  tests/interface/jsfmt.spec.mjs
 PASS   test-node  tests/while/jsfmt.spec.mjs
 PASS   test-node  tests/attributes-trail-comma/jsfmt.spec.mjs
 PASS   test-node  tests/propertystatement/jsfmt.spec.mjs
 PASS   test-node  tests/for/jsfmt.spec.mjs
 PASS   test-node  tests/static/jsfmt.spec.mjs
 PASS   test-node  tests/errors/jsfmt.spec.mjs
 PASS   test-node  tests/trailing_whitespace/jsfmt.spec.mjs
 PASS   test-node  tests/trailing_commas/jsfmt.spec.mjs
 PASS   test-node  tests/nullsafepropertylookup/jsfmt.spec.mjs
 PASS   test-node  tests/clone/jsfmt.spec.mjs
 PASS   test-node  tests/unset/jsfmt.spec.mjs
 PASS   test-node  tests/continue/jsfmt.spec.mjs
 PASS   test-node  tests/arrowfunc/jsfmt.spec.mjs
 PASS   test-node  tests/traits/jsfmt.spec.mjs
 PASS   test-node  tests/break/jsfmt.spec.mjs
 PASS   test-node  tests/uniontypes/jsfmt.spec.mjs
 PASS   test-node  tests/empty/jsfmt.spec.mjs
 PASS   test-node  tests/traituse/jsfmt.spec.mjs
 PASS   test-node  tests/traitalias/jsfmt.spec.mjs
 PASS   test-node  tests/do/jsfmt.spec.mjs
 PASS   test-node  tests/string-single-quote/jsfmt.spec.mjs
 PASS   test-node  tests/eval/jsfmt.spec.mjs
 PASS   test-node  tests/formatting/jsfmt.spec.mjs
 PASS   test-node  tests/intersection-types/jsfmt.spec.mjs
 PASS   test-node  tests/boolean/jsfmt.spec.mjs
 PASS   test-node  tests/program/jsfmt.spec.mjs
 PASS   test-node  tests/block/jsfmt.spec.mjs
 PASS   test-node  tests/goto/jsfmt.spec.mjs
 PASS   test-node  tests/include/jsfmt.spec.mjs
 PASS   test-node  tests/global/jsfmt.spec.mjs
 PASS   test-node  tests/extensions/jsfmt.spec.mjs
 PASS   test-node  tests/statement/jsfmt.spec.mjs
 PASS   test-node  tests/method/jsfmt.spec.mjs
 PASS   test-node  tests/parens/jsfmt.spec.mjs
 PASS   test-node  tests/comments/jsfmt.spec.mjs

Test Suites: 97 passed, 97 total
Tests:       657 passed, 657 total
Snapshots:   656 passed, 656 total
Time:        2.591 s
Ran all test suites.
$ yarn run build && cross-env RUN_STANDALONE_TESTS=true yarn jest
$ rollup --config build/rollup.config.mjs

/home/shuhei/develop/plugin-php/src/index.mjs → standalone.js...
created standalone.js in 4.2s
$ /home/shuhei/develop/plugin-php/node_modules/.bin/jest
 PASS   test-standalone  tests/call/jsfmt.spec.mjs
 PASS   test-standalone  tests/newline/jsfmt.spec.mjs
 PASS   test-standalone  tests/preserve_line/jsfmt.spec.mjs
 PASS   test-standalone  tests/list/jsfmt.spec.mjs
 PASS   test-standalone  tests/class/jsfmt.spec.mjs
 PASS   test-standalone  tests/insert-pragma/jsfmt.spec.mjs
 PASS   test-standalone  tests/nowdoc/jsfmt.spec.mjs
 PASS   test-standalone  tests/member_chain/jsfmt.spec.mjs
 PASS   test-standalone  tests/string/jsfmt.spec.mjs
 PASS   test-standalone  tests/require-pragma/jsfmt.spec.mjs
 PASS   test-standalone  tests/identifier-and-reference/jsfmt.spec.mjs
 PASS   test-standalone  tests/array/jsfmt.spec.mjs
 PASS   test-standalone  tests/brace-style/jsfmt.spec.mjs
 PASS   test-standalone  tests/case/jsfmt.spec.mjs
 PASS   test-standalone  tests/new/jsfmt.spec.mjs
 PASS   test-standalone  tests/retif/jsfmt.spec.mjs
 PASS   test-standalone  tests/parameter/jsfmt.spec.mjs
 PASS   test-standalone  tests/bin/jsfmt.spec.mjs
 PASS   test-standalone  tests/markdown/jsfmt.spec.mjs
 PASS   test-standalone  tests/variable/jsfmt.spec.mjs
 PASS   test-standalone  tests/return/jsfmt.spec.mjs
 PASS   test-standalone  tests/echo/jsfmt.spec.mjs
 PASS   test-standalone  tests/closure/jsfmt.spec.mjs
 PASS   test-standalone  tests/number/jsfmt.spec.mjs
 PASS   test-standalone  tests/cast/jsfmt.spec.mjs
 PASS   test-standalone  tests/offsetlookup/jsfmt.spec.mjs
 PASS   test-standalone  tests/namespace/jsfmt.spec.mjs
 PASS   test-standalone  tests/encapsed/jsfmt.spec.mjs
 PASS   test-standalone  tests/attributes/jsfmt.spec.mjs
 PASS   test-standalone  tests/static/jsfmt.spec.mjs
 PASS   test-standalone  tests/declare/jsfmt.spec.mjs
 PASS   test-standalone  tests/for/jsfmt.spec.mjs
 PASS   test-standalone  tests/assign/jsfmt.spec.mjs
 PASS   test-standalone  tests/staticlookup/jsfmt.spec.mjs
 PASS   test-standalone  tests/halt/jsfmt.spec.mjs
 PASS   test-standalone  tests/inline/jsfmt.spec.mjs
 PASS   test-standalone  tests/propertylookup/jsfmt.spec.mjs
 PASS   test-standalone  tests/classconstant/jsfmt.spec.mjs
 PASS   test-standalone  tests/switch/jsfmt.spec.mjs
 PASS   test-standalone  tests/trailing_comma_func/jsfmt.spec.mjs
 PASS   test-standalone  tests/eval/jsfmt.spec.mjs
 PASS   test-standalone  tests/match/jsfmt.spec.mjs
 PASS   test-standalone  tests/variadic/jsfmt.spec.mjs
 PASS   test-standalone  tests/include/jsfmt.spec.mjs
 PASS   test-standalone  tests/assignref/jsfmt.spec.mjs
 PASS   test-standalone  tests/yield/jsfmt.spec.mjs
 PASS   test-standalone  tests/program/jsfmt.spec.mjs
 PASS   test-standalone  tests/syntax-error/jsfmt.spec.mjs
 PASS   test-standalone  tests/trailing_commas/jsfmt.spec.mjs
 PASS   test-standalone  tests/isset/jsfmt.spec.mjs
 PASS   test-standalone  tests/print/jsfmt.spec.mjs
 PASS   test-standalone  tests/formatting/jsfmt.spec.mjs
 PASS   test-standalone  tests/foreach/jsfmt.spec.mjs
 PASS   test-standalone  tests/errors/jsfmt.spec.mjs
 PASS   test-standalone  tests/exit/jsfmt.spec.mjs
 PASS   test-standalone  tests/enum/jsfmt.spec.mjs
 PASS   test-standalone  tests/magic/jsfmt.spec.mjs
 PASS   test-standalone  tests/interface/jsfmt.spec.mjs
 PASS   test-standalone  tests/trailing_whitespace/jsfmt.spec.mjs
 PASS   test-standalone  tests/namedarguments/jsfmt.spec.mjs
 PASS   test-standalone  tests/use/jsfmt.spec.mjs
 PASS   test-standalone  tests/continue/jsfmt.spec.mjs
 PASS   test-standalone  tests/functions/jsfmt.spec.mjs
 PASS   test-standalone  tests/property/jsfmt.spec.mjs
 PASS   test-standalone  tests/nullsafepropertylookup/jsfmt.spec.mjs
 PASS   test-standalone  tests/uniontypes/jsfmt.spec.mjs
 PASS   test-standalone  tests/if/jsfmt.spec.mjs
 PASS   test-standalone  tests/ignore/jsfmt.spec.mjs
 PASS   test-standalone  tests/traituse/jsfmt.spec.mjs
 PASS   test-standalone  tests/propertystatement/jsfmt.spec.mjs
 PASS   test-standalone  tests/silent/jsfmt.spec.mjs
 PASS   test-standalone  tests/empty/jsfmt.spec.mjs
 PASS   test-standalone  tests/unset/jsfmt.spec.mjs
 PASS   test-standalone  tests/kitchen_sink/jsfmt.spec.mjs
 PASS   test-standalone  tests/shebang/jsfmt.spec.mjs
 PASS   test-standalone  tests/while/jsfmt.spec.mjs
 PASS   test-standalone  tests/traits/jsfmt.spec.mjs
 PASS   test-standalone  tests/sys/jsfmt.spec.mjs
 PASS   test-standalone  tests/constant/jsfmt.spec.mjs
 PASS   test-standalone  tests/string-double-quote/jsfmt.spec.mjs
 PASS   test-standalone  tests/traitalias/jsfmt.spec.mjs
 PASS   test-standalone  tests/intersection-types/jsfmt.spec.mjs
 PASS   test-standalone  tests/do/jsfmt.spec.mjs
 PASS   test-standalone  tests/statement/jsfmt.spec.mjs
 PASS   test-standalone  tests/boolean/jsfmt.spec.mjs
 PASS   test-standalone  tests/goto/jsfmt.spec.mjs
 PASS   test-standalone  tests/arrowfunc/jsfmt.spec.mjs
 PASS   test-standalone  tests/global/jsfmt.spec.mjs
 PASS   test-standalone  tests/block/jsfmt.spec.mjs
 PASS   test-standalone  tests/string-single-quote/jsfmt.spec.mjs
 PASS   test-standalone  tests/extensions/jsfmt.spec.mjs
 PASS   test-standalone  tests/clone/jsfmt.spec.mjs
 PASS   test-standalone  tests/attributes-trail-comma/jsfmt.spec.mjs
 PASS   test-standalone  tests/break/jsfmt.spec.mjs
 PASS   test-standalone  tests/method/jsfmt.spec.mjs
 PASS   test-standalone  tests/parens/jsfmt.spec.mjs
 PASS   test-standalone  tests/comments/jsfmt.spec.mjs

Test Suites: 97 passed, 97 total
Tests:       657 passed, 657 total
Snapshots:   656 passed, 656 total
Time:        2.536 s
Ran all test suites.
Done in 12.09s.
```

- Calling from CJS seems ok

```js
import * as phpPlugin from '@prettier/plugin-php/standalone';
```

```bash
 $  ./bin/blade-formatter.js test.blade.php
@extends('layouts.test')
@section('title', 'This is title')
@section('content')
    <div class=\"someClass\">
        This is content.
    </div>
@endsection·
@if (true)
    @push('some-stack', $some->getContent())
    @section($aSection, $some->content)
    @push('some-stack')
        more
    @endpush
    @prepend($stack->name, 'here we go')
@endif
```

- Calling from ESM is ok

```js
 $  cat package.json | grep type
  "type": "module"

 $  cat test2.js
import prettier from "prettier/standalone";
import * as phpPlugin from "@prettier/plugin-php/standalone";

const result = await prettier.format("<?php $a = [1,2,3]; ?>", {
  parser: "php",
  plugins: [phpPlugin],
});
console.log(result);

 $  node test2.js
<?php $a = [1, 2, 3]; ?>

```

I don't know migrating all .js files to .mjs in this package is the safe way, but I think this seems the clean way to go. 
fisker: > I don't know migrating all .js files to .mjs in this package is the safe way

I think it's safe.
shufo: @czosel @loilo 
Sorry for pinging.
Any update on this pull request?
shufo: If there is no other concerns, I'd appreciate it if this PR merged as fisker approved.
czosel: Sorry about the delay! Thanks for contributing @shufo 

Patch:
diff --git a/.eslintrc.yml b/.eslintrc.yml
index ac20038..e5a44be 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -47,9 +47,9 @@ overrides:
   - files: "**/*.cjs"
     parserOptions:
       sourceType: "script"
-  - files: "tests/**/*.js"
+  - files: "tests/**/*.mjs"
     globals:
       run_spec: true
-  - files: "build/*.js"
+  - files: "build/*.mjs"
     parserOptions:
       sourceType: module
diff --git a/build/rollup.config.js b/build/rollup.config.mjs
similarity index 93%
rename from build/rollup.config.js
rename to build/rollup.config.mjs
index c1c8208..8fa1085 100644
--- a/build/rollup.config.js
+++ b/build/rollup.config.mjs
@@ -12,7 +12,7 @@ import terser from "@rollup/plugin-terser";
 const getPath = (file) => url.fileURLToPath(new URL(file, import.meta.url));
 
 export default {
-  input: getPath("../src/index.js"),
+  input: getPath("../src/index.mjs"),
   output: {
     file: "standalone.js",
     format: "umd",
@@ -32,10 +32,10 @@ export default {
     }),
     commonjs(),
     alias({
-      entries: [{ find: "assert", replacement: getPath("./shims/assert.js") }],
+      entries: [{ find: "assert", replacement: getPath("./shims/assert.mjs") }],
     }),
     inject({
-      Buffer: getPath("./shims/buffer.js"),
+      Buffer: getPath("./shims/buffer.mjs"),
     }),
     replace({
       preventAssignment: true,
diff --git a/build/shims/assert.js b/build/shims/assert.mjs
similarity index 100%
rename from build/shims/assert.js
rename to build/shims/assert.mjs
diff --git a/build/shims/buffer.js b/build/shims/buffer.mjs
similarity index 100%
rename from build/shims/buffer.js
rename to build/shims/buffer.mjs
diff --git a/jest.config.js b/jest.config.mjs
similarity index 70%
rename from jest.config.js
rename to jest.config.mjs
index 686fc9f..41902fa 100644
--- a/jest.config.js
+++ b/jest.config.mjs
@@ -6,14 +6,15 @@ const RUN_STANDALONE_TESTS = Boolean(process.env.RUN_STANDALONE_TESTS);
 export default {
   // collectCoverage: ENABLE_COVERAGE,
   collectCoverageFrom: [
-    "<rootDir>/src/**/*.js",
+    "<rootDir>/src/**/*.mjs",
     "!<rootDir>/node_modules/",
     "!<rootDir>/tests_config/",
   ],
   runner: "jest-light-runner",
   transform: {},
-  setupFiles: ["<rootDir>/tests_config/run_spec.js"],
-  testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
+  setupFiles: ["<rootDir>/tests_config/run_spec.mjs"],
+  // Matches `.js` file to prevent files use `.js` extension by mistake, https://github.com/prettier/plugin-php/pull/2247#discussion_r1331847801
+  testRegex: "jsfmt\\.spec\\.m?js$|__tests__/.*\\.m?js$",
   snapshotSerializers: ["jest-snapshot-serializer-raw"],
   globals: {
     STANDALONE: RUN_STANDALONE_TESTS,
diff --git a/package.json b/package.json
index 64d56a2..43704dd 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,6 @@
   "repository": "prettier/prettier-php",
   "author": "Lucas Azzola <@azz>",
   "license": "MIT",
-  "type": "module",
   "unpkg": "./standalone.js",
   "browser": "./standalone.js",
   "exports": {
@@ -65,8 +64,8 @@
     "test:node": "jest",
     "test:standalone": "yarn run build && cross-env RUN_STANDALONE_TESTS=true yarn jest",
     "prepublishOnly": "yarn test",
-    "prettier": "prettier --plugin=src/index.js --parser=php",
-    "build": "rollup --config build/rollup.config.js",
+    "prettier": "prettier --plugin=src/index.mjs --parser=php",
+    "build": "rollup --config build/rollup.config.mjs",
     "debug": "node --inspect-brk node_modules/.bin/jest --runInBand"
   },
   "c8": {
diff --git a/src/clean.js b/src/clean.mjs
similarity index 97%
rename from src/clean.js
rename to src/clean.mjs
index dca8766..3622417 100644
--- a/src/clean.js
+++ b/src/clean.mjs
@@ -1,4 +1,4 @@
-import { printNumber, normalizeMagicMethodName } from "./util.js";
+import { printNumber, normalizeMagicMethodName } from "./util.mjs";
 
 const ignoredProperties = new Set([
   "loc",
diff --git a/src/comments.js b/src/comments.mjs
similarity index 99%
rename from src/comments.js
rename to src/comments.mjs
index bfa6104..828fc01 100644
--- a/src/comments.js
+++ b/src/comments.mjs
@@ -1,6 +1,6 @@
 import { util as prettierUtil, doc } from "prettier";
-import { isLookupNode } from "./util.js";
-import { locStart, locEnd } from "./loc.js";
+import { isLookupNode } from "./util.mjs";
+import { locStart, locEnd } from "./loc.mjs";
 
 const {
   addLeadingComment,
@@ -830,7 +830,7 @@ function printComment(path, options) {
   return options.printer.printComment(path, options);
 }
 
-// https://github.com/prettier/prettier/blob/master/src/main/comments.js#L440
+// https://github.com/prettier/prettier/blob/6bff776efd0951b7812818d02d1cae3fda184737/src/main/comments/print.js#L119
 function printDanglingComments(path, options, sameIndent, filter) {
   const parts = [];
   const node = path.getValue();
diff --git a/src/index.js b/src/index.mjs
similarity index 93%
rename from src/index.js
rename to src/index.mjs
index 1d90095..3450e96 100644
--- a/src/index.js
+++ b/src/index.mjs
@@ -3,10 +3,10 @@ import {
   LINGUIST_LANGUAGES_PHP,
   LINGUIST_LANGUAGES_HTML_PHP,
 } from "./linguist-languages.cjs";
-import parse from "./parser.js";
-import print from "./printer.js";
-import clean from "./clean.js";
-import options from "./options.js";
+import parse from "./parser.mjs";
+import print from "./printer.mjs";
+import clean from "./clean.mjs";
+import options from "./options.mjs";
 import {
   handleOwnLineComment,
   handleEndOfLineComment,
@@ -14,9 +14,9 @@ import {
   getCommentChildNodes,
   canAttachComment,
   isBlockComment,
-} from "./comments.js";
-import { hasPragma, insertPragma } from "./pragma.js";
-import { locStart, locEnd } from "./loc.js";
+} from "./comments.mjs";
+import { hasPragma, insertPragma } from "./pragma.mjs";
+import { locStart, locEnd } from "./loc.mjs";
 
 const { join, hardline } = doc.builders;
 
diff --git a/src/loc.js b/src/loc.mjs
similarity index 100%
rename from src/loc.js
rename to src/loc.mjs
diff --git a/src/needs-parens.js b/src/needs-parens.mjs
similarity index 99%
rename from src/needs-parens.js
rename to src/needs-parens.mjs
index a4db2cd..00fca2c 100644
--- a/src/needs-parens.js
+++ b/src/needs-parens.mjs
@@ -1,4 +1,4 @@
-import { getPrecedence, shouldFlatten, isBitwiseOperator } from "./util.js";
+import { getPrecedence, shouldFlatten, isBitwiseOperator } from "./util.mjs";
 
 function needsParens(path) {
   const { parent } = path;
diff --git a/src/options.js b/src/options.mjs
similarity index 100%
rename from src/options.js
rename to src/options.mjs
diff --git a/src/parser.js b/src/parser.mjs
similarity index 100%
rename from src/parser.js
rename to src/parser.mjs
diff --git a/src/pragma.js b/src/pragma.mjs
similarity index 98%
rename from src/pragma.js
rename to src/pragma.mjs
index 0647dbd..cb48dc4 100644
--- a/src/pragma.js
+++ b/src/pragma.mjs
@@ -1,5 +1,5 @@
 import memoize from "mem";
-import parse from "./parser.js";
+import parse from "./parser.mjs";
 
 const reHasPragma = /@prettier|@format/;
 
diff --git a/src/printer.js b/src/printer.mjs
similarity index 99%
rename from src/printer.js
rename to src/printer.mjs
index 79a010b..52b940f 100644
--- a/src/printer.js
+++ b/src/printer.mjs
@@ -7,9 +7,9 @@ import {
   printComments,
   isBlockComment,
   hasLeadingOwnLineComment,
-} from "./comments.js";
-import pathNeedsParens from "./needs-parens.js";
-import { locStart, locEnd } from "./loc.js";
+} from "./comments.mjs";
+import pathNeedsParens from "./needs-parens.mjs";
+import { locStart, locEnd } from "./loc.mjs";
 
 import {
   getLast,
@@ -36,7 +36,7 @@ import {
   getAncestorNode,
   isReferenceLikeNode,
   normalizeMagicMethodName,
-} from "./util.js";
+} from "./util.mjs";
 
 const {
   breakParent,
@@ -1753,7 +1753,7 @@ function printNode(path, options, print) {
       if (node.value) {
         return group([
           name,
-          // see handleFunctionParameter() in ./comments.js - since there's
+          // see handleFunctionParameter() in ./comments.mjs - since there's
           // no node to attach comments that fall in between the parameter name
           // and value, we store them as dangling comments
           hasDanglingComments(node) ? " " : "",
diff --git a/src/util.js b/src/util.mjs
similarity index 99%
rename from src/util.js
rename to src/util.mjs
index 513889e..f54e9af 100644
--- a/src/util.js
+++ b/src/util.mjs
@@ -1,5 +1,5 @@
 import { util as prettierUtil } from "prettier";
-import { locStart } from "./loc.js";
+import { locStart } from "./loc.mjs";
 
 const { hasNewline, skipEverythingButNewLine, skipNewline } = prettierUtil;
 


Test patch:
diff --git a/tests/array/__snapshots__/jsfmt.spec.js.snap b/tests/array/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/array/__snapshots__/jsfmt.spec.js.snap
rename to tests/array/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/array/jsfmt.spec.js b/tests/array/jsfmt.spec.mjs
similarity index 100%
rename from tests/array/jsfmt.spec.js
rename to tests/array/jsfmt.spec.mjs
diff --git a/tests/arrowfunc/__snapshots__/jsfmt.spec.js.snap b/tests/arrowfunc/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/arrowfunc/__snapshots__/jsfmt.spec.js.snap
rename to tests/arrowfunc/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/arrowfunc/jsfmt.spec.js b/tests/arrowfunc/jsfmt.spec.mjs
similarity index 100%
rename from tests/arrowfunc/jsfmt.spec.js
rename to tests/arrowfunc/jsfmt.spec.mjs
diff --git a/tests/assign/__snapshots__/jsfmt.spec.js.snap b/tests/assign/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/assign/__snapshots__/jsfmt.spec.js.snap
rename to tests/assign/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/assign/jsfmt.spec.js b/tests/assign/jsfmt.spec.mjs
similarity index 100%
rename from tests/assign/jsfmt.spec.js
rename to tests/assign/jsfmt.spec.mjs
diff --git a/tests/assignref/__snapshots__/jsfmt.spec.js.snap b/tests/assignref/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/assignref/__snapshots__/jsfmt.spec.js.snap
rename to tests/assignref/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/assignref/jsfmt.spec.js b/tests/assignref/jsfmt.spec.mjs
similarity index 100%
rename from tests/assignref/jsfmt.spec.js
rename to tests/assignref/jsfmt.spec.mjs
diff --git a/tests/attributes-trail-comma/__snapshots__/jsfmt.spec.js.snap b/tests/attributes-trail-comma/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/attributes-trail-comma/__snapshots__/jsfmt.spec.js.snap
rename to tests/attributes-trail-comma/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/attributes-trail-comma/jsfmt.spec.js b/tests/attributes-trail-comma/jsfmt.spec.mjs
similarity index 100%
rename from tests/attributes-trail-comma/jsfmt.spec.js
rename to tests/attributes-trail-comma/jsfmt.spec.mjs
diff --git a/tests/attributes/__snapshots__/jsfmt.spec.js.snap b/tests/attributes/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/attributes/__snapshots__/jsfmt.spec.js.snap
rename to tests/attributes/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/attributes/jsfmt.spec.js b/tests/attributes/jsfmt.spec.mjs
similarity index 100%
rename from tests/attributes/jsfmt.spec.js
rename to tests/attributes/jsfmt.spec.mjs
diff --git a/tests/bin/__snapshots__/jsfmt.spec.js.snap b/tests/bin/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/bin/__snapshots__/jsfmt.spec.js.snap
rename to tests/bin/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/bin/jsfmt.spec.js b/tests/bin/jsfmt.spec.mjs
similarity index 100%
rename from tests/bin/jsfmt.spec.js
rename to tests/bin/jsfmt.spec.mjs
diff --git a/tests/block/__snapshots__/jsfmt.spec.js.snap b/tests/block/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/block/__snapshots__/jsfmt.spec.js.snap
rename to tests/block/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/block/jsfmt.spec.js b/tests/block/jsfmt.spec.mjs
similarity index 100%
rename from tests/block/jsfmt.spec.js
rename to tests/block/jsfmt.spec.mjs
diff --git a/tests/boolean/__snapshots__/jsfmt.spec.js.snap b/tests/boolean/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/boolean/__snapshots__/jsfmt.spec.js.snap
rename to tests/boolean/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/boolean/jsfmt.spec.js b/tests/boolean/jsfmt.spec.mjs
similarity index 100%
rename from tests/boolean/jsfmt.spec.js
rename to tests/boolean/jsfmt.spec.mjs
diff --git a/tests/brace-style/__snapshots__/jsfmt.spec.js.snap b/tests/brace-style/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/brace-style/__snapshots__/jsfmt.spec.js.snap
rename to tests/brace-style/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/brace-style/jsfmt.spec.js b/tests/brace-style/jsfmt.spec.mjs
similarity index 100%
rename from tests/brace-style/jsfmt.spec.js
rename to tests/brace-style/jsfmt.spec.mjs
diff --git a/tests/break/__snapshots__/jsfmt.spec.js.snap b/tests/break/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/break/__snapshots__/jsfmt.spec.js.snap
rename to tests/break/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/break/jsfmt.spec.js b/tests/break/jsfmt.spec.mjs
similarity index 100%
rename from tests/break/jsfmt.spec.js
rename to tests/break/jsfmt.spec.mjs
diff --git a/tests/call/__snapshots__/jsfmt.spec.js.snap b/tests/call/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/call/__snapshots__/jsfmt.spec.js.snap
rename to tests/call/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/call/jsfmt.spec.js b/tests/call/jsfmt.spec.mjs
similarity index 100%
rename from tests/call/jsfmt.spec.js
rename to tests/call/jsfmt.spec.mjs
diff --git a/tests/case/__snapshots__/jsfmt.spec.js.snap b/tests/case/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/case/__snapshots__/jsfmt.spec.js.snap
rename to tests/case/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/case/jsfmt.spec.js b/tests/case/jsfmt.spec.mjs
similarity index 100%
rename from tests/case/jsfmt.spec.js
rename to tests/case/jsfmt.spec.mjs
diff --git a/tests/cast/__snapshots__/jsfmt.spec.js.snap b/tests/cast/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/cast/__snapshots__/jsfmt.spec.js.snap
rename to tests/cast/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/cast/jsfmt.spec.js b/tests/cast/jsfmt.spec.mjs
similarity index 100%
rename from tests/cast/jsfmt.spec.js
rename to tests/cast/jsfmt.spec.mjs
diff --git a/tests/class/__snapshots__/jsfmt.spec.js.snap b/tests/class/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/class/__snapshots__/jsfmt.spec.js.snap
rename to tests/class/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/class/jsfmt.spec.js b/tests/class/jsfmt.spec.mjs
similarity index 100%
rename from tests/class/jsfmt.spec.js
rename to tests/class/jsfmt.spec.mjs
diff --git a/tests/classconstant/__snapshots__/jsfmt.spec.js.snap b/tests/classconstant/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/classconstant/__snapshots__/jsfmt.spec.js.snap
rename to tests/classconstant/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/classconstant/jsfmt.spec.js b/tests/classconstant/jsfmt.spec.mjs
similarity index 100%
rename from tests/classconstant/jsfmt.spec.js
rename to tests/classconstant/jsfmt.spec.mjs
diff --git a/tests/clone/__snapshots__/jsfmt.spec.js.snap b/tests/clone/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/clone/__snapshots__/jsfmt.spec.js.snap
rename to tests/clone/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/clone/jsfmt.spec.js b/tests/clone/jsfmt.spec.mjs
similarity index 100%
rename from tests/clone/jsfmt.spec.js
rename to tests/clone/jsfmt.spec.mjs
diff --git a/tests/closure/__snapshots__/jsfmt.spec.js.snap b/tests/closure/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/closure/__snapshots__/jsfmt.spec.js.snap
rename to tests/closure/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/closure/jsfmt.spec.js b/tests/closure/jsfmt.spec.mjs
similarity index 100%
rename from tests/closure/jsfmt.spec.js
rename to tests/closure/jsfmt.spec.mjs
diff --git a/tests/comments/__snapshots__/jsfmt.spec.js.snap b/tests/comments/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/comments/__snapshots__/jsfmt.spec.js.snap
rename to tests/comments/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/comments/jsfmt.spec.js b/tests/comments/jsfmt.spec.mjs
similarity index 100%
rename from tests/comments/jsfmt.spec.js
rename to tests/comments/jsfmt.spec.mjs
diff --git a/tests/constant/__snapshots__/jsfmt.spec.js.snap b/tests/constant/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/constant/__snapshots__/jsfmt.spec.js.snap
rename to tests/constant/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/constant/jsfmt.spec.js b/tests/constant/jsfmt.spec.mjs
similarity index 100%
rename from tests/constant/jsfmt.spec.js
rename to tests/constant/jsfmt.spec.mjs
diff --git a/tests/continue/__snapshots__/jsfmt.spec.js.snap b/tests/continue/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/continue/__snapshots__/jsfmt.spec.js.snap
rename to tests/continue/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/continue/jsfmt.spec.js b/tests/continue/jsfmt.spec.mjs
similarity index 100%
rename from tests/continue/jsfmt.spec.js
rename to tests/continue/jsfmt.spec.mjs
diff --git a/tests/declare/__snapshots__/jsfmt.spec.js.snap b/tests/declare/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/declare/__snapshots__/jsfmt.spec.js.snap
rename to tests/declare/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/declare/jsfmt.spec.js b/tests/declare/jsfmt.spec.mjs
similarity index 100%
rename from tests/declare/jsfmt.spec.js
rename to tests/declare/jsfmt.spec.mjs
diff --git a/tests/do/__snapshots__/jsfmt.spec.js.snap b/tests/do/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/do/__snapshots__/jsfmt.spec.js.snap
rename to tests/do/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/do/jsfmt.spec.js b/tests/do/jsfmt.spec.mjs
similarity index 100%
rename from tests/do/jsfmt.spec.js
rename to tests/do/jsfmt.spec.mjs
diff --git a/tests/echo/__snapshots__/jsfmt.spec.js.snap b/tests/echo/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/echo/__snapshots__/jsfmt.spec.js.snap
rename to tests/echo/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/echo/jsfmt.spec.js b/tests/echo/jsfmt.spec.mjs
similarity index 100%
rename from tests/echo/jsfmt.spec.js
rename to tests/echo/jsfmt.spec.mjs
diff --git a/tests/empty/__snapshots__/jsfmt.spec.js.snap b/tests/empty/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/empty/__snapshots__/jsfmt.spec.js.snap
rename to tests/empty/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/empty/jsfmt.spec.js b/tests/empty/jsfmt.spec.mjs
similarity index 100%
rename from tests/empty/jsfmt.spec.js
rename to tests/empty/jsfmt.spec.mjs
diff --git a/tests/encapsed/__snapshots__/jsfmt.spec.js.snap b/tests/encapsed/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/encapsed/__snapshots__/jsfmt.spec.js.snap
rename to tests/encapsed/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/encapsed/jsfmt.spec.js b/tests/encapsed/jsfmt.spec.mjs
similarity index 100%
rename from tests/encapsed/jsfmt.spec.js
rename to tests/encapsed/jsfmt.spec.mjs
diff --git a/tests/enum/__snapshots__/jsfmt.spec.js.snap b/tests/enum/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/enum/__snapshots__/jsfmt.spec.js.snap
rename to tests/enum/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/enum/jsfmt.spec.js b/tests/enum/jsfmt.spec.mjs
similarity index 100%
rename from tests/enum/jsfmt.spec.js
rename to tests/enum/jsfmt.spec.mjs
diff --git a/tests/errors/__snapshots__/jsfmt.spec.js.snap b/tests/errors/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/errors/__snapshots__/jsfmt.spec.js.snap
rename to tests/errors/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/errors/jsfmt.spec.js b/tests/errors/jsfmt.spec.mjs
similarity index 100%
rename from tests/errors/jsfmt.spec.js
rename to tests/errors/jsfmt.spec.mjs
diff --git a/tests/eval/__snapshots__/jsfmt.spec.js.snap b/tests/eval/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/eval/__snapshots__/jsfmt.spec.js.snap
rename to tests/eval/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/eval/jsfmt.spec.js b/tests/eval/jsfmt.spec.mjs
similarity index 100%
rename from tests/eval/jsfmt.spec.js
rename to tests/eval/jsfmt.spec.mjs
diff --git a/tests/exit/__snapshots__/jsfmt.spec.js.snap b/tests/exit/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/exit/__snapshots__/jsfmt.spec.js.snap
rename to tests/exit/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/exit/jsfmt.spec.js b/tests/exit/jsfmt.spec.mjs
similarity index 100%
rename from tests/exit/jsfmt.spec.js
rename to tests/exit/jsfmt.spec.mjs
diff --git a/tests/extensions/__snapshots__/jsfmt.spec.js.snap b/tests/extensions/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/extensions/__snapshots__/jsfmt.spec.js.snap
rename to tests/extensions/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/extensions/jsfmt.spec.js b/tests/extensions/jsfmt.spec.mjs
similarity index 100%
rename from tests/extensions/jsfmt.spec.js
rename to tests/extensions/jsfmt.spec.mjs
diff --git a/tests/for/__snapshots__/jsfmt.spec.js.snap b/tests/for/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/for/__snapshots__/jsfmt.spec.js.snap
rename to tests/for/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/for/jsfmt.spec.js b/tests/for/jsfmt.spec.mjs
similarity index 100%
rename from tests/for/jsfmt.spec.js
rename to tests/for/jsfmt.spec.mjs
diff --git a/tests/foreach/__snapshots__/jsfmt.spec.js.snap b/tests/foreach/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/foreach/__snapshots__/jsfmt.spec.js.snap
rename to tests/foreach/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/foreach/jsfmt.spec.js b/tests/foreach/jsfmt.spec.mjs
similarity index 100%
rename from tests/foreach/jsfmt.spec.js
rename to tests/foreach/jsfmt.spec.mjs
diff --git a/tests/formatting/__snapshots__/jsfmt.spec.js.snap b/tests/formatting/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/formatting/__snapshots__/jsfmt.spec.js.snap
rename to tests/formatting/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/formatting/jsfmt.spec.js b/tests/formatting/jsfmt.spec.mjs
similarity index 100%
rename from tests/formatting/jsfmt.spec.js
rename to tests/formatting/jsfmt.spec.mjs
diff --git a/tests/functions/__snapshots__/jsfmt.spec.js.snap b/tests/functions/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/functions/__snapshots__/jsfmt.spec.js.snap
rename to tests/functions/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/functions/jsfmt.spec.js b/tests/functions/jsfmt.spec.mjs
similarity index 100%
rename from tests/functions/jsfmt.spec.js
rename to tests/functions/jsfmt.spec.mjs
diff --git a/tests/global/__snapshots__/jsfmt.spec.js.snap b/tests/global/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/global/__snapshots__/jsfmt.spec.js.snap
rename to tests/global/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/global/jsfmt.spec.js b/tests/global/jsfmt.spec.mjs
similarity index 100%
rename from tests/global/jsfmt.spec.js
rename to tests/global/jsfmt.spec.mjs
diff --git a/tests/goto/__snapshots__/jsfmt.spec.js.snap b/tests/goto/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/goto/__snapshots__/jsfmt.spec.js.snap
rename to tests/goto/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/goto/jsfmt.spec.js b/tests/goto/jsfmt.spec.mjs
similarity index 100%
rename from tests/goto/jsfmt.spec.js
rename to tests/goto/jsfmt.spec.mjs
diff --git a/tests/halt/__snapshots__/jsfmt.spec.js.snap b/tests/halt/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/halt/__snapshots__/jsfmt.spec.js.snap
rename to tests/halt/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/halt/jsfmt.spec.js b/tests/halt/jsfmt.spec.mjs
similarity index 100%
rename from tests/halt/jsfmt.spec.js
rename to tests/halt/jsfmt.spec.mjs
diff --git a/tests/identifier-and-reference/__snapshots__/jsfmt.spec.js.snap b/tests/identifier-and-reference/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/identifier-and-reference/__snapshots__/jsfmt.spec.js.snap
rename to tests/identifier-and-reference/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/identifier-and-reference/jsfmt.spec.js b/tests/identifier-and-reference/jsfmt.spec.mjs
similarity index 100%
rename from tests/identifier-and-reference/jsfmt.spec.js
rename to tests/identifier-and-reference/jsfmt.spec.mjs
diff --git a/tests/if/__snapshots__/jsfmt.spec.js.snap b/tests/if/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/if/__snapshots__/jsfmt.spec.js.snap
rename to tests/if/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/if/jsfmt.spec.js b/tests/if/jsfmt.spec.mjs
similarity index 100%
rename from tests/if/jsfmt.spec.js
rename to tests/if/jsfmt.spec.mjs
diff --git a/tests/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/ignore/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/ignore/__snapshots__/jsfmt.spec.js.snap
rename to tests/ignore/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/ignore/jsfmt.spec.js b/tests/ignore/jsfmt.spec.mjs
similarity index 100%
rename from tests/ignore/jsfmt.spec.js
rename to tests/ignore/jsfmt.spec.mjs
diff --git a/tests/include/__snapshots__/jsfmt.spec.js.snap b/tests/include/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/include/__snapshots__/jsfmt.spec.js.snap
rename to tests/include/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/include/jsfmt.spec.js b/tests/include/jsfmt.spec.mjs
similarity index 100%
rename from tests/include/jsfmt.spec.js
rename to tests/include/jsfmt.spec.mjs
diff --git a/tests/inline/__snapshots__/jsfmt.spec.js.snap b/tests/inline/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/inline/__snapshots__/jsfmt.spec.js.snap
rename to tests/inline/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/inline/jsfmt.spec.js b/tests/inline/jsfmt.spec.mjs
similarity index 100%
rename from tests/inline/jsfmt.spec.js
rename to tests/inline/jsfmt.spec.mjs
diff --git a/tests/insert-pragma/__snapshots__/jsfmt.spec.js.snap b/tests/insert-pragma/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/insert-pragma/__snapshots__/jsfmt.spec.js.snap
rename to tests/insert-pragma/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/insert-pragma/jsfmt.spec.js b/tests/insert-pragma/jsfmt.spec.mjs
similarity index 100%
rename from tests/insert-pragma/jsfmt.spec.js
rename to tests/insert-pragma/jsfmt.spec.mjs
diff --git a/tests/interface/__snapshots__/jsfmt.spec.js.snap b/tests/interface/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/interface/__snapshots__/jsfmt.spec.js.snap
rename to tests/interface/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/interface/jsfmt.spec.js b/tests/interface/jsfmt.spec.mjs
similarity index 100%
rename from tests/interface/jsfmt.spec.js
rename to tests/interface/jsfmt.spec.mjs
diff --git a/tests/intersection-types/__snapshots__/jsfmt.spec.js.snap b/tests/intersection-types/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/intersection-types/__snapshots__/jsfmt.spec.js.snap
rename to tests/intersection-types/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/intersection-types/jsfmt.spec.js b/tests/intersection-types/jsfmt.spec.mjs
similarity index 100%
rename from tests/intersection-types/jsfmt.spec.js
rename to tests/intersection-types/jsfmt.spec.mjs
diff --git a/tests/isset/__snapshots__/jsfmt.spec.js.snap b/tests/isset/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/isset/__snapshots__/jsfmt.spec.js.snap
rename to tests/isset/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/isset/jsfmt.spec.js b/tests/isset/jsfmt.spec.mjs
similarity index 100%
rename from tests/isset/jsfmt.spec.js
rename to tests/isset/jsfmt.spec.mjs
diff --git a/tests/kitchen_sink/__snapshots__/jsfmt.spec.js.snap b/tests/kitchen_sink/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/kitchen_sink/__snapshots__/jsfmt.spec.js.snap
rename to tests/kitchen_sink/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/kitchen_sink/jsfmt.spec.js b/tests/kitchen_sink/jsfmt.spec.mjs
similarity index 100%
rename from tests/kitchen_sink/jsfmt.spec.js
rename to tests/kitchen_sink/jsfmt.spec.mjs
diff --git a/tests/list/__snapshots__/jsfmt.spec.js.snap b/tests/list/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/list/__snapshots__/jsfmt.spec.js.snap
rename to tests/list/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/list/jsfmt.spec.js b/tests/list/jsfmt.spec.mjs
similarity index 100%
rename from tests/list/jsfmt.spec.js
rename to tests/list/jsfmt.spec.mjs
diff --git a/tests/magic/__snapshots__/jsfmt.spec.js.snap b/tests/magic/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/magic/__snapshots__/jsfmt.spec.js.snap
rename to tests/magic/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/magic/jsfmt.spec.js b/tests/magic/jsfmt.spec.mjs
similarity index 100%
rename from tests/magic/jsfmt.spec.js
rename to tests/magic/jsfmt.spec.mjs
diff --git a/tests/markdown/__snapshots__/jsfmt.spec.js.snap b/tests/markdown/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/markdown/__snapshots__/jsfmt.spec.js.snap
rename to tests/markdown/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/markdown/jsfmt.spec.js b/tests/markdown/jsfmt.spec.mjs
similarity index 100%
rename from tests/markdown/jsfmt.spec.js
rename to tests/markdown/jsfmt.spec.mjs
diff --git a/tests/match/__snapshots__/jsfmt.spec.js.snap b/tests/match/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/match/__snapshots__/jsfmt.spec.js.snap
rename to tests/match/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/match/jsfmt.spec.js b/tests/match/jsfmt.spec.mjs
similarity index 100%
rename from tests/match/jsfmt.spec.js
rename to tests/match/jsfmt.spec.mjs
diff --git a/tests/member_chain/__snapshots__/jsfmt.spec.js.snap b/tests/member_chain/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/member_chain/__snapshots__/jsfmt.spec.js.snap
rename to tests/member_chain/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/member_chain/jsfmt.spec.js b/tests/member_chain/jsfmt.spec.mjs
similarity index 100%
rename from tests/member_chain/jsfmt.spec.js
rename to tests/member_chain/jsfmt.spec.mjs
diff --git a/tests/method/__snapshots__/jsfmt.spec.js.snap b/tests/method/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/method/__snapshots__/jsfmt.spec.js.snap
rename to tests/method/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/method/jsfmt.spec.js b/tests/method/jsfmt.spec.mjs
similarity index 100%
rename from tests/method/jsfmt.spec.js
rename to tests/method/jsfmt.spec.mjs
diff --git a/tests/namedarguments/__snapshots__/jsfmt.spec.js.snap b/tests/namedarguments/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/namedarguments/__snapshots__/jsfmt.spec.js.snap
rename to tests/namedarguments/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/namedarguments/jsfmt.spec.js b/tests/namedarguments/jsfmt.spec.mjs
similarity index 100%
rename from tests/namedarguments/jsfmt.spec.js
rename to tests/namedarguments/jsfmt.spec.mjs
diff --git a/tests/namespace/__snapshots__/jsfmt.spec.js.snap b/tests/namespace/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/namespace/__snapshots__/jsfmt.spec.js.snap
rename to tests/namespace/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/namespace/jsfmt.spec.js b/tests/namespace/jsfmt.spec.mjs
similarity index 100%
rename from tests/namespace/jsfmt.spec.js
rename to tests/namespace/jsfmt.spec.mjs
diff --git a/tests/new/__snapshots__/jsfmt.spec.js.snap b/tests/new/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/new/__snapshots__/jsfmt.spec.js.snap
rename to tests/new/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/new/jsfmt.spec.js b/tests/new/jsfmt.spec.mjs
similarity index 100%
rename from tests/new/jsfmt.spec.js
rename to tests/new/jsfmt.spec.mjs
diff --git a/tests/newline/__snapshots__/jsfmt.spec.js.snap b/tests/newline/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/newline/__snapshots__/jsfmt.spec.js.snap
rename to tests/newline/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/newline/jsfmt.spec.js b/tests/newline/jsfmt.spec.mjs
similarity index 100%
rename from tests/newline/jsfmt.spec.js
rename to tests/newline/jsfmt.spec.mjs
diff --git a/tests/nowdoc/__snapshots__/jsfmt.spec.js.snap b/tests/nowdoc/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/nowdoc/__snapshots__/jsfmt.spec.js.snap
rename to tests/nowdoc/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/nowdoc/jsfmt.spec.js b/tests/nowdoc/jsfmt.spec.mjs
similarity index 100%
rename from tests/nowdoc/jsfmt.spec.js
rename to tests/nowdoc/jsfmt.spec.mjs
diff --git a/tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.js.snap b/tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.js.snap
rename to tests/nullsafepropertylookup/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/nullsafepropertylookup/jsfmt.spec.js b/tests/nullsafepropertylookup/jsfmt.spec.mjs
similarity index 100%
rename from tests/nullsafepropertylookup/jsfmt.spec.js
rename to tests/nullsafepropertylookup/jsfmt.spec.mjs
diff --git a/tests/number/__snapshots__/jsfmt.spec.js.snap b/tests/number/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/number/__snapshots__/jsfmt.spec.js.snap
rename to tests/number/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/number/jsfmt.spec.js b/tests/number/jsfmt.spec.mjs
similarity index 100%
rename from tests/number/jsfmt.spec.js
rename to tests/number/jsfmt.spec.mjs
diff --git a/tests/offsetlookup/__snapshots__/jsfmt.spec.js.snap b/tests/offsetlookup/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/offsetlookup/__snapshots__/jsfmt.spec.js.snap
rename to tests/offsetlookup/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/offsetlookup/jsfmt.spec.js b/tests/offsetlookup/jsfmt.spec.mjs
similarity index 100%
rename from tests/offsetlookup/jsfmt.spec.js
rename to tests/offsetlookup/jsfmt.spec.mjs
diff --git a/tests/parameter/__snapshots__/jsfmt.spec.js.snap b/tests/parameter/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/parameter/__snapshots__/jsfmt.spec.js.snap
rename to tests/parameter/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/parameter/jsfmt.spec.js b/tests/parameter/jsfmt.spec.mjs
similarity index 100%
rename from tests/parameter/jsfmt.spec.js
rename to tests/parameter/jsfmt.spec.mjs
diff --git a/tests/parens/__snapshots__/jsfmt.spec.js.snap b/tests/parens/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/parens/__snapshots__/jsfmt.spec.js.snap
rename to tests/parens/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/parens/jsfmt.spec.js b/tests/parens/jsfmt.spec.mjs
similarity index 100%
rename from tests/parens/jsfmt.spec.js
rename to tests/parens/jsfmt.spec.mjs
diff --git a/tests/preserve_line/__snapshots__/jsfmt.spec.js.snap b/tests/preserve_line/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/preserve_line/__snapshots__/jsfmt.spec.js.snap
rename to tests/preserve_line/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/preserve_line/jsfmt.spec.js b/tests/preserve_line/jsfmt.spec.mjs
similarity index 100%
rename from tests/preserve_line/jsfmt.spec.js
rename to tests/preserve_line/jsfmt.spec.mjs
diff --git a/tests/print/__snapshots__/jsfmt.spec.js.snap b/tests/print/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/print/__snapshots__/jsfmt.spec.js.snap
rename to tests/print/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/print/jsfmt.spec.js b/tests/print/jsfmt.spec.mjs
similarity index 100%
rename from tests/print/jsfmt.spec.js
rename to tests/print/jsfmt.spec.mjs
diff --git a/tests/program/__snapshots__/jsfmt.spec.js.snap b/tests/program/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/program/__snapshots__/jsfmt.spec.js.snap
rename to tests/program/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/program/jsfmt.spec.js b/tests/program/jsfmt.spec.mjs
similarity index 100%
rename from tests/program/jsfmt.spec.js
rename to tests/program/jsfmt.spec.mjs
diff --git a/tests/property/__snapshots__/jsfmt.spec.js.snap b/tests/property/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/property/__snapshots__/jsfmt.spec.js.snap
rename to tests/property/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/property/jsfmt.spec.js b/tests/property/jsfmt.spec.mjs
similarity index 100%
rename from tests/property/jsfmt.spec.js
rename to tests/property/jsfmt.spec.mjs
diff --git a/tests/propertylookup/__snapshots__/jsfmt.spec.js.snap b/tests/propertylookup/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/propertylookup/__snapshots__/jsfmt.spec.js.snap
rename to tests/propertylookup/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/propertylookup/jsfmt.spec.js b/tests/propertylookup/jsfmt.spec.mjs
similarity index 100%
rename from tests/propertylookup/jsfmt.spec.js
rename to tests/propertylookup/jsfmt.spec.mjs
diff --git a/tests/propertystatement/__snapshots__/jsfmt.spec.js.snap b/tests/propertystatement/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/propertystatement/__snapshots__/jsfmt.spec.js.snap
rename to tests/propertystatement/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/propertystatement/jsfmt.spec.js b/tests/propertystatement/jsfmt.spec.mjs
similarity index 100%
rename from tests/propertystatement/jsfmt.spec.js
rename to tests/propertystatement/jsfmt.spec.mjs
diff --git a/tests/require-pragma/__snapshots__/jsfmt.spec.js.snap b/tests/require-pragma/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/require-pragma/__snapshots__/jsfmt.spec.js.snap
rename to tests/require-pragma/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/require-pragma/jsfmt.spec.js b/tests/require-pragma/jsfmt.spec.mjs
similarity index 100%
rename from tests/require-pragma/jsfmt.spec.js
rename to tests/require-pragma/jsfmt.spec.mjs
diff --git a/tests/retif/__snapshots__/jsfmt.spec.js.snap b/tests/retif/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/retif/__snapshots__/jsfmt.spec.js.snap
rename to tests/retif/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/retif/jsfmt.spec.js b/tests/retif/jsfmt.spec.mjs
similarity index 100%
rename from tests/retif/jsfmt.spec.js
rename to tests/retif/jsfmt.spec.mjs
diff --git a/tests/return/__snapshots__/jsfmt.spec.js.snap b/tests/return/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/return/__snapshots__/jsfmt.spec.js.snap
rename to tests/return/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/return/jsfmt.spec.js b/tests/return/jsfmt.spec.mjs
similarity index 100%
rename from tests/return/jsfmt.spec.js
rename to tests/return/jsfmt.spec.mjs
diff --git a/tests/shebang/__snapshots__/jsfmt.spec.js.snap b/tests/shebang/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/shebang/__snapshots__/jsfmt.spec.js.snap
rename to tests/shebang/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/shebang/jsfmt.spec.js b/tests/shebang/jsfmt.spec.mjs
similarity index 100%
rename from tests/shebang/jsfmt.spec.js
rename to tests/shebang/jsfmt.spec.mjs
diff --git a/tests/silent/__snapshots__/jsfmt.spec.js.snap b/tests/silent/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/silent/__snapshots__/jsfmt.spec.js.snap
rename to tests/silent/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/silent/jsfmt.spec.js b/tests/silent/jsfmt.spec.mjs
similarity index 100%
rename from tests/silent/jsfmt.spec.js
rename to tests/silent/jsfmt.spec.mjs
diff --git a/tests/statement/__snapshots__/jsfmt.spec.js.snap b/tests/statement/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/statement/__snapshots__/jsfmt.spec.js.snap
rename to tests/statement/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/statement/jsfmt.spec.js b/tests/statement/jsfmt.spec.mjs
similarity index 100%
rename from tests/statement/jsfmt.spec.js
rename to tests/statement/jsfmt.spec.mjs
diff --git a/tests/static/__snapshots__/jsfmt.spec.js.snap b/tests/static/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/static/__snapshots__/jsfmt.spec.js.snap
rename to tests/static/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/static/jsfmt.spec.js b/tests/static/jsfmt.spec.mjs
similarity index 100%
rename from tests/static/jsfmt.spec.js
rename to tests/static/jsfmt.spec.mjs
diff --git a/tests/staticlookup/__snapshots__/jsfmt.spec.js.snap b/tests/staticlookup/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/staticlookup/__snapshots__/jsfmt.spec.js.snap
rename to tests/staticlookup/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/staticlookup/jsfmt.spec.js b/tests/staticlookup/jsfmt.spec.mjs
similarity index 100%
rename from tests/staticlookup/jsfmt.spec.js
rename to tests/staticlookup/jsfmt.spec.mjs
diff --git a/tests/string-double-quote/__snapshots__/jsfmt.spec.js.snap b/tests/string-double-quote/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/string-double-quote/__snapshots__/jsfmt.spec.js.snap
rename to tests/string-double-quote/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/string-double-quote/jsfmt.spec.js b/tests/string-double-quote/jsfmt.spec.mjs
similarity index 100%
rename from tests/string-double-quote/jsfmt.spec.js
rename to tests/string-double-quote/jsfmt.spec.mjs
diff --git a/tests/string-single-quote/__snapshots__/jsfmt.spec.js.snap b/tests/string-single-quote/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/string-single-quote/__snapshots__/jsfmt.spec.js.snap
rename to tests/string-single-quote/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/string-single-quote/jsfmt.spec.js b/tests/string-single-quote/jsfmt.spec.mjs
similarity index 100%
rename from tests/string-single-quote/jsfmt.spec.js
rename to tests/string-single-quote/jsfmt.spec.mjs
diff --git a/tests/string/__snapshots__/jsfmt.spec.js.snap b/tests/string/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/string/__snapshots__/jsfmt.spec.js.snap
rename to tests/string/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/string/jsfmt.spec.js b/tests/string/jsfmt.spec.mjs
similarity index 100%
rename from tests/string/jsfmt.spec.js
rename to tests/string/jsfmt.spec.mjs
diff --git a/tests/switch/__snapshots__/jsfmt.spec.js.snap b/tests/switch/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/switch/__snapshots__/jsfmt.spec.js.snap
rename to tests/switch/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/switch/jsfmt.spec.js b/tests/switch/jsfmt.spec.mjs
similarity index 100%
rename from tests/switch/jsfmt.spec.js
rename to tests/switch/jsfmt.spec.mjs
diff --git a/tests/syntax-error/__snapshots__/jsfmt.spec.js.snap b/tests/syntax-error/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/syntax-error/__snapshots__/jsfmt.spec.js.snap
rename to tests/syntax-error/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/syntax-error/jsfmt.spec.js b/tests/syntax-error/jsfmt.spec.mjs
similarity index 99%
rename from tests/syntax-error/jsfmt.spec.js
rename to tests/syntax-error/jsfmt.spec.mjs
index b712c6c..ea94a15 100644
--- a/tests/syntax-error/jsfmt.spec.js
+++ b/tests/syntax-error/jsfmt.spec.mjs
@@ -1,4 +1,4 @@
-import { prettier, plugin } from "../../tests_config/get_engine.js";
+import { prettier, plugin } from "../../tests_config/get_engine.mjs";
 import stripAnsi from "strip-ansi";
 
 async function raiseSyntaxError() {
diff --git a/tests/sys/__snapshots__/jsfmt.spec.js.snap b/tests/sys/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/sys/__snapshots__/jsfmt.spec.js.snap
rename to tests/sys/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/sys/jsfmt.spec.js b/tests/sys/jsfmt.spec.mjs
similarity index 100%
rename from tests/sys/jsfmt.spec.js
rename to tests/sys/jsfmt.spec.mjs
diff --git a/tests/trailing_comma_func/__snapshots__/jsfmt.spec.js.snap b/tests/trailing_comma_func/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/trailing_comma_func/__snapshots__/jsfmt.spec.js.snap
rename to tests/trailing_comma_func/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/trailing_comma_func/jsfmt.spec.js b/tests/trailing_comma_func/jsfmt.spec.mjs
similarity index 100%
rename from tests/trailing_comma_func/jsfmt.spec.js
rename to tests/trailing_comma_func/jsfmt.spec.mjs
diff --git a/tests/trailing_commas/__snapshots__/jsfmt.spec.js.snap b/tests/trailing_commas/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/trailing_commas/__snapshots__/jsfmt.spec.js.snap
rename to tests/trailing_commas/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/trailing_commas/jsfmt.spec.js b/tests/trailing_commas/jsfmt.spec.mjs
similarity index 100%
rename from tests/trailing_commas/jsfmt.spec.js
rename to tests/trailing_commas/jsfmt.spec.mjs
diff --git a/tests/trailing_whitespace/__snapshots__/jsfmt.spec.js.snap b/tests/trailing_whitespace/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/trailing_whitespace/__snapshots__/jsfmt.spec.js.snap
rename to tests/trailing_whitespace/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/trailing_whitespace/jsfmt.spec.js b/tests/trailing_whitespace/jsfmt.spec.mjs
similarity index 100%
rename from tests/trailing_whitespace/jsfmt.spec.js
rename to tests/trailing_whitespace/jsfmt.spec.mjs
diff --git a/tests/traitalias/__snapshots__/jsfmt.spec.js.snap b/tests/traitalias/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/traitalias/__snapshots__/jsfmt.spec.js.snap
rename to tests/traitalias/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/traitalias/jsfmt.spec.js b/tests/traitalias/jsfmt.spec.mjs
similarity index 100%
rename from tests/traitalias/jsfmt.spec.js
rename to tests/traitalias/jsfmt.spec.mjs
diff --git a/tests/traits/__snapshots__/jsfmt.spec.js.snap b/tests/traits/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/traits/__snapshots__/jsfmt.spec.js.snap
rename to tests/traits/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/traits/jsfmt.spec.js b/tests/traits/jsfmt.spec.mjs
similarity index 100%
rename from tests/traits/jsfmt.spec.js
rename to tests/traits/jsfmt.spec.mjs
diff --git a/tests/traituse/__snapshots__/jsfmt.spec.js.snap b/tests/traituse/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/traituse/__snapshots__/jsfmt.spec.js.snap
rename to tests/traituse/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/traituse/jsfmt.spec.js b/tests/traituse/jsfmt.spec.mjs
similarity index 100%
rename from tests/traituse/jsfmt.spec.js
rename to tests/traituse/jsfmt.spec.mjs
diff --git a/tests/uniontypes/__snapshots__/jsfmt.spec.js.snap b/tests/uniontypes/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/uniontypes/__snapshots__/jsfmt.spec.js.snap
rename to tests/uniontypes/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/uniontypes/jsfmt.spec.js b/tests/uniontypes/jsfmt.spec.mjs
similarity index 100%
rename from tests/uniontypes/jsfmt.spec.js
rename to tests/uniontypes/jsfmt.spec.mjs
diff --git a/tests/unset/__snapshots__/jsfmt.spec.js.snap b/tests/unset/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/unset/__snapshots__/jsfmt.spec.js.snap
rename to tests/unset/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/unset/jsfmt.spec.js b/tests/unset/jsfmt.spec.mjs
similarity index 100%
rename from tests/unset/jsfmt.spec.js
rename to tests/unset/jsfmt.spec.mjs
diff --git a/tests/use/__snapshots__/jsfmt.spec.js.snap b/tests/use/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/use/__snapshots__/jsfmt.spec.js.snap
rename to tests/use/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/use/jsfmt.spec.js b/tests/use/jsfmt.spec.mjs
similarity index 100%
rename from tests/use/jsfmt.spec.js
rename to tests/use/jsfmt.spec.mjs
diff --git a/tests/variable/__snapshots__/jsfmt.spec.js.snap b/tests/variable/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/variable/__snapshots__/jsfmt.spec.js.snap
rename to tests/variable/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/variable/jsfmt.spec.js b/tests/variable/jsfmt.spec.mjs
similarity index 100%
rename from tests/variable/jsfmt.spec.js
rename to tests/variable/jsfmt.spec.mjs
diff --git a/tests/variadic/__snapshots__/jsfmt.spec.js.snap b/tests/variadic/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/variadic/__snapshots__/jsfmt.spec.js.snap
rename to tests/variadic/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/variadic/jsfmt.spec.js b/tests/variadic/jsfmt.spec.mjs
similarity index 100%
rename from tests/variadic/jsfmt.spec.js
rename to tests/variadic/jsfmt.spec.mjs
diff --git a/tests/while/__snapshots__/jsfmt.spec.js.snap b/tests/while/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/while/__snapshots__/jsfmt.spec.js.snap
rename to tests/while/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/while/jsfmt.spec.js b/tests/while/jsfmt.spec.mjs
similarity index 100%
rename from tests/while/jsfmt.spec.js
rename to tests/while/jsfmt.spec.mjs
diff --git a/tests/yield/__snapshots__/jsfmt.spec.js.snap b/tests/yield/__snapshots__/jsfmt.spec.mjs.snap
similarity index 100%
rename from tests/yield/__snapshots__/jsfmt.spec.js.snap
rename to tests/yield/__snapshots__/jsfmt.spec.mjs.snap
diff --git a/tests/yield/jsfmt.spec.js b/tests/yield/jsfmt.spec.mjs
similarity index 100%
rename from tests/yield/jsfmt.spec.js
rename to tests/yield/jsfmt.spec.mjs
diff --git a/tests_config/get_engine.js b/tests_config/get_engine.mjs
similarity index 88%
rename from tests_config/get_engine.js
rename to tests_config/get_engine.mjs
index f8ce99b..fa85a20 100644
--- a/tests_config/get_engine.js
+++ b/tests_config/get_engine.mjs
@@ -2,7 +2,7 @@ import url from "url";
 import { createRequire } from "module";
 import prettierModule from "prettier";
 import prettierStandalone from "prettier/standalone";
-import * as prettierPluginPhp from "../src/index.js";
+import * as prettierPluginPhp from "../src/index.mjs";
 
 const require = createRequire(import.meta.url);
 
diff --git a/tests_config/run_spec.js b/tests_config/run_spec.mjs
similarity index 98%
rename from tests_config/run_spec.js
rename to tests_config/run_spec.mjs
index 4b51da3..9abc3c1 100644
--- a/tests_config/run_spec.js
+++ b/tests_config/run_spec.mjs
@@ -2,7 +2,7 @@ import fs from "fs";
 import path from "path";
 import url from "url";
 import { wrap as raw } from "jest-snapshot-serializer-raw";
-import { prettier, plugin } from "./get_engine.js";
+import { prettier, plugin } from "./get_engine.mjs";
 
 const { AST_COMPARE, TEST_CRLF } = process.env;
 
@@ -29,7 +29,7 @@ global.run_spec = (importMeta, parsers, options) => {
       path.extname(basename) === ".snap" ||
       !fs.lstatSync(filename).isFile() ||
       basename[0] === "." ||
-      basename === "jsfmt.spec.js"
+      basename === "jsfmt.spec.mjs"
     ) {
       return;
     }