Skip to content

Commit 44429ca

Browse files
[Prettier] Switch to a JS config file (#3917)
This allows us to add comments to settings. * Use a better package for sorting imports. * Add a note about an alternative plugin.
1 parent 7158aa8 commit 44429ca

File tree

4 files changed

+70
-87
lines changed

4 files changed

+70
-87
lines changed

.prettierrc

Lines changed: 0 additions & 43 deletions
This file was deleted.

.prettierrc.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @see https://prettier.io/docs/configuration
3+
* @type {import("prettier").Config}
4+
*/
5+
export default {
6+
plugins: [
7+
'@ianvs/prettier-plugin-sort-imports', // Consider https://www.npmjs.com/package/prettier-plugin-organize-imports as an alternative
8+
'prettier-plugin-brace-style',
9+
'prettier-plugin-space-before-function-paren',
10+
'prettier-plugin-merge',
11+
],
12+
importOrder: [
13+
'<BUILTIN_MODULES>', // Node.js built-in modules
14+
'<THIRD_PARTY_MODULES>', // Imports not matched by other special words or groups.
15+
'^\\.\\./', // Parent imports
16+
'^\\./', // Sibling imports
17+
'^\\.$', // Index file
18+
'<TYPES>', // Type imports
19+
],
20+
braceStyle: 'stroustrup',
21+
arrowParens: 'avoid',
22+
bracketSpacing: true,
23+
endOfLine: 'auto',
24+
semi: true,
25+
singleQuote: true,
26+
tabWidth: 4,
27+
useTabs: true,
28+
trailingComma: 'es5',
29+
quoteProps: 'preserve',
30+
printWidth: 100,
31+
overrides: [
32+
{
33+
files: ['*.yml', '*.yaml'],
34+
options: {
35+
tabWidth: 2,
36+
},
37+
},
38+
{
39+
files: '*.css',
40+
options: {
41+
singleQuote: false,
42+
},
43+
},
44+
],
45+
};

package-lock.json

Lines changed: 24 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@
6363
"readmeFilename": "README.md",
6464
"devDependencies": {
6565
"@eslint/js": "^9.24.0",
66+
"@ianvs/prettier-plugin-sort-imports": "^4.4.1",
6667
"@prettier/sync": "^0.5.2",
6768
"@rollup/plugin-commonjs": "^28.0.3",
6869
"@rollup/plugin-terser": "^0.4.4",
6970
"@rollup/plugin-typescript": "^12.1.2",
70-
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
7171
"@types/benchmark": "^2.1.2",
7272
"@types/chai": "^5.2.1",
7373
"@types/clean-css": "^4.2.11",

0 commit comments

Comments
 (0)