- 📦 Provide the most basic prettier configuration
- 📦 Support for ordering import statements
- 📦 Support atomic CSS class sorting
- 📦 Support package json field sorting
Tip
Please make sure that the prettier version is 3.0.0+
# npm
npm i @configurajs/prettier -D
# yarn
yarn add @configurajs/prettier -D
# pnpm
pnpm add @configurajs/prettier -D
// prettier.config.js
import { defineConfig } from '@configurajs/prettier'
export default defineConfig()
OR
// prettier.config.js
const { defineConfig } = require('@configurajs/prettier')
module.exports = defineConfig()
// prettier.config.js
import { defineConfig } from '@configurajs/prettier'
export default defineConfig({ ... })
import { Config } from 'prettier'
export type DefineConfigOptions = Config & {
/**
* Whether to enable import sorting
* @default true
*/
sortImports?: boolean
/**
* Whether to enable atomic class sorting
* @default true
*/
sortAtomicClass?: boolean
/**
* Whether to enable package.json sorting
* @default true
*/
sortPackageJson?: boolean
/**
* Ordering of import statements
* @default ['<BUILTIN_MODULES>', '^vue$', '^react$', '<THIRD_PARTY_MODULES>', '^@/(.*)$', '^~/(.*)$', '^[.]']
*/
importsOrder?: string[]
/**
* Ordering of package.json properties
* @default []
*/
packageJsonOrder?: string[]
}