@lqbach/prettier-config 0.2.2 โ†’ 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,34 +1,50 @@
1
1
  # Changelog
2
2
 
3
- ## [0.2.2](https://github.com/lqbach/eslint-prettier-config/compare/prettier-config-v0.2.1...prettier-config-v0.2.2) (2023-11-14)
3
+ ## [0.3.0](https://github.com/lqbach/eslint-prettier-config/compare/prettier-config-v0.2.2...prettier-config-v0.3.0) (2023-11-21)
4
+
5
+
6
+ ### Features ๐Ÿš€
7
+
8
+ * add perfectionist sorting for eslint ([b2d8205](https://github.com/lqbach/eslint-prettier-config/commit/b2d8205314b5fe72675afd87a960864018e10782))
9
+ * prettier sorted imports ([c12ede2](https://github.com/lqbach/eslint-prettier-config/commit/c12ede2941863b767810495ee8b5c3cc6691e430))
10
+ * remove import sorting with Prettier ([e099751](https://github.com/lqbach/eslint-prettier-config/commit/e099751d8349b561a15df711e09cfc6763e6b48a))
11
+
12
+
13
+ ### Chores ๐Ÿงน
14
+
15
+ * add husky pre-commit ([db5cdfa](https://github.com/lqbach/eslint-prettier-config/commit/db5cdfa5ce036cebbdbf1edd23885aa1719c27cd))
16
+ * add licensing to package ([e18f4f3](https://github.com/lqbach/eslint-prettier-config/commit/e18f4f36cf44fac1da5906094f2dc9ca2ea2f2d9))
17
+ * add peerDependency for prettier plugin sort ([bf72608](https://github.com/lqbach/eslint-prettier-config/commit/bf72608f71af816b29825ae914514565870f5a84))
4
18
 
5
19
 
6
20
  ### Documentation ๐Ÿ“
7
21
 
8
- * add new readme docs ([b2b0044](https://github.com/lqbach/eslint-prettier-config/commit/b2b004442723e81299e10a2945e9f616324ac06a))
22
+ * align badges ([8e7c4e1](https://github.com/lqbach/eslint-prettier-config/commit/8e7c4e1bcbd7ac7321ae02b21ce0ccf19e70a471))
9
23
 
10
- ## [0.2.1](https://github.com/lqbach/eslint-prettier-config/compare/prettier-config-v0.2.0...prettier-config-v0.2.1) (2023-11-14)
24
+ ## [0.2.2](https://github.com/lqbach/eslint-prettier-config/compare/prettier-config-v0.2.1...prettier-config-v0.2.2) (2023-11-14)
25
+
26
+ ### Documentation ๐Ÿ“
27
+
28
+ - add new readme docs ([b2b0044](https://github.com/lqbach/eslint-prettier-config/commit/b2b004442723e81299e10a2945e9f616324ac06a))
11
29
 
30
+ ## [0.2.1](https://github.com/lqbach/eslint-prettier-config/compare/prettier-config-v0.2.0...prettier-config-v0.2.1) (2023-11-14)
12
31
 
13
32
  ### Bug Fixes
14
33
 
15
- * update package visiblity ([2c332e1](https://github.com/lqbach/eslint-prettier-config/commit/2c332e19165da93881d6ee61b75560041f9a5397))
34
+ - update package visiblity ([2c332e1](https://github.com/lqbach/eslint-prettier-config/commit/2c332e19165da93881d6ee61b75560041f9a5397))
16
35
 
17
36
  ## [0.2.0](https://github.com/lqbach/eslint-prettier-config/compare/prettier-config-v0.1.0...prettier-config-v0.2.0) (2023-11-14)
18
37
 
19
-
20
38
  ### Features
21
39
 
22
- * add new repository key to package ([d63ceb7](https://github.com/lqbach/eslint-prettier-config/commit/d63ceb7e9a348efc322ecdcb5d462cee6a2b05b8))
40
+ - add new repository key to package ([d63ceb7](https://github.com/lqbach/eslint-prettier-config/commit/d63ceb7e9a348efc322ecdcb5d462cee6a2b05b8))
23
41
 
24
42
  ## 0.1.0 (2023-11-14)
25
43
 
26
-
27
44
  ### Bug Fixes
28
45
 
29
- * update name in package descriptions ([103aeb8](https://github.com/lqbach/eslint-prettier-config/commit/103aeb876f9ef22177e66a6946f8a257dc7479cd))
30
-
46
+ - update name in package descriptions ([103aeb8](https://github.com/lqbach/eslint-prettier-config/commit/103aeb876f9ef22177e66a6946f8a257dc7479cd))
31
47
 
32
48
  ### Miscellaneous Chores
33
49
 
34
- * release 0.1.0 ([7cb7162](https://github.com/lqbach/eslint-prettier-config/commit/7cb7162ec233343991bdcfeaadb1caff612c5c9f))
50
+ - release 0.1.0 ([7cb7162](https://github.com/lqbach/eslint-prettier-config/commit/7cb7162ec233343991bdcfeaadb1caff612c5c9f))
package/README.md CHANGED
@@ -0,0 +1,12 @@
1
+ <h1 align="center">@lqbach/prettier-config</h1>
2
+
3
+ <div align="center">
4
+ <a href="https://www.npmjs.com/package/@lqbach/prettier-config">
5
+ <img src="https://img.shields.io/npm/v/@lqbach/prettier-config?color=444E5F&label=version&labelColor=BDD4E7" alt="npm-package"/>
6
+ </a>
7
+ <a href="https://www.npmjs.com/package/@lqbach/prettier-config">
8
+ <img src="https://img.shields.io/github/license/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F" alt="license"/>
9
+ </a>
10
+ <img src="https://img.shields.io/github/release-date/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F" alt="release-date"/>
11
+
12
+ </div>
package/dist/index.cjs CHANGED
@@ -20,14 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- default: () => src_default
23
+ default: () => config
24
24
  });
25
25
  module.exports = __toCommonJS(src_exports);
26
- var src_default = {
27
- printWidth: 80,
28
- tabWidth: 2,
29
- useTabs: false,
30
- semi: false,
31
- singleQuote: false,
32
- bracketSpacing: true
33
- };
26
+ function config() {
27
+ return {
28
+ bracketSpacing: true,
29
+ printWidth: 80,
30
+ semi: false,
31
+ singleQuote: false,
32
+ tabWidth: 2,
33
+ useTabs: false
34
+ };
35
+ }
package/dist/index.js CHANGED
@@ -1,12 +1,14 @@
1
1
  // src/index.ts
2
- var src_default = {
3
- printWidth: 80,
4
- tabWidth: 2,
5
- useTabs: false,
6
- semi: false,
7
- singleQuote: false,
8
- bracketSpacing: true
9
- };
2
+ function config() {
3
+ return {
4
+ bracketSpacing: true,
5
+ printWidth: 80,
6
+ semi: false,
7
+ singleQuote: false,
8
+ tabWidth: 2,
9
+ useTabs: false
10
+ };
11
+ }
10
12
  export {
11
- src_default as default
13
+ config as default
12
14
  };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@lqbach/prettier-config",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.3.0",
5
5
  "private": false,
6
6
  "description": "lqbach's Personal Prettier Config",
7
+ "license": "MIT",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/lqbach/eslint-prettier-config.git",
package/src/index.ts CHANGED
@@ -1,8 +1,12 @@
1
- export default {
2
- printWidth: 80,
3
- tabWidth: 2,
4
- useTabs: false,
5
- semi: false,
6
- singleQuote: false,
7
- bracketSpacing: true,
1
+ import { Config } from "prettier"
2
+
3
+ export default function config(): Config {
4
+ return {
5
+ bracketSpacing: true,
6
+ printWidth: 80,
7
+ semi: false,
8
+ singleQuote: false,
9
+ tabWidth: 2,
10
+ useTabs: false,
11
+ }
8
12
  }
package/src/types.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface PrettierConfigParams {
2
+ importOrder?: Array<string>
3
+ react?: boolean
4
+ vue?: boolean
5
+ }
package/src/utils.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Takes in an array of import order strings and groups them into chunks by adding an empty string between each item in the array.
3
+ *
4
+ * Reference: [README `prettier-plugin-sort-imports`](https://github.com/IanVS/prettier-plugin-sort-imports#3-add-spaces-between-import-groups)
5
+ * @param arr an array of import order strings
6
+ * @returns same array item separated by exactly one empty string between each item
7
+ */
8
+
9
+ export const cleanSortImportsArray = (arr: Array<string>): Array<string> => {
10
+ // remove empty strings
11
+ const arrRemoveEmpty = arr.filter((val) => val !== "")
12
+
13
+ // clean array
14
+ const clean: Array<string> = arrRemoveEmpty.reduce(
15
+ (result: Array<string>, item: string, index: number) => {
16
+ result.push(item)
17
+
18
+ if (index < arrRemoveEmpty.length - 1) {
19
+ result.push("")
20
+ }
21
+ return result
22
+ },
23
+ [],
24
+ )
25
+
26
+ return clean
27
+ }
@@ -0,0 +1,32 @@
1
+ import { describe, expect, test } from "vitest"
2
+
3
+ import { cleanSortImportsArray } from "../src/utils"
4
+
5
+ const inputA1 = ["hey", "jude"]
6
+ const inputA2 = ["hey", "", "", "jude"]
7
+ const inputA3 = ["hey", "", "jude", ""]
8
+ const inputA4 = ["", "hey", "", "jude", ""]
9
+
10
+ const outputExpectedA = ["hey", "", "jude"]
11
+
12
+ describe("cleanSortImportsArray", () => {
13
+ test("test with ['hey', 'jude']", async () => {
14
+ const output = cleanSortImportsArray(inputA1)
15
+ expect(output).toStrictEqual(outputExpectedA)
16
+ })
17
+
18
+ test("test with ['hey', '', '', 'jude']", async () => {
19
+ const output = cleanSortImportsArray(inputA2)
20
+ expect(output).toStrictEqual(outputExpectedA)
21
+ })
22
+
23
+ test("test with ['hey', '', 'jude', '']", async () => {
24
+ const output = cleanSortImportsArray(inputA3)
25
+ expect(output).toStrictEqual(outputExpectedA)
26
+ })
27
+
28
+ test("test with ['', 'hey', '', 'jude', '']", async () => {
29
+ const output = cleanSortImportsArray(inputA4)
30
+ expect(output).toStrictEqual(outputExpectedA)
31
+ })
32
+ })
package/tsconfig.json CHANGED
@@ -1,17 +1,15 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "es2022",
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- "declaration": true,
7
- "strict": true,
8
- "incremental": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "rootDir": "./src",
13
- "outDir": "./dist",
14
- "composite": true
15
- }
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "declaration": true,
7
+ "strict": true,
8
+ "incremental": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "outDir": "./dist",
13
+ "composite": true
16
14
  }
17
-
15
+ }