Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
},
"license": "Apache-2.0",
"dependencies": {
"@babel/generator": "7.17.7",
"@babel/generator": "^7.17.7",
"@babel/parser": "^7.20.5",
"@babel/traverse": "7.23.2",
"@babel/types": "7.17.0",
"javascript-natural-sort": "0.7.1",
"@babel/traverse": "^7.23.2",
"@babel/types": "^7.17.0",
"javascript-natural-sort": "^0.7.1",
"lodash": "^4.17.21"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/utils/__tests__/get-code-from-ast.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import a from 'a';
expect(format(formatted, { parser: 'babel' })).toEqual(
`// first comment
// second comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the point adding new lines ? Is this coming from an IDE formater ?

Copy link
Copy Markdown
Contributor Author

@harryzcy harryzcy Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are generated after @babel/generator >=7.19.x.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 7.19.3 the tests pass, but 7.19.4 they fail. Probably due to this PR: babel/babel#14979

Copy link
Copy Markdown

@marklai1998 marklai1998 Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eldemarkki The PR tagged as 8.0.0-alpha.2 but the changelog saids released under 7.19.4.
Did they just messed up the release?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems its an unvoidable breaking change

import a from "a";
import c from "c";
import g from "g";
Expand Down
1 change: 1 addition & 0 deletions tests/Babel/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function add(a,b) {
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.

import thirdParty from "third-party";
import z from "z";

Expand Down
2 changes: 2 additions & 0 deletions tests/Flow/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export function givesAFoo3Obj(): AliasFoo3 {
/**
* @flow
*/

// I am top level comment in this file.

import thirdParty from "third-party";

import abc from "@core/abc";
Expand Down
5 changes: 5 additions & 0 deletions tests/ImportsNotSeparated/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import React from "react";
import "./commands";

Expand Down Expand Up @@ -131,6 +132,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import thirdParty from "third-party";
import z from "z";
import abc from "@core/abc";
Expand Down Expand Up @@ -245,6 +247,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//@ts-ignore
// I am file top level comments

import a from "a";
import c from "c";
// I am stick to third party comment
Expand Down Expand Up @@ -323,6 +326,7 @@ import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import something from "@server/something";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment

import abc from "@core/abc";
import otherthing from "@core/otherthing";
import something from "@server/something";
Expand Down Expand Up @@ -378,6 +382,7 @@ import './commands';
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";

Expand Down
5 changes: 5 additions & 0 deletions tests/ImportsNotSeparatedRest/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import React from "react";
import "./commands";

Expand Down Expand Up @@ -131,6 +132,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import abc from "@core/abc";
import otherthing from "@core/otherthing";
import qwerty from "@server/qwerty";
Expand Down Expand Up @@ -188,6 +190,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//@ts-ignore
// I am file top level comments

import otherthing from "@core/otherthing";
import something from "@server/something";
import component from "@ui/hello";
Expand Down Expand Up @@ -266,6 +269,7 @@ import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import something from "@server/something";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment

import abc from "@core/abc";
import otherthing from "@core/otherthing";
import something from "@server/something";
Expand Down Expand Up @@ -321,6 +325,7 @@ import './commands';
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";

Expand Down
6 changes: 6 additions & 0 deletions tests/ImportsSeparated/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import React from "react";

import "./commands";
Expand Down Expand Up @@ -136,6 +137,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import thirdParty from "third-party";
import z from "z";

Expand Down Expand Up @@ -196,6 +198,7 @@ const workletAdd = (a:number,b:number) => {
"use client";

// comment after directives

import abc from "@core/abc";
import otherthing from "@core/otherthing";

Expand Down Expand Up @@ -262,6 +265,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//@ts-ignore
// I am file top level comments

import a from "a";
import c from "c";
// I am stick to third party comment
Expand Down Expand Up @@ -347,6 +351,7 @@ import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import something from "@server/something";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment

import abc from "@core/abc";
import otherthing from "@core/otherthing";

Expand Down Expand Up @@ -405,6 +410,7 @@ import './commands';
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";

Expand Down
5 changes: 5 additions & 0 deletions tests/ImportsSeparatedRest/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import React from "react";

import "./commands";
Expand Down Expand Up @@ -136,6 +137,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment in this file.
// I am second line of top level comment in this file.

import abc from "@core/abc";
import otherthing from "@core/otherthing";

Expand Down Expand Up @@ -197,6 +199,7 @@ function add(a:number,b:number) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//@ts-ignore
// I am file top level comments

import otherthing from "@core/otherthing";

import something from "@server/something";
Expand Down Expand Up @@ -282,6 +285,7 @@ import fourLevelRelativePath from "../../../../fourLevelRelativePath";
import something from "@server/something";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// I am top level comment

import abc from "@core/abc";
import otherthing from "@core/otherthing";

Expand Down Expand Up @@ -340,6 +344,7 @@ import './commands';
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import "./commands";

Expand Down
4 changes: 4 additions & 0 deletions tests/Vue/__snapshots__/ppsi.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function add(a,b) {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script setup>
// I am top level comment in this file.

import thirdParty from "third-party";
import { defineComponent } from "vue";
import z from "z";
Expand Down Expand Up @@ -85,6 +86,7 @@ export default defineComponent({
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script>
// I am top level comment in this file.

import thirdParty from "third-party";
import { defineComponent } from "vue";
import z from "z";
Expand Down Expand Up @@ -165,6 +167,7 @@ export default defineComponent({
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script lang="ts">
// I am top level comment in this file.

import thirdParty from "third-party";
import { defineComponent } from "vue";
import z from "z";
Expand Down Expand Up @@ -222,6 +225,7 @@ export default defineComponent({
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script lang="tsx">
// I am top level comment in this file.

import thirdParty from "third-party";
import { defineComponent } from "vue";
import z from "z";
Expand Down
62 changes: 31 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
json5 "^2.2.1"
semver "^6.3.0"

"@babel/generator@7.17.7", "@babel/generator@^7.17.3":
"@babel/generator@^7.17.3":
version "7.17.7"
resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.17.7.tgz"
integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==
Expand All @@ -59,16 +59,7 @@
jsesc "^2.5.1"
source-map "^0.5.0"

"@babel/generator@^7.20.7":
version "7.20.7"
resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.20.7.tgz"
integrity sha512-7wqMOJq8doJMZmP4ApXTzLxSr7+oO2jroJURrVEp6XShrQUObV8Tq/D0NCcoYg2uHqUrjzO0zwBjoYzelxK+sw==
dependencies:
"@babel/types" "^7.20.7"
"@jridgewell/gen-mapping" "^0.3.2"
jsesc "^2.5.1"

"@babel/generator@^7.23.0":
"@babel/generator@^7.17.7", "@babel/generator@^7.23.0":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420"
integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==
Expand All @@ -78,6 +69,15 @@
"@jridgewell/trace-mapping" "^0.3.17"
jsesc "^2.5.1"

"@babel/generator@^7.20.7":
version "7.20.7"
resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.20.7.tgz"
integrity sha512-7wqMOJq8doJMZmP4ApXTzLxSr7+oO2jroJURrVEp6XShrQUObV8Tq/D0NCcoYg2uHqUrjzO0zwBjoYzelxK+sw==
dependencies:
"@babel/types" "^7.20.7"
"@jridgewell/gen-mapping" "^0.3.2"
jsesc "^2.5.1"

"@babel/helper-compilation-targets@^7.20.7":
version "7.20.7"
resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz"
Expand Down Expand Up @@ -340,22 +340,6 @@
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"

"@babel/traverse@7.23.2":
version "7.23.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8"
integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==
dependencies:
"@babel/code-frame" "^7.22.13"
"@babel/generator" "^7.23.0"
"@babel/helper-environment-visitor" "^7.22.20"
"@babel/helper-function-name" "^7.23.0"
"@babel/helper-hoist-variables" "^7.22.5"
"@babel/helper-split-export-declaration" "^7.22.6"
"@babel/parser" "^7.23.0"
"@babel/types" "^7.23.0"
debug "^4.1.0"
globals "^11.1.0"

"@babel/traverse@^7.1.0":
version "7.17.3"
resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.3.tgz"
Expand Down Expand Up @@ -388,7 +372,23 @@
debug "^4.1.0"
globals "^11.1.0"

"@babel/types@7.17.0", "@babel/types@^7.0.0", "@babel/types@^7.17.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3":
"@babel/traverse@^7.23.2":
version "7.23.2"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8"
integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==
dependencies:
"@babel/code-frame" "^7.22.13"
"@babel/generator" "^7.23.0"
"@babel/helper-environment-visitor" "^7.22.20"
"@babel/helper-function-name" "^7.23.0"
"@babel/helper-hoist-variables" "^7.22.5"
"@babel/helper-split-export-declaration" "^7.22.6"
"@babel/parser" "^7.23.0"
"@babel/types" "^7.23.0"
debug "^4.1.0"
globals "^11.1.0"

"@babel/types@^7.0.0", "@babel/types@^7.17.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3":
version "7.17.0"
resolved "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz"
integrity sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==
Expand Down Expand Up @@ -2062,10 +2062,10 @@ istanbul-reports@^3.0.2:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"

javascript-natural-sort@0.7.1:
javascript-natural-sort@^0.7.1:
version "0.7.1"
resolved "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz"
integrity "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k=sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw== sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw=="
resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59"
integrity sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==

jest-changed-files@^26.6.2:
version "26.6.2"
Expand Down