New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-yml

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-yml - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

2

lib/meta.d.ts
export declare const name: "eslint-plugin-yml";
export declare const version: "1.7.0";
export declare const version: "1.8.0";

@@ -5,2 +5,2 @@ "use strict";

exports.name = "eslint-plugin-yml";
exports.version = "1.7.0";
exports.version = "1.8.0";
"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -64,3 +68,3 @@ const yaml_eslint_parser_1 = require("yaml-eslint-parser");

? [
String.raw `[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]`,
String.raw(templateObject_1 || (templateObject_1 = __makeTemplateObject(["[\v\f\u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000\uFEFF]"], ["[\\v\\f\\u0085\\u00a0\\u1680\\u180e\\u2000-\\u200b\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"]))),
]

@@ -170,1 +174,2 @@ : []));

});
var templateObject_1;

@@ -42,2 +42,6 @@ "use strict";

}
getPrev() {
const prevIndex = this.index - 1;
return prevIndex >= 0 ? this.mapping.pairs[prevIndex] : null;
}
}

@@ -55,2 +59,28 @@ class YAMLMappingData {

}
getPath(sourceCode) {
let path = "";
let curr = this.node;
let p = curr.parent;
while (p) {
if (p.type === "YAMLPair") {
const name = getPropertyName(p, sourceCode);
if (/^[$_a-z][\w$]*$/iu.test(name)) {
path = `.${name}${path}`;
}
else {
path = `[${JSON.stringify(name)}]${path}`;
}
}
else if (p.type === "YAMLSequence") {
const index = p.entries.indexOf(curr);
path = `[${index}]${path}`;
}
curr = p;
p = curr.parent;
}
if (path.startsWith(".")) {
path = path.slice(1);
}
return path;
}
}

@@ -88,2 +118,3 @@ function isCompatibleWithESLintOptions(options) {

const minKeys = (_c = obj.minKeys) !== null && _c !== void 0 ? _c : 2;
const allowLineSeparatedGroups = obj.allowLineSeparatedGroups || false;
return [

@@ -95,2 +126,3 @@ {

orderText: `${natural ? "natural " : ""}${insensitive ? "insensitive " : ""}${type}ending`,
allowLineSeparatedGroups,
},

@@ -105,2 +137,3 @@ ];

const minKeys = (_b = opt.minKeys) !== null && _b !== void 0 ? _b : 2;
const allowLineSeparatedGroups = opt.allowLineSeparatedGroups || false;
if (!Array.isArray(order)) {

@@ -115,2 +148,3 @@ const type = (_c = order.type) !== null && _c !== void 0 ? _c : "asc";

orderText: `${natural ? "natural " : ""}${insensitive ? "insensitive " : ""}${type}ending`,
allowLineSeparatedGroups,
};

@@ -159,2 +193,3 @@ }

orderText: "specified",
allowLineSeparatedGroups,
};

@@ -171,26 +206,3 @@ function isTargetMapping(data) {

}
let path = "";
let curr = data.node;
let p = curr.parent;
while (p) {
if (p.type === "YAMLPair") {
const name = getPropertyName(p, sourceCode);
if (/^[$_a-z][\w$]*$/iu.test(name)) {
path = `.${name}${path}`;
}
else {
path = `[${JSON.stringify(name)}]${path}`;
}
}
else if (p.type === "YAMLSequence") {
const index = p.entries.indexOf(curr);
path = `[${index}]${path}`;
}
curr = p;
p = curr.parent;
}
if (path.startsWith(".")) {
path = path.slice(1);
}
return pathPattern.test(path);
return pathPattern.test(data.getPath(sourceCode));
}

@@ -264,2 +276,5 @@ });

},
allowLineSeparatedGroups: {
type: "boolean",
},
},

@@ -290,2 +305,5 @@ required: ["pathPattern", "order"],

},
allowLineSeparatedGroups: {
type: "boolean",
},
},

@@ -336,6 +354,16 @@ additionalProperties: false,

}
const prevList = data.mapping.pairs
.slice(0, data.index)
.reverse()
.filter((d) => !ignore(d, option));
const prevList = [];
let currTarget = data;
let prevTarget;
while ((prevTarget = currTarget.getPrev())) {
if (option.allowLineSeparatedGroups) {
if (hasBlankLine(prevTarget, currTarget)) {
break;
}
}
if (!ignore(prevTarget, option)) {
prevList.push(prevTarget);
}
currTarget = prevTarget;
}
if (prevList.length === 0) {

@@ -374,2 +402,19 @@ return;

}
function hasBlankLine(prev, next) {
const tokenOrNodes = [
...sourceCode.getTokensBetween(prev.node, next.node, {
includeComments: true,
}),
next.node,
];
let prevLoc = prev.node.loc;
for (const t of tokenOrNodes) {
const loc = t.loc;
if (loc.start.line - prevLoc.end.line > 1) {
return true;
}
prevLoc = loc;
}
return false;
}
let pairStack = {

@@ -376,0 +421,0 @@ upper: null,

{
"name": "eslint-plugin-yml",
"version": "1.7.0",
"version": "1.8.0",
"description": "This ESLint plugin provides linting rules for YAML.",

@@ -85,3 +85,3 @@ "main": "lib/index.js",

"env-cmd": "^10.1.0",
"esbuild": "^0.17.0",
"esbuild": "^0.18.0",
"esbuild-register": "^3.2.0",

@@ -96,3 +96,3 @@ "eslint": "^8.0.0",

"eslint-plugin-node": "^11.1.0",
"eslint-plugin-node-dependencies": "^0.10.0",
"eslint-plugin-node-dependencies": "^0.11.0",
"eslint-plugin-prettier": "^4.0.0",

@@ -105,3 +105,3 @@ "eslint-plugin-regexp": "^1.0.0",

"mocha": "^10.0.0",
"monaco-editor": "^0.38.0",
"monaco-editor": "^0.39.0",
"nyc": "^15.1.0",

@@ -115,3 +115,3 @@ "prettier": "^2.2.1",

"stylelint-stylus": "^0.18.0",
"typescript": "~5.0.0",
"typescript": "~5.1.0",
"vue-eslint-editor": "^1.1.0",

@@ -118,0 +118,0 @@ "vue-eslint-parser": "^9.0.0",

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