{"id":22423375,"url":"https://github.com/prantlf/rollup-plugin-jsonlint","last_synced_at":"2026-02-11T17:31:01.886Z","repository":{"id":113919200,"uuid":"230632198","full_name":"prantlf/rollup-plugin-jsonlint","owner":"prantlf","description":"Converts .json files to ES6 modules, supporting CJSON (JSON with comments) and JSON5 too.","archived":false,"fork":false,"pushed_at":"2024-08-06T09:38:39.000Z","size":246,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-10T01:55:11.402Z","etag":null,"topics":["json","jsonlint","plugin","rollup","rollup-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prantlf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-28T16:08:05.000Z","updated_at":"2024-08-06T09:38:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"2873a56d-3d50-4cd6-a80e-f984353ca1a4","html_url":"https://github.com/prantlf/rollup-plugin-jsonlint","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Frollup-plugin-jsonlint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Frollup-plugin-jsonlint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Frollup-plugin-jsonlint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prantlf%2Frollup-plugin-jsonlint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prantlf","download_url":"https://codeload.github.com/prantlf/rollup-plugin-jsonlint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228348371,"owners_count":17905899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","jsonlint","plugin","rollup","rollup-plugin"],"created_at":"2024-12-05T18:10:50.143Z","updated_at":"2026-02-11T17:30:56.843Z","avatar_url":"https://github.com/prantlf.png","language":"JavaScript","readme":"# rollup-plugin-jsonlint\n\n[![Latest version](https://img.shields.io/npm/v/rollup-plugin-jsonlint)\n ![Dependency status](https://img.shields.io/librariesio/release/npm/rollup-plugin-jsonlint)\n](https://www.npmjs.com/package/rollup-plugin-jsonlint)\n[![Code coverage](https://codecov.io/gh/prantlf/rollup-plugin-jsonlint/branch/master/graph/badge.svg)](https://codecov.io/gh/prantlf/rollup-plugin-jsonlint)\n\nA [Rollup] plugin which converts `.json` files to ES6 modules. Recognizes standard [JSON], CJSON (JSON with comments) and [JSON5] (further more flexible JSON).\n\nThis plugin started as an overwrite of [`@rollup/plugin-json`]. It supports all the original options. It leverages the parser from [`@prantlf/jsonlint`] to provide better error information in case or invalid input and to parse JSON extensions like CJSON and JSON5. If no extension is enabled, the standard `JSON.parse` will be used for the best performance.\n\n## Requirements\n\nThis plugin requires [Node.js] [LTS] (currently 18, at least 14.8) and Rollup 1.20 or newer.\n\n## Installation\n\nUsing npm:\n\n    npm i -D rollup-plugin-jsonlint\n\n## Usage\n\nCreate a `rollup.config.js` [configuration file] and import the plugin:\n\n```js\nimport jsonlint from 'rollup-plugin-jsonlint'\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'output',\n    format: 'cjs'\n  },\n  plugins: [jsonlint({ mode: 'cjson' })]\n}\n```\n\nThen call `rollup` either via the [command-line] or the [programmatically].\n\nWith an accompanying file `src/index.js`, the local `package.json` file would now be importable as seen below:\n\n```js\nimport pkg from './package.json';\nconsole.log(`Running version ${pkg.version}.`);\n```\n\n## Input Parsing Options\n\nThe following options customize the parser. If no default value is changed, only the standard JSON will be accepted.\n\n### `mode`\n\nType: `String` (`json`|`cjson`|`json5`)\u003cbr\u003e\nDefault: `json`\n\nA shortcut for setting the three boolean flags below.\n\n* `json` - expects the standard JSON (uses defaults)\n* `cjson` - expects CJSON (sets `ignoreComments` to `true`)\n* `json5` - expects JSON5 (sets `ignoreComments`, `ignoreTrailingCommas` and `allowSingleQuotedStrings` to `true`)\n\n### `ignoreBOM`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, the leading UTF-8 byte-order mark will be ignored.\n\n### `ignoreComments`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, single-line and multi-line JavaScript-style comments will be ignored as another \"whitespace\". (CJSON and JSON5 feature)\n\n### `ignoreTrailingCommas`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, trailing commas after the last object entry and array items will be ignored without throwing an error. (JSON5 feature)\n\n### `allowSingleQuotedStrings`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, single quotes will be accepted in addition to double quotes as characters for enclosing string literals within. (JSON5 feature)\n\n### `allowDuplicateObjectKeys`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `true`\n\nIf `false`, duplicate object keys will be reported as an error. Useful for detecting mistakes in configuration files, where duplicate keys usually mean old properties forgotten to be deleted.\n\n## Module Generation Options\n\nThe following options customize the ES6 module generator.\n\n### `compact`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, instructs the plugin to ignore `indent` and generate the smallest code.\n\n### `exclude`\n\nType: `String` | `Array[...String]`\u003cbr\u003e\nDefault: `null`\n\nA [minimatch pattern], or array of patterns, which specifies the files in the build the plugin should *ignore*. By default no files are ignored.\n\n### `include`\n\nType: `String` | `Array[...String]`\u003cbr\u003e\nDefault: `null`\n\nA [minimatch pattern], or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted.\n\n### `indent`\n\nType: `String`\u003cbr\u003e\nDefault: `'\\t'`\n\nSpecifies the indentation for the generated default export.\n\n### `namedExports`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `true`\n\nIf `true`, instructs the plugin to generate a named export for every property of the JSON object.\n\n### `preferConst`\n\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nIf `true`, instructs the plugin to declare properties as variables, using either `var` or `const`. This pertains to tree-shaking.\n\n## License\n\nCopyright (C) 2019-2024 Ferdinand Prantl\n\nLicensed under the [MIT License].\n\n[MIT License]: http://en.wikipedia.org/wiki/MIT_License\n[Rollup]: https://rollupjs.org/\n[JSON]: https://tools.ietf.org/html/rfc8259\n[JSON5]: https://spec.json5.org\n[`@prantlf/jsonlint`]: https://github.com/prantlf/jsonlint#readme\n[`@rollup/plugin-json`]: https://github.com/rollup/plugins/tree/master/packages/json#rollupplugin-json\n[Node.js]: https://nodejs.org/\n[LTS]: https://github.com/nodejs/Release\n[configuration file]: https://www.rollupjs.org/guide/en/#configuration-files\n[command-line]: https://www.rollupjs.org/guide/en/#command-line-reference\n[programmatically]: https://www.rollupjs.org/guide/en/#javascript-api\n[minimatch pattern]: https://github.com/isaacs/minimatch\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Frollup-plugin-jsonlint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprantlf%2Frollup-plugin-jsonlint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprantlf%2Frollup-plugin-jsonlint/lists"}