Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonc-eslint-parser

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonc-eslint-parser - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

1

lib/index.d.ts

@@ -5,2 +5,3 @@ import { parseForESLint } from "./parser/parser";

import type * as AST from "./parser/ast";
export declare const name = "jsonc-eslint-parser";
export { parseForESLint };

@@ -7,0 +8,0 @@ export declare const VisitorKeys: import("eslint").SourceCode.VisitorKeys;

3

lib/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseJSON = exports.isUndefinedIdentifier = exports.isNumberIdentifier = exports.isExpression = exports.getStaticJSONValue = exports.traverseNodes = exports.VisitorKeys = exports.parseForESLint = void 0;
exports.parseJSON = exports.isUndefinedIdentifier = exports.isNumberIdentifier = exports.isExpression = exports.getStaticJSONValue = exports.traverseNodes = exports.VisitorKeys = exports.parseForESLint = exports.name = void 0;
const parser_1 = require("./parser/parser");

@@ -14,2 +14,3 @@ Object.defineProperty(exports, "parseForESLint", { enumerable: true, get: function () { return parser_1.parseForESLint; } });

const visitor_keys_1 = require("./parser/visitor-keys");
exports.name = "jsonc-eslint-parser";
exports.VisitorKeys = (0, visitor_keys_1.getVisitorKeys)();

@@ -16,0 +17,0 @@ function parseJSON(code, options) {

@@ -17,3 +17,3 @@ import type { Token, Comment } from "../types";

}
export declare type JSONNode = JSONProgram | JSONExpressionStatement | JSONExpression | JSONProperty | JSONIdentifier | JSONTemplateLiteral | JSONTemplateElement;
export type JSONNode = JSONProgram | JSONExpressionStatement | JSONExpression | JSONProperty | JSONIdentifier | JSONTemplateLiteral | JSONTemplateElement;
export interface JSONProgram extends BaseJSONNode {

@@ -31,3 +31,3 @@ type: "Program";

}
export declare type JSONExpression = JSONArrayExpression | JSONObjectExpression | JSONLiteral | JSONUnaryExpression | JSONNumberIdentifier | JSONUndefinedIdentifier | JSONTemplateLiteral | JSONBinaryExpression;
export type JSONExpression = JSONArrayExpression | JSONObjectExpression | JSONLiteral | JSONUnaryExpression | JSONNumberIdentifier | JSONUndefinedIdentifier | JSONTemplateLiteral | JSONBinaryExpression;
export interface JSONArrayExpression extends BaseJSONNode {

@@ -97,3 +97,3 @@ type: "JSONArrayExpression";

}
export declare type JSONLiteral = JSONStringLiteral | JSONNumberLiteral | JSONKeywordLiteral | JSONRegExpLiteral | JSONBigIntLiteral;
export type JSONLiteral = JSONStringLiteral | JSONNumberLiteral | JSONKeywordLiteral | JSONRegExpLiteral | JSONBigIntLiteral;
export interface JSONUnaryExpression extends BaseJSONNode {

@@ -100,0 +100,0 @@ type: "JSONUnaryExpression";

@@ -27,4 +27,3 @@ "use strict";

else if (token.type.keyword) {
if (token.type.keyword === "true" ||
token.type.keyword === "false") {
if (token.type.keyword === "true" || token.type.keyword === "false") {
type = "Boolean";

@@ -103,7 +102,5 @@ }

}
;
token.type = type;
token.value = value;
for (const k in additional) {
;
token[k] = additional[k];

@@ -174,4 +171,3 @@ }

function setParent(prop, parent) {
;
prop.parent = parent;
}

@@ -64,4 +64,3 @@ "use strict";

}
if (node.type === "TemplateLiteral" ||
node.type === "JSONTemplateLiteral") {
if (node.type === "TemplateLiteral" || node.type === "JSONTemplateLiteral") {
const locs = getLocation(node);

@@ -71,4 +70,3 @@ const err = new ParseError("Unexpected template literal.", locs.start, locs.loc.start.line, locs.loc.start.column + 1);

}
if (node.type.endsWith("Expression") &&
node.type !== "FunctionExpression") {
if (node.type.endsWith("Expression") && node.type !== "FunctionExpression") {
const name = node.type

@@ -75,0 +73,0 @@ .replace(/^JSON/u, "")

@@ -6,4 +6,4 @@ export interface ESPree {

export declare function getEspree(): ESPree;
declare type NewestKind = "cwd" | "linter" | "self";
type NewestKind = "cwd" | "linter" | "self";
export declare function getNewestEspreeKind(): NewestKind;
export {};

@@ -24,3 +24,4 @@ "use strict";

function isLinterPath(p) {
return (p.includes(`eslint${path_1.default.sep}lib${path_1.default.sep}linter${path_1.default.sep}linter.js`) || p.includes(`eslint${path_1.default.sep}lib${path_1.default.sep}linter.js`));
return (p.includes(`eslint${path_1.default.sep}lib${path_1.default.sep}linter${path_1.default.sep}linter.js`) ||
p.includes(`eslint${path_1.default.sep}lib${path_1.default.sep}linter.js`));
}

@@ -27,0 +28,0 @@ function getRequireFromLinter() {

@@ -34,3 +34,2 @@ "use strict";

for (const node of nodes) {
;
node.type = `JSON${node.type}`;

@@ -37,0 +36,0 @@ }

@@ -1,2 +0,2 @@

export declare type JSONSyntaxContext = {
export type JSONSyntaxContext = {
trailingCommas: boolean;

@@ -3,0 +3,0 @@ comments: boolean;

import type { AST } from "eslint";
import type { SourceLocation } from "./ast";
export declare type MaybeNodeOrToken = {
export type MaybeNodeOrToken = {
range?: [number, number];

@@ -5,0 +5,0 @@ loc?: SourceLocation | null;

@@ -404,4 +404,3 @@ "use strict";

function setParent(prop, parent) {
;
prop.parent = parent;
}

@@ -6,7 +6,7 @@ import type { AST } from "eslint";

}
export declare type Token = AST.Token;
export declare type Comment = ESTreeComment;
export declare type JSONSyntax = "JSON" | "JSONC" | "JSON5" | null;
export type Token = AST.Token;
export type Comment = ESTreeComment;
export type JSONSyntax = "JSON" | "JSONC" | "JSON5" | null;
export interface ParserOptions {
jsonSyntax?: JSONSyntax;
}

@@ -5,4 +5,4 @@ import type { JSONNode, JSONExpression, JSONNumberIdentifier, JSONIdentifier, JSONObjectExpression, JSONArrayExpression, JSONUnaryExpression, JSONNumberLiteral, JSONExpressionStatement, JSONProgram, JSONUndefinedIdentifier, JSONTemplateLiteral, JSONTemplateElement, JSONStringLiteral, JSONKeywordLiteral, JSONRegExpLiteral, JSONBigIntLiteral, JSONLiteral, JSONBinaryExpression } from "../parser/ast";

export declare function isUndefinedIdentifier(node: JSONIdentifier): node is JSONUndefinedIdentifier;
export declare type JSONValue = string | number | boolean | null | undefined | JSONObjectValue | JSONValue[] | RegExp | bigint;
export declare type JSONObjectValue = {
export type JSONValue = string | number | boolean | null | undefined | JSONObjectValue | JSONValue[] | RegExp | bigint;
export type JSONObjectValue = {
[key: string]: JSONValue;

@@ -9,0 +9,0 @@ };

@@ -49,5 +49,3 @@ "use strict";

JSONProperty(node) {
const keyName = node.key.type === "JSONLiteral"
? `${node.key.value}`
: node.key.name;
const keyName = node.key.type === "JSONLiteral" ? `${node.key.value}` : node.key.name;
return {

@@ -54,0 +52,0 @@ [keyName]: getStaticJSONValue(node.value),

{
"name": "jsonc-eslint-parser",
"version": "2.1.0",
"description": "JSON, JSONC and JSON5 parser for use with ESLint plugins",
"main": "lib/index.js",
"files": [
"lib"
],
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"scripts": {
"build": "npm run build:ts",
"build:ts": "tsc --project ./tsconfig.build.json",
"clean": "rimraf .nyc_output lib coverage",
"lint": "eslint . --ext .js,.ts,.json",
"eslint-fix": "eslint . --ext .js,.ts,.json --fix",
"test:base": "mocha --require ts-node/register \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"test": "npm run test:base",
"test:nyc": "nyc --reporter=lcov npm run test:base",
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/src/**/*.ts\" --reporter dot",
"update": "ts-node ./tools/update.ts && npm run eslint-fix && npm run test:nyc",
"preversion": "npm test && npm run update && git add .",
"version": "npm run eslint-fix && git add .",
"update-fixtures": "ts-node ./tools/update-fixtures.ts",
"benchmark": "ts-node --transpile-only benchmark/index.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ota-meshi/jsonc-eslint-parser.git"
},
"keywords": [
"eslint",
"json",
"jsonc",
"json5",
"parser"
],
"author": "Yosuke Ota",
"funding": "https://github.com/sponsors/ota-meshi",
"license": "MIT",
"bugs": {
"url": "https://github.com/ota-meshi/jsonc-eslint-parser/issues"
},
"homepage": "https://github.com/ota-meshi/jsonc-eslint-parser#readme",
"devDependencies": {
"@ota-meshi/eslint-plugin": "^0.10.0",
"@types/benchmark": "^2.1.0",
"@types/eslint": "^8.0.0",
"@types/eslint-visitor-keys": "^1.0.0",
"@types/estree": "^0.0.50",
"@types/mocha": "^9.0.0",
"@types/natural-compare": "^1.4.0",
"@types/node": "^16.0.0",
"@types/semver": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"benchmark": "^2.1.4",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-json-schema-validator": "^2.0.0",
"eslint-plugin-jsonc": "^2.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.6.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-regexp": "^1.0.0",
"eslint-plugin-vue": "^8.0.0",
"mocha": "^9.0.0",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"ts-node": "^10.0.0",
"typescript": "^4.0.0",
"vue-eslint-parser": "^8.0.0"
},
"dependencies": {
"acorn": "^8.5.0",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"semver": "^7.3.5"
}
"name": "jsonc-eslint-parser",
"version": "2.2.0",
"description": "JSON, JSONC and JSON5 parser for use with ESLint plugins",
"main": "lib/index.js",
"files": [
"lib"
],
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"scripts": {
"build": "npm run build:ts",
"build:ts": "tsc --project ./tsconfig.build.json",
"clean": "rimraf .nyc_output lib coverage",
"lint": "eslint . --ext .js,.ts,.json",
"eslint-fix": "eslint . --ext .js,.ts,.json --fix",
"test:base": "mocha --require ts-node/register \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
"test": "npm run test:base",
"test:nyc": "nyc --reporter=lcov npm run test:base",
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/src/**/*.ts\" --reporter dot",
"update": "ts-node ./tools/update.ts && npm run eslint-fix && npm run test:nyc",
"preversion": "npm test && npm run update && git add .",
"version": "npm run eslint-fix && git add .",
"update-fixtures": "ts-node ./tools/update-fixtures.ts",
"benchmark": "ts-node --transpile-only benchmark/index.ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ota-meshi/jsonc-eslint-parser.git"
},
"keywords": [
"eslint",
"json",
"jsonc",
"json5",
"parser"
],
"author": "Yosuke Ota",
"funding": "https://github.com/sponsors/ota-meshi",
"license": "MIT",
"bugs": {
"url": "https://github.com/ota-meshi/jsonc-eslint-parser/issues"
},
"homepage": "https://github.com/ota-meshi/jsonc-eslint-parser#readme",
"devDependencies": {
"@ota-meshi/eslint-plugin": "^0.13.0",
"@types/benchmark": "^2.1.0",
"@types/eslint": "^8.0.0",
"@types/eslint-visitor-keys": "^1.0.0",
"@types/estree": "^1.0.0",
"@types/mocha": "^10.0.0",
"@types/natural-compare": "^1.4.0",
"@types/node": "^18.0.0",
"@types/semver": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"benchmark": "^2.1.4",
"eslint": "^8.0.0",
"eslint-config-prettier": "^8.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-json-schema-validator": "^4.0.0",
"eslint-plugin-jsonc": "^2.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.10.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-regexp": "^1.0.0",
"eslint-plugin-vue": "^9.0.0",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"ts-node": "^10.0.0",
"typescript": "^4.0.0",
"vue-eslint-parser": "^9.0.0"
},
"dependencies": {
"acorn": "^8.5.0",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"semver": "^7.3.5"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc