Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prettier-plugin-jsdoc #56

Merged
merged 4 commits into from
Jun 6, 2023
Merged

Add prettier-plugin-jsdoc #56

merged 4 commits into from
Jun 6, 2023

Conversation

jcbhmr
Copy link
Collaborator

@jcbhmr jcbhmr commented Jun 3, 2023

This PR would...

  • Add prettier-plugin-jsdoc to auto format jsdoc comments

@mesqueeb
Copy link
Owner

mesqueeb commented Jun 3, 2023

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

  • 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.
  • 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.

@jcbhmr jcbhmr self-assigned this Jun 3, 2023
@jcbhmr
Copy link
Collaborator Author

jcbhmr commented Jun 3, 2023

  • 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)
{
  "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 jcbhmr marked this pull request as draft June 3, 2023 04:30
@jcbhmr jcbhmr marked this pull request as ready for review June 3, 2023 04:32
@jcbhmr jcbhmr requested a review from mesqueeb June 3, 2023 04:32
@jcbhmr jcbhmr changed the title Add prettier plugins Add prettier-plugin-jsdoc Jun 3, 2023
@jcbhmr
Copy link
Collaborator Author

jcbhmr commented Jun 3, 2023

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

@mesqueeb mesqueeb merged commit cf65979 into production Jun 6, 2023
@mesqueeb mesqueeb deleted the add-prettier-plugins branch June 6, 2023 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants