@jihyunlab/prettier-config
v2.0.8
Published
JihyunLab Prettier config for TypeScript.
Downloads
97
Readme
@jihyunlab/prettier-config
@jihyunlab/prettier-config provides Prettier config for TypeScript.
Installation
npm i --save-dev @jihyunlab/prettier-config prettier eslint-config-prettier eslint-plugin-prettier
Configuration
Configure Prettier
Create and edit the prettier.config.mjs file.
├─ prettier.config.mjs
└─ ...
import { jihyunlabPrettierConfig } from '@jihyunlab/prettier-config';
export default {
...jihyunlabPrettierConfig,
};
Configure Prettier Ignore
Create and edit the .prettierignore file.
├─ .prettierignore
└─ ...
/node_modules
/build
/dist
/coverage
Configure ESLint for Prettier
When using ESLint, edit the eslint.config.mjs file.
For ESLint installation and configuration, see @jihyunlab/eslint-config.
├─ eslint.config.mjs
└─ ...
import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import { jihyunlabEslintConfig } from '@jihyunlab/eslint-config';
export default tsEslint.config(
{
ignores: ['node_modules', 'dist', 'build', 'coverage'],
},
{
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
extends: [
eslint.configs.recommended,
...tsEslint.configs.recommendedTypeChecked,
jihyunlabEslintConfig,
eslintPluginPrettierRecommended,
],
}
);
Configure VSCode for Prettier
When using VSCode, create and edit the .vscode/settings.json file.
├─ .vscode
│ └─ settings.json
└─ ...
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
Credits
Authored and maintained by JihyunLab <[email protected]>
License
Open source licensed as MIT.