Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disable @trivago/prettier-plugin-sort-imports temporarily #142

Merged
merged 1 commit into from
Apr 29, 2024
Merged
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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
90 changes: 54 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"test:node": "cd tests/node; eslint --max-warnings 0 .",
"test:typescript": "cd tests/typescript; eslint --max-warnings 0 .",
"test:react": "cd tests/react; eslint --max-warnings 0 .",
"test:prettier": "prettier --check .",
"prepare": "husky",
"release": "semantic-release"
},
Expand Down Expand Up @@ -43,7 +44,7 @@
"eslint": "^8.1.0"
},
"dependencies": {
"@babel/core": "^7.24.3",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/eslint-plugin": "^7.23.5",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
Expand All @@ -58,7 +59,8 @@
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/preset-env": "^7.24.3",
"@babel/plugin-syntax-import-attributes": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/react": "^18.2.69",
Expand Down
7 changes: 5 additions & 2 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"use strict";

module.exports = {
plugins: ["@trivago/prettier-plugin-sort-imports"],
importOrder: ["^node:", "<THIRD_PARTY_MODULES>", "^[./]"],
// TODO: Re-add this plugin once it's fixed, https://github.com/peerigon/eslint-config-peerigon/issues/141
// This plugin breaks with import attributes like `import ... with { type: "json" }
// See https://github.com/trivago/prettier-plugin-sort-imports/issues/270
// plugins: ["@trivago/prettier-plugin-sort-imports"],
// importOrder: ["^node:", "<THIRD_PARTY_MODULES>", "^[./]"],
};
5 changes: 4 additions & 1 deletion tests/javascript/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-proposal-class-properties"]
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-import-attributes"
]
}
4 changes: 3 additions & 1 deletion tests/javascript/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { getMessage } from "./message.js";
// Check if import attributes are detected and formatted correctly
import test from "./test.json" with { type: "json" };

class SomeClass {
#someProp = true;
Expand All @@ -8,4 +10,4 @@ class SomeClass {
}
}

console.log(getMessage(), SomeClass);
console.log(getMessage(), SomeClass, test);
1 change: 1 addition & 0 deletions tests/javascript/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 3 additions & 1 deletion tests/typescript/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { getMessage } from "./message.js";
// Check if import attributes are detected and formatted correctly
import test from "./test.json" with { type: "json" };

// Should be an error
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand All @@ -22,4 +24,4 @@ class SomeClass {
snake_case() {}
}

console.log(getMessage(), SomeClass, snake_case);
console.log(getMessage(), SomeClass, snake_case, test);
1 change: 1 addition & 0 deletions tests/typescript/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 2 additions & 1 deletion tests/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"lib": ["dom", "esnext"],
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true
"esModuleInterop": true,
"resolveJsonModule": true
}
}
Loading