├── .gitignore ├── .github └── workflows │ └── publish.yml ├── README.md ├── package.json ├── index.js └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | *.tgz 2 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: read 13 | id-token: write 14 | steps: 15 | - uses: actions/checkout@v3 16 | - uses: actions/setup-node@v3 17 | with: 18 | node-version: 18 19 | registry-url: https://registry.npmjs.org/ 20 | - run: npm publish --provenance 21 | env: 22 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # @ionic/prettier-config 2 | 3 | Shared Prettier config used in Ionic, Capacitor, and Stencil projects. 4 | 5 | ## Usage 6 | 7 | Usage is based on [Sharing configurations](https://prettier.io/docs/en/configuration.html#sharing-configurations) from the Prettier docs. 8 | 9 | 1. Remove existing `.prettierrc` file, if present. 10 | 1. Install the config. 11 | 12 | ``` 13 | npm install -D @ionic/prettier-config 14 | ``` 15 | 16 | 1. Add the following to `package.json`: 17 | 18 | ``` 19 | "prettier": "@ionic/prettier-config", 20 | ``` 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@ionic/prettier-config", 3 | "version": "4.0.0", 4 | "description": "Prettier config for Ionic and Capacitor", 5 | "keywords": [], 6 | "homepage": "https://github.com/ionic-team/prettier-config#readme", 7 | "bugs": { 8 | "url": "https://github.com/ionic-team/prettier-config/issues" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/ionic-team/prettier-config.git" 13 | }, 14 | "license": "MIT", 15 | "author": "Ionic ", 16 | "main": "index.js", 17 | "files": [ 18 | "index.js" 19 | ], 20 | "peerDependencies": { 21 | "prettier": "^2.4.0 || ^3.0.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 120, // default: 80 3 | tabWidth: 2, 4 | useTabs: false, 5 | semi: true, 6 | singleQuote: true, // default: false 7 | quoteProps: 'as-needed', 8 | jsxSingleQuote: false, 9 | trailingComma: 'all', 10 | bracketSpacing: true, 11 | bracketSameLine: false, 12 | arrowParens: 'always', 13 | overrides: [ 14 | { 15 | files: ['*.java'], 16 | options: { 17 | printWidth: 140, 18 | tabWidth: 4, 19 | useTabs: false, 20 | trailingComma: 'none', 21 | }, 22 | }, 23 | { 24 | files: '*.md', 25 | options: { 26 | parser: 'mdx', 27 | }, 28 | }, 29 | ], 30 | }; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2015-present Drifty Co. 2 | http://drifty.com/ 3 | 4 | MIT License 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | --------------------------------------------------------------------------------