diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4644f46 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,192 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## 0.3.11 (2025-02-23) + +**Note:** Version bump only for package @ivuorinen/prettier-config + + + + + +## 0.3.10 (2025-02-23) + + +### Bug Fixes + +* **deps:** update globals to 16.0.0 ([#342](https://github.com/ivuorinen/base-configs/issues/342)) ([04b333b](https://github.com/ivuorinen/base-configs/commit/04b333b445b6beb4344d2f9102bb5d3dc72ae26a)) + + + + + +## 0.3.9 (2025-01-17) + + +### Bug Fixes + +* **deps:** update eslint-config-prettier to 10.0.1 ([#324](https://github.com/ivuorinen/base-configs/issues/324)) ([8a0d38e](https://github.com/ivuorinen/base-configs/commit/8a0d38e173df40b771d42b694a24145559200506)) + + + + + +## [0.3.8](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.3.7...@ivuorinen/prettier-config@0.3.8) (2024-12-09) + +**Note:** Version bump only for package @ivuorinen/prettier-config + + + + + +## 0.3.7 (2024-11-25) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## [0.3.6](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.3.5...@ivuorinen/prettier-config@0.3.6) (2024-11-24) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## 0.3.5 (2024-11-16) + +### Bug Fixes + +- upgrade browserslist from 4.24.0 to 4.24.2 ([#302](https://github.com/ivuorinen/base-configs/issues/302)) ([cbb1754](https://github.com/ivuorinen/base-configs/commit/cbb17540f3cd7fc81f0032e557568c65ed0a9744)) + +## 0.3.4 (2024-10-20) + +### Bug Fixes + +- upgrade browserslist from 4.23.3 to 4.24.0 ([#297](https://github.com/ivuorinen/base-configs/issues/297)) ([a99c55a](https://github.com/ivuorinen/base-configs/commit/a99c55aab760142b5d77ad80ce5d44b25dde17d7)) + +## 0.3.3 (2024-10-19) + +### Bug Fixes + +- upgrade markdownlint-cli from 0.41.0 to 0.42.0 ([#298](https://github.com/ivuorinen/base-configs/issues/298)) ([f57190d](https://github.com/ivuorinen/base-configs/commit/f57190d55c27101f66583cc0000733b2707c1e5f)) + +## [0.3.2](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.3.1...@ivuorinen/prettier-config@0.3.2) (2024-09-17) + +### Bug Fixes + +- **config:** add wrapper.mjs to included files ([ef5641f](https://github.com/ivuorinen/base-configs/commit/ef5641f13bc6a71e539174ae89d46e3fafa060c9)) + +## [0.3.1](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.3.0...@ivuorinen/prettier-config@0.3.1) (2024-08-28) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +# [0.3.0](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.16...@ivuorinen/prettier-config@0.3.0) (2024-08-21) + +- feat!: module & commonjs in prettier ([12ea368](https://github.com/ivuorinen/base-configs/commit/12ea3688ad61ea5b21762225b9b41b30a1995198)) +- feat!: module & commonjs in prettier ([8d3dbd8](https://github.com/ivuorinen/base-configs/commit/8d3dbd89e8dbaaa2df12eb9900fdf0cfa566a65c)) + +### BREAKING CHANGES + +- support module, and commonjs types +- support module, and commonjs types + +## [0.2.16](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.15...@ivuorinen/prettier-config@0.2.16) (2024-07-16) + +### Bug Fixes + +- **deps:** update prettier to 3.3.3 ([#277](https://github.com/ivuorinen/base-configs/issues/277)) ([03e8a97](https://github.com/ivuorinen/base-configs/commit/03e8a97e2b0d3a35e49969d100df16b7f7aaa89d)) + +## 0.2.15 (2024-07-02) + +### Bug Fixes + +- **workflows:** commit lint fix ([3cc07cf](https://github.com/ivuorinen/base-configs/commit/3cc07cf3ffd8743860a07bb85aa4d275bb63094e)) + +## [0.2.14](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.13...@ivuorinen/prettier-config@0.2.14) (2024-06-15) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.3.2 ([62ff793](https://github.com/ivuorinen/base-configs/commit/62ff7930de55c29e08975faaed1b22df8c85ba44)) + +## [0.2.13](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.12...@ivuorinen/prettier-config@0.2.13) (2024-06-14) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## [0.2.12](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.11...@ivuorinen/prettier-config@0.2.12) (2024-06-06) + +### Bug Fixes + +- **deps:** update devdependencies (patch) ([ed302ac](https://github.com/ivuorinen/base-configs/commit/ed302acd4e4671eb21e20c3fbb053e6c989c203b)) + +## [0.2.11](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.10...@ivuorinen/prettier-config@0.2.11) (2024-06-05) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.3.0 ([#258](https://github.com/ivuorinen/base-configs/issues/258)) ([e7e39f9](https://github.com/ivuorinen/base-configs/commit/e7e39f9e3140ea574340ac66a777f3cd49fbf4b4)) + +## [0.2.10](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.9...@ivuorinen/prettier-config@0.2.10) (2024-05-05) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## [0.2.9](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.8...@ivuorinen/prettier-config@0.2.9) (2024-02-08) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## [0.2.8](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.7...@ivuorinen/prettier-config@0.2.8) (2024-01-20) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.2.4 ([faadbc6](https://github.com/ivuorinen/base-configs/commit/faadbc633a04f22999352e9f0e26a0acc65f0ff7)) + +## [0.2.7](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.6...@ivuorinen/prettier-config@0.2.7) (2024-01-20) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.2.3 ([4393ed7](https://github.com/ivuorinen/base-configs/commit/4393ed7c99515b1c27f76843b3af968be0a9d6a8)) + +## [0.2.6](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.5...@ivuorinen/prettier-config@0.2.6) (2024-01-17) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.2.2 ([6d7f865](https://github.com/ivuorinen/base-configs/commit/6d7f865bbbd4e7b03c0ab4f1904907c84dc632c6)) + +## [0.2.5](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.4...@ivuorinen/prettier-config@0.2.5) (2024-01-16) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.2.1 ([#172](https://github.com/ivuorinen/base-configs/issues/172)) ([178b77f](https://github.com/ivuorinen/base-configs/commit/178b77f0076aa13b5a19b9a382c33d19b2db5fa9)) + +## [0.2.4](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.3...@ivuorinen/prettier-config@0.2.4) (2023-12-15) + +### Bug Fixes + +- **deps:** update devdependencies (patch) ([b79252a](https://github.com/ivuorinen/base-configs/commit/b79252a163ae15462984c84fd7950fc74da902b6)) + +## [0.2.3](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.2...@ivuorinen/prettier-config@0.2.3) (2023-11-16) + +### Bug Fixes + +- **deps:** update dependency prettier to v3.1.0 ([#135](https://github.com/ivuorinen/base-configs/issues/135)) ([4ecaa73](https://github.com/ivuorinen/base-configs/commit/4ecaa73be86a7b7f98b78ffddf3fdf9316680ae2)) + +## [0.2.2](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.1...@ivuorinen/prettier-config@0.2.2) (2023-10-31) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## [0.2.1](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.2.0...@ivuorinen/prettier-config@0.2.1) (2023-10-30) + +### Bug Fixes + +- **deps:** update dependency prettier to v3 ([#58](https://github.com/ivuorinen/base-configs/issues/58)) ([15e815a](https://github.com/ivuorinen/base-configs/commit/15e815a53d46bb369cb2d7c0eb7b54474245afee)) + +# [0.2.0](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.1.2...@ivuorinen/prettier-config@0.2.0) (2023-10-25) + +### Features + +- skip config creation if one already found ([#110](https://github.com/ivuorinen/base-configs/issues/110)) ([9beafec](https://github.com/ivuorinen/base-configs/commit/9beafec48681768f06ff24029391176d87169261)) + +## [0.1.2](https://github.com/ivuorinen/base-configs/compare/@ivuorinen/prettier-config@0.1.1...@ivuorinen/prettier-config@0.1.2) (2023-10-24) + +**Note:** Version bump only for package @ivuorinen/prettier-config + +## 0.1.1 (2023-05-04) + +### Bug Fixes + +- **deps:** update devdependencies (patch) ([#4](https://github.com/ivuorinen/base-configs/issues/4)) ([d87c0cf](https://github.com/ivuorinen/base-configs/commit/d87c0cf5fd2494b0577086e590b72f4ec7bb30ee)) diff --git a/LICENSE.md b/LICENSE.md index 8d1507b..1272de8 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Ismo Vuorinen +Copyright (c) 2023 Ismo Vuorinen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md new file mode 100644 index 0000000..4abea8d --- /dev/null +++ b/README.md @@ -0,0 +1,70 @@ +# @ivuorinen/prettier-config + +[![npm package][npm-badge]][npm-link] [![license MIT][license-badge]][license-link] [![ivuorinen's Code Style][style-badge]][style-link] + +> ivuorinen's shareable configuration for [`Prettier`][prettier-link]. + +## Table of Contents + +- [Installation](#installation) +- [Documentations](#documentations) +- [Contributing](#contributing) +- [Changelog](#changelog) +- [License](#license) + +## Installation + +Install `this config` as a _`devDependencies`_: + +```sh +# npm +npm install @ivuorinen/prettier-config --save-dev + +# Yarn +yarn add @ivuorinen/prettier-config --dev +``` + +After installing it, a _`.prettierrc.json`_ file will be created automatically in the project's root folder with the following configuration: + +```json +"@ivuorinen/prettier-config" +``` + +> Note: This method does **not** offer a way to _extend_ the configuration to overwrite some properties from the shared configuration. If you need to do that, import the file in a _`.prettierrc.js`_ file and export the modifications, e.g: +> +> ```js +> module.exports = { +> ...require("@ivuorinen/prettier-config"), +> // Add custom options below: +> semi: true, +> }; +> ``` + +## Documentations + +Read the [Prettier docs][prettier-docs-link] for more information. + +## Contributing + +If you are interested in helping contribute, please take a look at our [contribution guidelines][contributing-link] and open an [issue][issue-link] or [pull request][pull-request-link]. + +## Changelog + +See [CHANGELOG][changelog-link] for a human-readable history of changes. + +## License + +Distributed under the MIT License. See [LICENSE][license-link] for more information. + +[changelog-link]: ./CHANGELOG.md +[prettier-docs-link]: https://prettier.io +[prettier-link]: https://github.com/prettier/prettier +[contributing-link]: https://github.com/ivuorinen/.github/blob/main/CONTRIBUTING.md +[issue-link]: https://github.com/ivuorinen/base-configs-prettier/issues +[license-badge]: https://img.shields.io/github/license/ivuorinen/base-configs-prettier?style=flat-square&labelColor=292a44&color=663399 +[license-link]: ./LICENSE +[npm-badge]: https://img.shields.io/npm/v/@ivuorinen/prettier-config?style=flat-square&labelColor=292a44&color=663399 +[npm-link]: https://www.npmjs.com/package/@ivuorinen/prettier-config +[pull-request-link]: https://github.com/ivuorinen/base-configs-prettier/pulls +[style-badge]: https://img.shields.io/badge/code_style-ivuorinen%E2%80%99s-663399.svg?labelColor=292a44&style=flat-square +[style-link]: https://github.com/ivuorinen/base-configs-prettier diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..3967a45 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,12 @@ +import ivuorinenConfig from '@ivuorinen/eslint-config'; + +export default [ + ...ivuorinenConfig, + + // your modifications + { + rules: { + // "no-unused-vars": "warn" + } + } +]; diff --git a/index.cjs b/index.cjs new file mode 100644 index 0000000..aa5a006 --- /dev/null +++ b/index.cjs @@ -0,0 +1,17 @@ +'use strict' + +module.exports = { + arrowParens: 'avoid', + proseWrap: 'never', + semi: false, + singleQuote: true, + trailingComma: 'none', + overrides: [ + { + files: ['*.css', '*.scss'], + options: { + singleQuote: false + } + } + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..535f10d --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "@ivuorinen/prettier-config", + "version": "0.3.11", + "type": "module", + "description": "ivuorinen's shareable configuration for Prettier.", + "author": { + "name": "Ismo Vuorinen", + "url": "https://github.com/ivuorinen" + }, + "bugs": { + "url": "https://github.com/ivuorinen/base-configs-prettier/issues" + }, + "engines": { + "node": ">=20" + }, + "main": "index.cjs", + "module": "wrapper.mjs", + "exports": { + "import": "./wrapper.mjs", + "require": "./index.cjs" + }, + "files": [ + "index.cjs", + "wrapper.mjs", + "scripts/*" + ], + "homepage": "https://github.com/ivuorinen/base-configs-prettier#readme", + "keywords": [ + "config", + "ivuorinen", + "prettier-config", + "prettier" + ], + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/ivuorinen/base-configs-prettier.git" + }, + "scripts": { + "postinstall": "node scripts/postinstall.cjs" + }, + "dependencies": { + "@ivuorinen/config-checker": "^1.1.12", + "prettier": "^3" + }, + "gitHead": "23d15f15743fb59c1dbe658615ef2ed51c54d230" +} diff --git a/scripts/postinstall.cjs b/scripts/postinstall.cjs new file mode 100644 index 0000000..c1c4093 --- /dev/null +++ b/scripts/postinstall.cjs @@ -0,0 +1,24 @@ +'use strict' + +/* eslint no-console: "off", n/no-process-exit: "off", no-undefined: "off" -- CLI app that gives users feedback */ + +const fs = require('node:fs') +const path = require('node:path') +// noinspection NpmUsedModulesInstalled +const process = require('node:process') +const checkConfig = require('@ivuorinen/config-checker') +const foundConfig = checkConfig('prettier') + +if (foundConfig.length > 0) { + console.log('prettier-config: Found existing prettier config file, skipping creation.') + console.log('prettier-config: If you want to create a new config file, please remove the existing one.') + console.log(`prettier-config: Found config files at: ${foundConfig.join(', ')}`) + process.exit(0) +} + +const filePath = path.join(process.env.INIT_CWD, '.prettierrc.json') +const fileConfigObject = '@ivuorinen/prettier-config' + +if (!fs.existsSync(filePath)) { + fs.writeFileSync(filePath, JSON.stringify(fileConfigObject, undefined, 2)) +} diff --git a/wrapper.mjs b/wrapper.mjs new file mode 100644 index 0000000..16b7e5c --- /dev/null +++ b/wrapper.mjs @@ -0,0 +1,2 @@ +import config from './index.cjs' +export default config diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..672ff00 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ivuorinen/config-checker@^1.1.10": + version "1.1.11" + resolved "https://registry.yarnpkg.com/@ivuorinen/config-checker/-/config-checker-1.1.11.tgz#55a91c7b23725d2f1bb0e678d53638af1f034125" + integrity sha512-9nyiuhMprc8zxsZSxONnVS2CHd4Ad0Xl7EEXWMeiF0iuHeyu2RenHYZBZo2rv863vpaw5C9MJFXjsW7NEIGQpg== + +prettier@^3: + version "3.5.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.2.tgz#d066c6053200da0234bf8fa1ef45168abed8b914" + integrity sha512-lc6npv5PH7hVqozBR7lkBNOGXV9vMwROAPlumdBkX0wTbbzPu/U1hk5yL8p2pt4Xoc+2mkT8t/sow2YrV/M5qg==