Skip to content
This repository was archived by the owner on Feb 9, 2025. It is now read-only.

Commit 501c74e

Browse files
authored
fix: Disable @trivago/prettier-plugin-sort-imports temporarily (#142)
See #141
1 parent 87e3838 commit 501c74e

10 files changed

+78
-44
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

package-lock.json

+54-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"test:node": "cd tests/node; eslint --max-warnings 0 .",
1515
"test:typescript": "cd tests/typescript; eslint --max-warnings 0 .",
1616
"test:react": "cd tests/react; eslint --max-warnings 0 .",
17+
"test:prettier": "prettier --check .",
1718
"prepare": "husky",
1819
"release": "semantic-release"
1920
},
@@ -43,7 +44,7 @@
4344
"eslint": "^8.1.0"
4445
},
4546
"dependencies": {
46-
"@babel/core": "^7.24.3",
47+
"@babel/core": "^7.24.4",
4748
"@babel/eslint-parser": "^7.24.1",
4849
"@babel/eslint-plugin": "^7.23.5",
4950
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
@@ -58,7 +59,8 @@
5859
},
5960
"devDependencies": {
6061
"@babel/plugin-proposal-class-properties": "^7.18.6",
61-
"@babel/preset-env": "^7.24.3",
62+
"@babel/plugin-syntax-import-attributes": "^7.24.1",
63+
"@babel/preset-env": "^7.24.4",
6264
"@semantic-release/changelog": "^6.0.3",
6365
"@semantic-release/git": "^10.0.1",
6466
"@types/react": "^18.2.69",

prettier.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"use strict";
22

33
module.exports = {
4-
plugins: ["@trivago/prettier-plugin-sort-imports"],
5-
importOrder: ["^node:", "<THIRD_PARTY_MODULES>", "^[./]"],
4+
// TODO: Re-add this plugin once it's fixed, https://github.com/peerigon/eslint-config-peerigon/issues/141
5+
// This plugin breaks with import attributes like `import ... with { type: "json" }
6+
// See https://github.com/trivago/prettier-plugin-sort-imports/issues/270
7+
// plugins: ["@trivago/prettier-plugin-sort-imports"],
8+
// importOrder: ["^node:", "<THIRD_PARTY_MODULES>", "^[./]"],
69
};

tests/javascript/babel.config.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
22
"presets": ["@babel/preset-env"],
3-
"plugins": ["@babel/plugin-proposal-class-properties"]
3+
"plugins": [
4+
"@babel/plugin-proposal-class-properties",
5+
"@babel/plugin-syntax-import-attributes"
6+
]
47
}

tests/javascript/main.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { getMessage } from "./message.js";
2+
// Check if import attributes are detected and formatted correctly
3+
import test from "./test.json" with { type: "json" };
24

35
class SomeClass {
46
#someProp = true;
@@ -8,4 +10,4 @@ class SomeClass {
810
}
911
}
1012

11-
console.log(getMessage(), SomeClass);
13+
console.log(getMessage(), SomeClass, test);

tests/javascript/test.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

tests/typescript/main.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { getMessage } from "./message.js";
2+
// Check if import attributes are detected and formatted correctly
3+
import test from "./test.json" with { type: "json" };
24

35
// Should be an error
46
// eslint-disable-next-line @typescript-eslint/naming-convention
@@ -22,4 +24,4 @@ class SomeClass {
2224
snake_case() {}
2325
}
2426

25-
console.log(getMessage(), SomeClass, snake_case);
27+
console.log(getMessage(), SomeClass, snake_case, test);

tests/typescript/test.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

tests/typescript/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"lib": ["dom", "esnext"],
66
"strict": true,
77
"moduleResolution": "node",
8-
"esModuleInterop": true
8+
"esModuleInterop": true,
9+
"resolveJsonModule": true
910
}
1011
}

0 commit comments

Comments
 (0)