Skip to content

Commit

Permalink
fix: Disable @trivago/prettier-plugin-sort-imports temporarily
Browse files Browse the repository at this point in the history
See #141
  • Loading branch information
jhnns committed Apr 29, 2024
1 parent 87e3838 commit fe7326f
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 44 deletions.
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
}
}

0 comments on commit fe7326f

Please sign in to comment.