mesqueeb / is-what

JS type check (TypeScript supported) functions like `isPlainObject() isArray()` etc. A simple & small integration.
https://mesqueeb.github.io/is-what/
MIT License
170 stars 18 forks source link

Add prettier-plugin-jsdoc #56

Closed jcbhmr closed 1 year ago

jcbhmr commented 1 year ago

This PR would...

mesqueeb commented 1 year ago

Hey! thanks for the PR. Prettier is already a dev dependency + has a .prettierrc file on root, so this means that eg. in VSCode it will just auto format with prettier on save.

I am a bit hesitant on this PR because

jcbhmr commented 1 year ago
  • I do not like the way that prettier-plugin orders the package.json I have it ordered in a way I personally think it makes sense for people to come read it.

That's OK. ❤️

This is the end goal with a lot of those objects cleaned up (copied from jcbhmr branch) ```jsonc { "name": "is-what", "version": "5.0.0", "description": "👩‍🔬 isPlainObject() and other tiny typechecking testers", "keywords": [ "javascript", "typescript", "typechecker", "check-type", "javascript-type", "primitive-types", "plain-object", "plain-objects", "class-instance", "class-identifier", "type-checking", "type-checker", "type-check", "define-type", "get-type", "what-type", "is-object", "is-plain-obj", "is-plain-object" ], "homepage": "https://github.com/mesqueeb/is-what#readme", "bugs": "https://github.com/mesqueeb/is-what/issues", "repository": "github:mesqueeb/is-what", "funding": "https://github.com/sponsors/mesqueeb", "license": "MIT", "author": "Luca Ban (https://github.com/mesqueeb)", "sideEffects": false, "type": "module", "exports": "./dist/index.js", "files": [ "dist" ], "scripts": { "build:deno": "denoify", "build:docs": "typedoc", "prepack": "tsc", "start": "tsx --test --watch **/*.test.ts", "pretest": "prettier --ignore-path .gitignore -w . && eslint src", "test": "tsc --noEmit && tsx --test **/*.test.ts" }, "eslintConfig": { "parser": "@typescript-eslint/parser", "plugins": [ "@typescript-eslint", "tree-shaking" ], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "prettier" ], "rules": { "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-ignore": "off", "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-non-null-assertion": "off", "tree-shaking/no-side-effects-in-initialization": "error" }, "ignorePatterns": [ "node_modules", "dist", "scripts", "test" ], "root": true }, "devDependencies": { "@types/node": "^20.2.5", "@typescript-eslint/eslint-plugin": "^5.59.6", "@typescript-eslint/parser": "^5.59.6", "denoify": "^1.5.7", "eslint": "^8.41.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-tree-shaking": "^1.10.0", "prettier": "^2.8.8", "prettier-plugin-jsdoc": "^0.4.2", "prettier-plugin-packagejson": "^2.4.3", "tsx": "^3.12.7", "typedoc": "^0.24.7", "typescript": "^5.0.4" }, "denoify": { "index": "src/index.ts" } } ```
  • I think we should not apply prettier auto-formatting to dist files, because it will become way harder to track dist file differences when building, unless we add it as a step in the build script. I'd rather not have one more step in the build script though.

This is a problem that should be solved by keeping dist out of source! 😊 But yes, prettier should ignore dist files. In this case, that means duping .prettierignore with all the contents of .gitignore 🙄

jcbhmr commented 1 year ago

@mesqueeb I've updated the scope of this particular PR to be just prettier-plugin-jsdoc