@culur/config-prettier
v1.3.2
Published
Culur's prettier configuration
Downloads
34
Readme
@culur/config-prettier
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
iscrlf
orlf
. - Override
.*rc
&*.code-workspace
files parser tojson
. - Override
*.md
,*.yml
,*.yaml
,package*.json
files tab width to2
. - Override
*.sh
files endOfLine tolf
.
💿 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).