1.3.2 • Published 10 months ago

@culur/config-prettier v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@culur/config-prettier

NPM Version NPM Download NPM License

CodeFactor Codecov Build and release

Sharing Prettier configurations.

✨ Features

The library is a shareable Prettier configuration. It has some key features as follows:

  • Auto detect operating system to determine endOfLine is crlf or lf.
  • Override .*rc & *.code-workspace files parser to json.
  • Override *.md, *.yml, *.yaml, package*.json files tab width to 2.
  • Override *.sh files endOfLine to lf.

💿 Installation

Add @culur/config-prettier dependency to your project.

# Using npm
npm install @culur/config-prettier --save-dev

# Using pnpm
pnpm install @culur/config-prettier --dev

# Using yarn
yarn add @culur/config-prettier --dev

Other packages:

  • Use need to install prettier package in devDependencies.

📖 Usage

1. Extending config

There are three approaches to extend this shared config.

a. Reference it in your package.json

{
  "name": "my-lib",
  "version": "0.0.0",
  "prettier": "@culur/config-prettier",
}

b. Use any of the supported extensions to export a string

Example: .prettierrc.json.

"@culur/config-prettier"

c. Overwrite some properties from the shared configuration

// .prettierrc.cjs
const defineConfig = require('@culur/config-prettier/factory');

module.exports = defineConfig({
  semi: false,
});
// .prettierrc.mjs
import defineConfig from '@culur/config-prettier/factory';

export default defineConfig({
  semi: false,
});

2. Ignoring Code

Prettier use .prettierignore file to ignore specific files. You can use the following command to copy our default .prettierignore to your project root folder:

# unix
cp "node_modules\@culur\config-prettier\.prettierignore" ".prettierignore"

# windows
copy "node_modules\@culur\config-prettier\.prettierignore" ".prettierignore"

📜 Scripts

Some commonly used scripts in package.json.

{
  "scripts": {
    "fix:prettier": "prettier '**' --write",
    "lint:prettier": "prettier '**' --list-different"
  }
}

🗃️ Changelog

See CHANGELOG for more information on what has changed recently.

🔒 License

See LICENSE for license rights and limitations (MIT).

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.2.0

11 months ago

1.1.0

11 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago