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

eslint-plugin-toml

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-toml - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

lib/rules/key-spacing.d.ts

2

lib/configs/standard.d.ts

@@ -10,2 +10,3 @@ declare const _default: {

"toml/inline-table-curly-spacing": string;
"toml/key-spacing": string;
"toml/keys-order": string;

@@ -19,3 +20,2 @@ "toml/no-space-dots": string;

"toml/quoted-keys": string;
"toml/space-eq-sign": string;
"toml/spaced-comment": string;

@@ -22,0 +22,0 @@ "toml/table-bracket-spacing": string;

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

"toml/inline-table-curly-spacing": "error",
"toml/key-spacing": "error",
"toml/keys-order": "error",

@@ -26,3 +27,2 @@ "toml/no-space-dots": "error",

"toml/quoted-keys": "error",
"toml/space-eq-sign": "error",
"toml/spaced-comment": "error",

@@ -29,0 +29,0 @@ "toml/table-bracket-spacing": "error",

@@ -33,2 +33,3 @@ import type { RuleModule } from "./types";

"toml/inline-table-curly-spacing": string;
"toml/key-spacing": string;
"toml/keys-order": string;

@@ -42,3 +43,2 @@ "toml/no-space-dots": string;

"toml/quoted-keys": string;
"toml/space-eq-sign": string;
"toml/spaced-comment": string;

@@ -45,0 +45,0 @@ "toml/table-bracket-spacing": string;

@@ -39,10 +39,10 @@ "use strict";

key,
lastNode: node,
node,
keys: [],
};
before = ((_a = lodash_1.default.last(keys)) === null || _a === void 0 ? void 0 : _a.lastNode) || null;
before = ((_a = lodash_1.default.last(keys)) === null || _a === void 0 ? void 0 : _a.node) || null;
keys.push(next);
}
else {
next.lastNode = node;
next.node = node;
}

@@ -49,0 +49,0 @@ keys = next.keys;

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

const allowBinary = Boolean((_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.allowBinary);
const sourceCode = context.getSourceCode();
function buildFixer(node, text, mark) {

@@ -68,3 +67,3 @@ if (allowHexadecimal || allowOctal || allowBinary) {

const d = mark === "x" ? 16 : mark === "o" ? 8 : 2;
const code = text.slice(2).replace(/_/gu, "");
const code = text.slice(2);
const decimalText = toDecimalText(code, d);

@@ -75,3 +74,3 @@ return fixer.replaceText(node, decimalText);

function verifyText(node) {
const text = sourceCode.getText(node);
const text = node.number;
if (text.startsWith("0")) {

@@ -78,0 +77,0 @@ const maybeMark = text[1];

@@ -84,8 +84,4 @@ "use strict";

const maxValues = getMaxValues(maxBit);
const sourceCode = context.getSourceCode();
function verifyMaxValue(node, numText, max) {
const num = numText
.replace(/_/g, "")
.replace(/^0+/, "")
.toLowerCase();
const num = numText.replace(/^0+/, "").toLowerCase();
if (num.length < max.length) {

@@ -106,3 +102,3 @@ return;

function verifyText(node) {
const text = sourceCode.getText(node);
const text = node.number;
if (text.startsWith("0")) {

@@ -109,0 +105,0 @@ const maybeMark = text[1];

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

extensionRule: false,
replacedBy: ["key-spacing"],
},
deprecated: true,
fixable: "whitespace",

@@ -13,0 +15,0 @@ schema: [],

@@ -12,3 +12,3 @@ "use strict";

if (first) {
return getFirst(first.keys) || first.firstNode;
return getFirst(first.keys) || first.node;
}

@@ -20,3 +20,3 @@ return null;

if (last) {
return getLast(last.keys) || last.lastNode;
return getLast(last.keys) || last.node;
}

@@ -46,3 +46,3 @@ return null;

function applyKey(rootKeys, node) {
const keyNames = toml_eslint_parser_1.getStaticTOMLValue(node.key);
const keyNames = [...node.resolvedKey];
let before = null;

@@ -53,10 +53,7 @@ let keys = rootKeys;

const isLast = !keyNames.length;
const nextIndex = keys.findIndex((e) => e.key === key);
if (nextIndex < 0) {
const targetNode = isLast ? node : null;
const next = {
let next = keys.find((e) => e.key === key);
if (!next) {
next = {
key,
array: node.kind === "array" && isLast,
firstNode: targetNode,
lastNode: targetNode,
node,
keys: [],

@@ -68,16 +65,6 @@ };

keys.push(next);
keys = next.keys;
}
else {
const next = keys[nextIndex];
if (next.array) {
if (isLast) {
before = getLast(next.keys) || next.lastNode;
next.lastNode = node;
next.keys = [];
break;
}
}
if (isLast) {
if (!next.firstNode && next.keys.length > 0) {
if (next.keys.length > 0) {
const after = getFirst(next.keys);

@@ -91,4 +78,4 @@ return {

}
keys = next.keys;
}
keys = next.keys;
}

@@ -95,0 +82,0 @@ return {

@@ -38,3 +38,3 @@ import type { JSONSchema4 } from "json-schema";

ruleName: string;
replacedBy?: [];
replacedBy?: string[];
default?: "error" | "warn";

@@ -61,3 +61,3 @@ extensionRule: string | false;

categories: ("recommended" | "standard")[] | null;
replacedBy?: [];
replacedBy?: string[];
default?: "error" | "warn";

@@ -64,0 +64,0 @@ extensionRule: string | false;

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

const inline_table_curly_spacing_1 = __importDefault(require("../rules/inline-table-curly-spacing"));
const key_spacing_1 = __importDefault(require("../rules/key-spacing"));
const keys_order_1 = __importDefault(require("../rules/keys-order"));

@@ -36,2 +37,3 @@ const no_mixed_type_in_array_1 = __importDefault(require("../rules/no-mixed-type-in-array"));

inline_table_curly_spacing_1.default,
key_spacing_1.default,
keys_order_1.default,

@@ -38,0 +40,0 @@ no_mixed_type_in_array_1.default,

{
"name": "eslint-plugin-toml",
"version": "0.1.0",
"version": "0.2.0",
"description": "This ESLint plugin provides linting rules for TOML.",

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

"lodash": "^4.17.19",
"toml-eslint-parser": "^0.1.1"
"toml-eslint-parser": "^0.2.1"
},

@@ -75,3 +75,3 @@ "devDependencies": {

"eslint-plugin-eslint-plugin": "^2.3.0",
"eslint-plugin-jsonc": "^0.8.1",
"eslint-plugin-jsonc": "^0.9.0",
"eslint-plugin-markdown": "^2.0.0-0",

@@ -78,0 +78,0 @@ "eslint-plugin-node": "^11.1.0",

@@ -85,3 +85,3 @@ # Introduction

"comma-spacing": "error",
"no-multi-spaces": "error",
"no-multi-spaces": ["error", { "exceptions": { "TOMLKeyValue": true } }],
"no-multiple-empty-lines": "error",

@@ -153,3 +153,2 @@ "no-trailing-spaces": "error"

| [toml/quoted-keys](https://ota-meshi.github.io/eslint-plugin-toml/rules/quoted-keys.html) | require or disallow quotes around keys | :wrench: | | :star: |
| [toml/space-eq-sign](https://ota-meshi.github.io/eslint-plugin-toml/rules/space-eq-sign.html) | require spacing around equals sign | :wrench: | | :star: |
| [toml/tables-order](https://ota-meshi.github.io/eslint-plugin-toml/rules/tables-order.html) | disallow defining tables out-of-order | :wrench: | | :star: |

@@ -167,5 +166,15 @@ | [toml/vue-custom-block/no-parsing-error](https://ota-meshi.github.io/eslint-plugin-toml/rules/vue-custom-block/no-parsing-error.html) | disallow parsing errors in Vue custom blocks | | :star: | :star: |

| [toml/inline-table-curly-spacing](https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-spacing.html) | enforce consistent spacing inside braces | :wrench: | | :star: |
| [toml/key-spacing](https://ota-meshi.github.io/eslint-plugin-toml/rules/key-spacing.html) | enforce consistent spacing between keys and values in key/value pairs | :wrench: | | :star: |
| [toml/spaced-comment](https://ota-meshi.github.io/eslint-plugin-toml/rules/spaced-comment.html) | enforce consistent spacing after the `#` in a comment | :wrench: | | :star: |
| [toml/table-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-toml/rules/table-bracket-spacing.html) | enforce consistent spacing inside table brackets | :wrench: | | :star: |
## Deprecated
- :warning: We're going to remove deprecated rules in the next major release. Please migrate to successor/new rules.
- :innocent: We don't fix bugs which are in deprecated rules since we don't have enough resources.
| Rule ID | Replaced by |
|:--------|:------------|
| [toml/space-eq-sign](https://ota-meshi.github.io/eslint-plugin-toml/rules/space-eq-sign.html) | [toml/key-spacing](https://ota-meshi.github.io/eslint-plugin-toml/rules/key-spacing.html.md) |
<!--RULES_TABLE_END-->

@@ -172,0 +181,0 @@ <!--RULES_SECTION_END-->

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