Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
jsonc-eslint-parser
Advanced tools
The jsonc-eslint-parser npm package is a parser that allows ESLint to lint JSONC files. JSONC (JSON with Comments) is a superset of JSON which supports comments. This parser integrates with ESLint to provide linting capabilities for JSONC files, ensuring that they are syntactically correct and adhere to specified style rules.
Linting JSONC files
This feature allows developers to lint JSONC files using ESLint by extending the recommended configuration. It helps in identifying and reporting the patterns found in JSONC files that might lead to errors.
{ "extends": "plugin:jsonc/recommended" }
Customizable rules
Developers can customize specific linting rules for JSONC files. For example, setting the 'no-octal-escape' rule to 'error' ensures that octal escapes are flagged as errors, promoting better coding practices.
{ "rules": { "jsonc/no-octal-escape": "error" } }
Integration with ESLint
This feature highlights the integration capability of jsonc-eslint-parser with ESLint, allowing it to be set as the parser in ESLint configuration files. This enables the linting of JSONC files within a project's ESLint setup.
{ "parser": "jsonc-eslint-parser" }
This package provides linting rules for JSON files. Unlike jsonc-eslint-parser, it does not support comments within JSON files but offers a similar linting capability for standard JSON.
Similar to jsonc-eslint-parser, this parser allows ESLint to lint YAML files. It supports YAML, a data serialization format that is more extensive than JSONC, providing functionality for linting a different type of data format.
JSON, JSONC and JSON5 parser for use with ESLint plugins.
This parser allows us to lint JSON, JSONC and JSON5 files. This parser and the rules of eslint-plugin-jsonc would catch some of the mistakes and code style violations.
See eslint-plugin-jsonc for details.
npm i --save-dev jsonc-eslint-parser
In your ESLint configuration file, set the overrides
> parser
property:
{
// ...
// Add the following settings.
"overrides": [
{
"files": ["*.json", "*.json5"], // Specify the extension or pattern you want to parse as JSON.
"parser": "jsonc-eslint-parser", // Set this parser.
},
],
}
The following additional configuration options are available by specifying them in parserOptions in your ESLint configuration file.
{
// ...
"overrides": [
{
"files": ["*.json", "*.json5"],
"parser": "jsonc-eslint-parser",
// Additional configuration options
"parserOptions": {
"jsonSyntax": "JSON5"
}
},
],
}
parserOptions.jsonSyntax
Set to "JSON"
, "JSONC"
or "JSON5"
. Select the JSON syntax you are using.
If not specified, all syntaxes that express static values are accepted. For example, template literals without interpolation.
Note : Recommended to loosen the syntax checking by the parser and use check rules of eslint-plugin-jsonc to automatically fix it.
jsonc-eslint-parser follows Semantic Versioning.
See the LICENSE file for license rights and limitations (MIT).
2.4.0
8027edd
Thanks @JoshuaKGoldberg! - Added ESLint-oriented types, with plugin docsFAQs
JSON, JSONC and JSON5 parser for use with ESLint plugins
The npm package jsonc-eslint-parser receives a total of 1,725,050 weekly downloads. As such, jsonc-eslint-parser popularity was classified as popular.
We found that jsonc-eslint-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.