UNPKG

prettier-plugin-package-perfection

Version:

A Prettier plugin that formats the package.json file by leveraging the prettier-package-json CLI library

12 lines 575 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const prettier_package_json_1 = require("prettier-package-json"); const parser_babel_1 = require("prettier/parser-babel"); const parser = parser_babel_1.parsers['json-stringify']; exports.parsers = { 'json-stringify': Object.assign(Object.assign({}, parser), { preprocess(text, options) { const regex = /package.*json$/u; return regex.test(options.filepath) ? (0, prettier_package_json_1.format)(JSON.parse(text)) : text; } }) }; //# sourceMappingURL=main.js.map