nyaggah / bedframe

Your Browser Extension Development Framework
https://bedframe.dev
MIT License
505 stars 5 forks source link

Extra trailing commas in generated package.json file #328

Closed MikeTheSnowman closed 7 months ago

MikeTheSnowman commented 7 months ago

Hello. I just now tried using bedframe for the first time a few minutes ago and tried setting up a new project with the following settings:

✔ Browser(s): › chrome, edge, firefox
✔ Project name: … bedframe-test1
✔ Project version: … 0.0.1
✔ Description: … just testing bedframe
✔ Author (name, email, url): … asdfasdfaf@asdfasfd.com
✔ License: … MIT
✔ Private: … No / Yes
✔ Type: › Overlay
✔ Position: › Center (default)
✔ Override page: › None
✔ Options page: › None
✔ Package manager: › Npm
✔ Framework: › React
✔ Programming language: › TypeScript
✔ CSS framework: › Tailwind
✔ Add linting & formatting: … No / Yes
✔ Add unit tests: … No / Yes
✔ Add git … No / Yes
✔ Add git hooks: … No / Yes
✔ Add commit linting: … No / Yes
✔ Add changesets: … No / Yes
✔ Install dependencies: … No / Yes

Using these settings, I get a package.json file which fails to run with npm install due to some trailing commas. Below is a copy of my package.json with the trailing commas on lines 26 and 133:

{
  "name": "bedframe-test1",
  "version": "0.0.1",
  "description": "just testing bedframe",
  "author": {
    "name": "asdfasdf@asdf.com",
    "email": "",
    "url": ""
  },
  "license": "MIT",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "bedframe dev",
    "build": "tsc && bedframe build",

    "git:release": "gh release create $npm_package_name@$npm_package_version ./dist/*.zip --generate-notes",
    "bedframe:publish": "bedframe publish -b",
    "format": "prettier --write .",
    "lint": "eslint . --report-unused-disable-directives --max-warnings 0",
    "lint:format": "npm run format && npm run lint",

    "zip": "bedframe zip",
    "codemod": "bedframe codemod",
    "convert:safari": "xcrun safari-web-extension-converter dist/safari --project-location . --no-open --app-name $npm_package_name@$npm_package_version-safari-web-extension",

  },
  "dependencies": {
    "react": "^18.2.0",
    "react-chrome-extension-router": "^1.4.0",
    "react-dom": "^18.2.0",
    "react-frame-component": "^5.2.6",

    "@radix-ui/react-dropdown-menu": "^2.0.5",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-menubar": "^1.0.3",
    "@radix-ui/react-navigation-menu": "^1.1.3",
    "@radix-ui/react-slot": "^1.0.2",
    "@radix-ui/react-tabs": "^1.0.4",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.0.0",
    "lucide-react": "^0.271.0",
    "react-icons": "^4.10.1",
    "tailwind-merge": "^1.14.0",
    "tailwindcss-animate": "^1.0.7"
  },
  "devDependencies": {
    "@bedframe/cli": "^0.0.72",
    "@bedframe/core": "^0.0.37",

    "@types/node": "^20.8.7",
    "@types/chrome": "^0.0.248",
    "@types/react": "^18.2.21",
    "@types/react-dom": "^18.2.7",
    "@types/react-frame-component": "^4.1.3",

    "@vitejs/plugin-react": "^4.0.4",
    "concurrently": "^8.2.1",

    "@typescript-eslint/eslint-plugin": "^6.5.0",
    "eslint": "^8.48.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-import": "^2.28.1",
    "eslint-plugin-n": "^16.0.2",
    "eslint-plugin-promise": "^6.1.1",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.3",
    "lint-staged": "^14.0.1",
    "prettier": "^3.0.3",

    "autoprefixer": "^10.4.15",
    "postcss": "^8.4.31",
    "tailwindcss": "^3.3.3",  
    "typescript": "^5.2.2",
    "unplugin-fonts": "^1.0.3",
    "vite": "^4.5.0"
  },
  "eslintConfig": {
    "globals": {
      "JSX": true
    },
    "env": {
      "browser": true,
      "es2020": true,
      "webextensions": true
    },
    "extends": [
      "eslint:recommended",
      "plugin:@typescript-eslint/recommended",
      "plugin:react-hooks/recommended",
      "prettier"
    ],
    "settings": {
      "react": {
        "version": "detect"
      }
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
      "ecmaVersion": "latest",
      "sourceType": "module",
      "project": [
        "tsconfig.json",
        "tsconfig.node.json"
      ]
    },
    "plugins": [
      "react-refresh"
    ],
    "rules": {
      "react-refresh/only-export-components": "warn",
      "react/react-in-jsx-scope": "off",
      "space-before-function-paren": "off"
    },
    "ignorePatterns": [
      "dist",
      "node_modules"
    ]
  },
  "lint-staged": {
    "*.{css,html,json,js}": [
      "prettier --write ."
    ],
    "*{js,jsx,ts,tsx}": "eslint . --fix"
  },
  "prettier": {
    "tabWidth": 2,
    "semi": false,
    "singleQuote": true
  },

}
JoeyDoey commented 7 months ago

thanks @wtfacoconut ! good catch. i'll get a fix in. meantime, should be able to just delete those trailing commas (last comma before any closing bracket). then run install and npm run lint:format to catch any other formatting issues