https://github.com/acdh-oeaw/prettier-config

Shared configuration preset for prettier

https://github.com/acdh-oeaw/prettier-config

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.6%) to scientific vocabulary

Keywords

frontend
Last synced: 6 months ago · JSON representation

Repository

Shared configuration preset for prettier

Basic Info
  • Host: GitHub
  • Owner: acdh-oeaw
  • License: mit
  • Language: JavaScript
  • Default Branch: main
  • Homepage:
  • Size: 208 KB
Statistics
  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • Open Issues: 0
  • Releases: 4
Topics
frontend
Created over 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Codeowners

readme.md

acdh-oeaw prettier config

Shared configuration preset for prettier.

How to install

bash npm install -D prettier @acdh-oeaw/prettier-config

Add the config to package.json:

json { "prettier": "@acdh-oeaw/prettier-config" }

If you absolutely need to extend the shared config, create a .prettierrc.js file in the root folder of your project:

```js const sharedConfig = require("@acdh-oeaw/prettier-config");

const config = { ...sharedConfig, overrides: [ { files: ["*.svg"], options: { parser: "html", }, }, ], };

module.exports = config; ```

How to use

Add a script to package.json:

json { "scripts": { "format:check": "prettier . --cache --check --ignore-path .gitignore", "format:fix": "npm run format:check -- --write" } }

You can then run npm run format:check to check code formatting, and npm run format:fix to auto-fix formatting errors.

How to auto-format with Git hooks

bash npm install -D lint-staged simple-git-hooks

To auto-format on every Git commit, and to check formatting on every Git push, add the following to package.json:

json { "scripts": { "format:check": "prettier . --cache --check --ignore-path .gitignore", "format:fix": "npm run format:check -- --write", "prepare": "npm run setup", "setup": "simple-git-hooks || exit 0", "validate": "npm run format:check" }, "lint-staged": { "*": "prettier --cache --ignore-unknown --write" }, "simple-git-hooks": { "pre-commit": "npx lint-staged", "pre-push": "npm run validate" } }

Editor integrations

VS Code

Install the VS Code prettier-vscode plugin by pressing Ctrl+P and pasting the following command:

ext install esbenp.prettier-vscode

Also, make sure to add prettier-vscode to the list of recommended plugins for your project in .vscode/extensions.json:

json { "recommendations": ["esbenp.prettier-vscode"] }

You may also want to enable "Format on Save" in .vscode/settings.json:

json { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true }

WebStorm

The WebStorm default installation should already contain the JetBrains Prettier plugin.

If you install this acdh config via the embedded terminal (Alt+F12) as suggested here the plugin should configure itself automagically. Alternately you may adjust its settings via the Settings/Preferences dialog (Ctrl+Alt+S), under Languages & Frameworks | JavaScript | Prettier . It's highly recommended to check both On code reformat and On Save there as well. (See this section for alternate/additional automation possibilities).

By default the set glob pattern will only match JavaScript, TypeScript, JSX and TSX files. Depending on your stack it's recommended to extend it to

glob {**/*,*}.{js,json,ts,jsx,tsx,vue}

To ship this config with your project, commit/include the prettier.xml in your .idea config folder:

xml <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="PrettierConfiguration"> <option name="myRunOnSave" value="true" /> <option name="myRunOnReformat" value="true" /> <option name="myFilesPattern" value="{**/*,*}.{js,json,ts,jsx,tsx,vue,css,scss,sass}" /> </component> </project>

For more detailed instructions see the WebStorm docs on Prettier and Vue.js formatting

How to adjust tab width

We use tabs, not spaces, for indentation because of their accessibility benefits. Users are then free to configure their preferred tab width in their text editors.

Adding an .editorconfig file to the root of a project provides a way to adjust the tab width, which is understood by most text editors automatically (VS Code requires a separate plugin).

In VS Code, you can adjust the tab width by changing the following in a user's settings.json:

json { "editor.insertSpaces": false, "editor.tabSize": 2 }

On https://github.com you can adjust the tab width in the appearance settings.

In your terminal, you should be able to use the tabs command to set tab width, e.g. tabs 4.

For the output of git diff, you need to adjust the tab width of your pager. When using the default less, you can set git config --global core.pager 'less -x4'.

Owner

  • Name: Austrian Centre for Digital Humanities & Cultural Heritage
  • Login: acdh-oeaw
  • Kind: organization
  • Email: acdh@oeaw.ac.at
  • Location: Vienna, Austria

GitHub Events

Total
  • Release event: 1
  • Delete event: 1
  • Push event: 1
  • Pull request event: 3
  • Create event: 2
Last Year
  • Release event: 1
  • Delete event: 1
  • Push event: 1
  • Pull request event: 3
  • Create event: 2

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 32
  • Total Committers: 3
  • Avg Commits per committer: 10.667
  • Development Distribution Score (DDS): 0.219
Past Year
  • Commits: 5
  • Committers: 2
  • Avg Commits per committer: 2.5
  • Development Distribution Score (DDS): 0.2
Top Committers
Name Email Commits
Stefan Probst s****t@p****e 25
github-actions[bot] g****] 4
ctot-nondef c****n@o****t 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 0
  • Total pull requests: 16
  • Average time to close issues: N/A
  • Average time to close pull requests: 17 days
  • Total issue authors: 0
  • Total pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 0.19
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 5
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
Pull Request Authors
  • stefanprobst (11)
  • github-actions[bot] (4)
  • ctot-nondef (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • changesets/action v1 composite
  • pnpm/action-setup v2 composite
package.json npm
  • @changesets/changelog-github ^0.4.8 development
  • @changesets/cli ^2.26.0 development
  • @types/prettier ^2.7.2 development
  • lint-staged ^13.1.0 development
  • prettier ^2.8.0 development
  • simple-git-hooks ^2.8.1 development
pnpm-lock.yaml npm
  • 304 dependencies