Skip to content

Commit

Permalink
feat(prettier-config): add index.js entrypoint
Browse files Browse the repository at this point in the history
This was done so that the base config is extensible which will allow
other projects to install any prettier plugins that might be relevant
for their project, e.g. prettier-plugin-tailwind.
  • Loading branch information
grantwforsythe committed Feb 20, 2025
1 parent 27ae52a commit 27e4ddd
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Include the commitlint preset in your `package.json`:
Include the shared Prettier config in your `package.json`:
```json
"prettier": "@siemens/prettier-config/.prettierrc.json",
"prettier": "@siemens/prettier-config",
```
### ESLint Plugin
Expand Down
5 changes: 4 additions & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"./commitlint-config/.commitlintrc.js"
]
},
"prettier": "./prettier-config/.prettierrc.json",
"prettier": "./prettier-config/index.js",
"workspaces": [
"commitlint-config",
"eslint-config-angular",
Expand Down
39 changes: 39 additions & 0 deletions prettier-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright Siemens 2024.
* SPDX-License-Identifier: MIT
*
/
/**
* @type { import("prettier").Config }
*/
const config = {
printWidth: 100,
trailingComma: 'none',
arrowParens: 'avoid',
htmlWhitespaceSensitivity: 'strict',
quoteProps: 'preserve',
singleQuote: true,
overrides: [
{
files: '*.html',
options: {
parser: 'angular'
}
},
{
files: 'index.html',
options: {
parser: 'html'
}
},
{
files: '*.json5',
options: {
singleQuote: false
}
}
]
};

export default config;
12 changes: 8 additions & 4 deletions prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "@siemens/prettier-config",
"version": "0.0.0-development",
"description": "Configuration for Prettier.",
"files": [
"*.json",
"*.md"
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/siemens/lint.git"
},
"exports": {
".": "./index.js",
"./prettierrc.json": "./.prettierrc.json"
},
"author": {
"name": "Siemens",
"email": "opensource@siemens.com"
Expand All @@ -24,7 +24,11 @@
"access": "public"
},
"license": "MIT",
"type": "module",
"peerDependencies": {
"prettier": "^3.0.0"
},
"devDependencies": {
"prettier": "3.4.2"
}
}

0 comments on commit 27e4ddd

Please sign in to comment.