I'm not upset that you lied to me,
I'm upset that from now on I can't believe you.

Friedrich Nietzsche

Add comments in JSON file

Spoiler: I lied.

As you know, you cannot and will never can add comments in JSON file but you can add something that seems a comment 😈:

"_____________________________CSS_____________________________": "",

Using this key:value pair separator you can tidy a long and complex JSON, for example "scripts" object in package.json

"name": "super-styleguide",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"_____________________________CSS_____________________________": "",
"stylelint": "stylelint 'src/scss/**/*.scss' || echo \"Stylelint failed for some file(s).\"",
"scss-to-css-dev": "node-sass --output-style expanded src/scss/styles/develop -o src/css/",
"css-to-postcss-dev": "postcss src/css --dir dist/css",
"styles-dev": "npm run stylelint && npm run scss-to-css-dev && npm run css-to-postcss-dev",
"_____________________________SVG_____________________________": "",
"clean-svgo": "rimraf src/icons/svgo/*",
"svg-optimize": "npm run clean-svgo && node scripts/svgo.js",
"_____________________________Webpack bundle__________________": "",
"bundle": "webpack --env.production",
"bundle:uiengine:chunk": " cross-env NODE_ENV=production webpack --env.production --config webpack.uiengine.config.js",

📚 More info

JavaScript Object Notation (JSON) - MDN

Edit this page on GitLab

Comment on DEV or Hashnode

Take me to the next post!