immosquare-cleaner 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immosquare-cleaner/version.rb +1 -1
- data/lib/immosquare-cleaner.rb +3 -2
- data/linters/eslintrc.json +54 -27
- data/package.json +7 -8
- metadata +30 -69
- data/node_modules/eslint-plugin-jsonc/LICENSE +0 -21
- data/node_modules/eslint-plugin-jsonc/README.md +0 -279
- data/node_modules/eslint-plugin-jsonc/conf/eslint-all.js +0 -11
- data/node_modules/eslint-plugin-jsonc/conf/eslint-recommended.js +0 -13
- data/node_modules/eslint-plugin-jsonc/conf/rules.js +0 -10
- data/node_modules/eslint-plugin-jsonc/dist/configs/all.js +0 -18
- data/node_modules/eslint-plugin-jsonc/dist/configs/auto-config.js +0 -13
- data/node_modules/eslint-plugin-jsonc/dist/configs/base.js +0 -15
- data/node_modules/eslint-plugin-jsonc/dist/configs/prettier.js +0 -26
- data/node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-json.js +0 -41
- data/node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-json5.js +0 -30
- data/node_modules/eslint-plugin-jsonc/dist/configs/recommended-with-jsonc.js +0 -39
- data/node_modules/eslint-plugin-jsonc/dist/index.js +0 -68
- data/node_modules/eslint-plugin-jsonc/dist/meta.js +0 -5
- data/node_modules/eslint-plugin-jsonc/dist/rules/array-bracket-newline.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/array-bracket-spacing.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/array-element-newline.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/auto.js +0 -66
- data/node_modules/eslint-plugin-jsonc/dist/rules/comma-dangle.js +0 -27
- data/node_modules/eslint-plugin-jsonc/dist/rules/comma-style.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/indent.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/key-name-casing.js +0 -94
- data/node_modules/eslint-plugin-jsonc/dist/rules/key-spacing.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-bigint-literals.js +0 -33
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-binary-expression.js +0 -38
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-binary-numeric-literals.js +0 -39
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-comments.js +0 -34
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-dupe-keys.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-escape-sequence-in-identifier.js +0 -57
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-floating-decimal.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-hexadecimal-numeric-literals.js +0 -39
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-infinity.js +0 -37
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-irregular-whitespace.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-multi-str.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-nan.js +0 -37
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-number-props.js +0 -41
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-numeric-separators.js +0 -42
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-octal-escape.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-octal-numeric-literals.js +0 -39
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-octal.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-parenthesized.js +0 -70
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-plus-sign.js +0 -39
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-regexp-literals.js +0 -33
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-sparse-arrays.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-template-literals.js +0 -36
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-undefined-value.js +0 -35
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-unicode-codepoint-escapes.js +0 -73
- data/node_modules/eslint-plugin-jsonc/dist/rules/no-useless-escape.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/object-curly-newline.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/object-curly-spacing.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/object-property-newline.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/quote-props.js +0 -27
- data/node_modules/eslint-plugin-jsonc/dist/rules/quotes.js +0 -27
- data/node_modules/eslint-plugin-jsonc/dist/rules/sort-array-values.js +0 -371
- data/node_modules/eslint-plugin-jsonc/dist/rules/sort-keys.js +0 -413
- data/node_modules/eslint-plugin-jsonc/dist/rules/space-unary-ops.js +0 -23
- data/node_modules/eslint-plugin-jsonc/dist/rules/valid-json-number.js +0 -138
- data/node_modules/eslint-plugin-jsonc/dist/rules/vue-custom-block/no-parsing-error.js +0 -86
- data/node_modules/eslint-plugin-jsonc/dist/types.js +0 -2
- data/node_modules/eslint-plugin-jsonc/dist/utils/casing.js +0 -134
- data/node_modules/eslint-plugin-jsonc/dist/utils/get-auto-jsonc-rules-config.js +0 -97
- data/node_modules/eslint-plugin-jsonc/dist/utils/index.js +0 -121
- data/node_modules/eslint-plugin-jsonc/dist/utils/rules.js +0 -96
- data/node_modules/eslint-plugin-jsonc/index.d.ts +0 -364
- data/node_modules/eslint-plugin-jsonc/package.json +0 -123
@@ -1,38 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const jsonc_eslint_parser_1 = require("jsonc-eslint-parser");
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
exports.default = (0, utils_1.createRule)("no-binary-expression", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow binary expression",
|
9
|
-
recommended: ["json", "jsonc", "json5"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
fixable: "code",
|
14
|
-
hasSuggestions: false,
|
15
|
-
schema: [],
|
16
|
-
messages: {
|
17
|
-
disallow: "The binary expressions are not allowed.",
|
18
|
-
},
|
19
|
-
type: "problem",
|
20
|
-
},
|
21
|
-
create(context) {
|
22
|
-
if (!context.parserServices.isJSON) {
|
23
|
-
return {};
|
24
|
-
}
|
25
|
-
return {
|
26
|
-
JSONBinaryExpression(node) {
|
27
|
-
context.report({
|
28
|
-
loc: node.loc,
|
29
|
-
messageId: "disallow",
|
30
|
-
fix(fixer) {
|
31
|
-
const value = (0, jsonc_eslint_parser_1.getStaticJSONValue)(node);
|
32
|
-
return fixer.replaceTextRange(node.range, JSON.stringify(value));
|
33
|
-
},
|
34
|
-
});
|
35
|
-
},
|
36
|
-
};
|
37
|
-
},
|
38
|
-
});
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
const binaryNumericLiteralPattern = /^0[Bb]/u;
|
5
|
-
exports.default = (0, utils_1.createRule)("no-binary-numeric-literals", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow binary numeric literals",
|
9
|
-
recommended: ["json", "jsonc", "json5"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
fixable: "code",
|
14
|
-
messages: {
|
15
|
-
disallow: "Binary numeric literals should not be used.",
|
16
|
-
},
|
17
|
-
schema: [],
|
18
|
-
type: "problem",
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
if (!context.parserServices.isJSON) {
|
22
|
-
return {};
|
23
|
-
}
|
24
|
-
return {
|
25
|
-
JSONLiteral(node) {
|
26
|
-
if (typeof node.value === "number" &&
|
27
|
-
binaryNumericLiteralPattern.test(node.raw)) {
|
28
|
-
context.report({
|
29
|
-
loc: node.loc,
|
30
|
-
messageId: "disallow",
|
31
|
-
fix: (fixer) => {
|
32
|
-
return fixer.replaceTextRange(node.range, `${node.value}`);
|
33
|
-
},
|
34
|
-
});
|
35
|
-
}
|
36
|
-
},
|
37
|
-
};
|
38
|
-
},
|
39
|
-
});
|
@@ -1,34 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
exports.default = (0, utils_1.createRule)("no-comments", {
|
5
|
-
meta: {
|
6
|
-
docs: {
|
7
|
-
description: "disallow comments",
|
8
|
-
recommended: ["json"],
|
9
|
-
extensionRule: false,
|
10
|
-
layout: false,
|
11
|
-
},
|
12
|
-
schema: [],
|
13
|
-
messages: {
|
14
|
-
unexpected: "Unexpected comment.",
|
15
|
-
},
|
16
|
-
type: "problem",
|
17
|
-
},
|
18
|
-
create(context) {
|
19
|
-
if (!context.parserServices.isJSON) {
|
20
|
-
return {};
|
21
|
-
}
|
22
|
-
const sourceCode = context.getSourceCode();
|
23
|
-
return {
|
24
|
-
Program() {
|
25
|
-
for (const comment of sourceCode.getAllComments()) {
|
26
|
-
context.report({
|
27
|
-
loc: comment.loc,
|
28
|
-
messageId: "unexpected",
|
29
|
-
});
|
30
|
-
}
|
31
|
-
},
|
32
|
-
};
|
33
|
-
},
|
34
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
const coreRule = (0, utils_1.getCoreRule)("no-dupe-keys");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-dupe-keys", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow duplicate keys in object literals",
|
10
|
-
recommended: ["json", "jsonc", "json5"],
|
11
|
-
extensionRule: true,
|
12
|
-
layout: false,
|
13
|
-
},
|
14
|
-
fixable: (_a = coreRule.meta) === null || _a === void 0 ? void 0 : _a.fixable,
|
15
|
-
hasSuggestions: coreRule.meta.hasSuggestions,
|
16
|
-
schema: coreRule.meta.schema,
|
17
|
-
messages: coreRule.meta.messages,
|
18
|
-
type: coreRule.meta.type,
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
return (0, utils_1.defineWrapperListener)(coreRule, context, context.options);
|
22
|
-
},
|
23
|
-
});
|
@@ -1,57 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
const eslint_utils_1 = require("@eslint-community/eslint-utils");
|
5
|
-
exports.default = (0, utils_1.createRule)("no-escape-sequence-in-identifier", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow escape sequences in identifiers.",
|
9
|
-
recommended: ["json", "jsonc", "json5"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
fixable: "code",
|
14
|
-
messages: {
|
15
|
-
disallow: "Escape sequence in identifiers should not be used.",
|
16
|
-
},
|
17
|
-
schema: [],
|
18
|
-
type: "problem",
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
if (!context.parserServices.isJSON) {
|
22
|
-
return {};
|
23
|
-
}
|
24
|
-
const sourceCode = context.getSourceCode();
|
25
|
-
return {
|
26
|
-
JSONIdentifier(node) {
|
27
|
-
verify(node);
|
28
|
-
},
|
29
|
-
};
|
30
|
-
function verify(node) {
|
31
|
-
const escapeMatcher = new eslint_utils_1.PatternMatcher(/\\u\{[\dA-Fa-f]+\}|\\u\d{4}/gu);
|
32
|
-
const text = sourceCode.text.slice(...node.range);
|
33
|
-
for (const match of escapeMatcher.execAll(text)) {
|
34
|
-
const start = match.index;
|
35
|
-
const end = start + match[0].length;
|
36
|
-
const range = [
|
37
|
-
start + node.range[0],
|
38
|
-
end + node.range[0],
|
39
|
-
];
|
40
|
-
context.report({
|
41
|
-
loc: {
|
42
|
-
start: sourceCode.getLocFromIndex(range[0]),
|
43
|
-
end: sourceCode.getLocFromIndex(range[1]),
|
44
|
-
},
|
45
|
-
messageId: "disallow",
|
46
|
-
fix(fixer) {
|
47
|
-
const codePointStr = match[0][2] === "{"
|
48
|
-
? text.slice(start + 3, end - 1)
|
49
|
-
: text.slice(start + 2, end);
|
50
|
-
const codePoint = Number(`0x${codePointStr}`);
|
51
|
-
return fixer.replaceTextRange(range, String.fromCodePoint(codePoint));
|
52
|
-
},
|
53
|
-
});
|
54
|
-
}
|
55
|
-
}
|
56
|
-
},
|
57
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
const coreRule = (0, utils_1.getCoreRule)("no-floating-decimal");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-floating-decimal", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow leading or trailing decimal points in numeric literals",
|
10
|
-
recommended: ["json", "jsonc"],
|
11
|
-
extensionRule: true,
|
12
|
-
layout: true,
|
13
|
-
},
|
14
|
-
fixable: (_a = coreRule.meta) === null || _a === void 0 ? void 0 : _a.fixable,
|
15
|
-
hasSuggestions: coreRule.meta.hasSuggestions,
|
16
|
-
schema: coreRule.meta.schema,
|
17
|
-
messages: coreRule.meta.messages,
|
18
|
-
type: coreRule.meta.type,
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
return (0, utils_1.defineWrapperListener)(coreRule, context, context.options);
|
22
|
-
},
|
23
|
-
});
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
const hexadecimalNumericLiteralPattern = /^0[Xx]/u;
|
5
|
-
exports.default = (0, utils_1.createRule)("no-hexadecimal-numeric-literals", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow hexadecimal numeric literals",
|
9
|
-
recommended: ["json", "jsonc"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
fixable: "code",
|
14
|
-
messages: {
|
15
|
-
disallow: "Hexadecimal numeric literals should not be used.",
|
16
|
-
},
|
17
|
-
schema: [],
|
18
|
-
type: "problem",
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
if (!context.parserServices.isJSON) {
|
22
|
-
return {};
|
23
|
-
}
|
24
|
-
return {
|
25
|
-
JSONLiteral(node) {
|
26
|
-
if (typeof node.value === "number" &&
|
27
|
-
hexadecimalNumericLiteralPattern.test(node.raw)) {
|
28
|
-
context.report({
|
29
|
-
loc: node.loc,
|
30
|
-
messageId: "disallow",
|
31
|
-
fix: (fixer) => {
|
32
|
-
return fixer.replaceTextRange(node.range, `${node.value}`);
|
33
|
-
},
|
34
|
-
});
|
35
|
-
}
|
36
|
-
},
|
37
|
-
};
|
38
|
-
},
|
39
|
-
});
|
@@ -1,37 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const jsonc_eslint_parser_1 = require("jsonc-eslint-parser");
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
exports.default = (0, utils_1.createRule)("no-infinity", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow Infinity",
|
9
|
-
recommended: ["json", "jsonc"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
messages: {
|
14
|
-
disallow: "Infinity should not be used.",
|
15
|
-
},
|
16
|
-
schema: [],
|
17
|
-
type: "problem",
|
18
|
-
},
|
19
|
-
create(context) {
|
20
|
-
if (!context.parserServices.isJSON) {
|
21
|
-
return {};
|
22
|
-
}
|
23
|
-
return {
|
24
|
-
JSONIdentifier(node) {
|
25
|
-
if (!(0, jsonc_eslint_parser_1.isNumberIdentifier)(node)) {
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
if (node.name === "Infinity") {
|
29
|
-
context.report({
|
30
|
-
loc: node.loc,
|
31
|
-
messageId: "disallow",
|
32
|
-
});
|
33
|
-
}
|
34
|
-
},
|
35
|
-
};
|
36
|
-
},
|
37
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a, _b;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
const coreRule = (0, utils_1.getCoreRule)("no-irregular-whitespace");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-irregular-whitespace", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow irregular whitespace",
|
10
|
-
recommended: null,
|
11
|
-
extensionRule: true,
|
12
|
-
layout: false,
|
13
|
-
},
|
14
|
-
fixable: (_a = coreRule.meta) === null || _a === void 0 ? void 0 : _a.fixable,
|
15
|
-
hasSuggestions: (_b = coreRule.meta) === null || _b === void 0 ? void 0 : _b.hasSuggestions,
|
16
|
-
schema: coreRule.meta.schema,
|
17
|
-
messages: coreRule.meta.messages,
|
18
|
-
type: coreRule.meta.type,
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
return (0, utils_1.defineWrapperListener)(coreRule, context, context.options);
|
22
|
-
},
|
23
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
const coreRule = (0, utils_1.getCoreRule)("no-multi-str");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-multi-str", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow multiline strings",
|
10
|
-
recommended: ["json", "jsonc"],
|
11
|
-
extensionRule: true,
|
12
|
-
layout: false,
|
13
|
-
},
|
14
|
-
fixable: (_a = coreRule.meta) === null || _a === void 0 ? void 0 : _a.fixable,
|
15
|
-
hasSuggestions: coreRule.meta.hasSuggestions,
|
16
|
-
schema: coreRule.meta.schema,
|
17
|
-
messages: Object.assign(Object.assign({}, coreRule.meta.messages), { multilineString: "Multiline support is limited to JSON5 only." }),
|
18
|
-
type: coreRule.meta.type,
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
return (0, utils_1.defineWrapperListener)(coreRule, context, context.options);
|
22
|
-
},
|
23
|
-
});
|
@@ -1,37 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const jsonc_eslint_parser_1 = require("jsonc-eslint-parser");
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
exports.default = (0, utils_1.createRule)("no-nan", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow NaN",
|
9
|
-
recommended: ["json", "jsonc"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
messages: {
|
14
|
-
disallow: "NaN should not be used.",
|
15
|
-
},
|
16
|
-
schema: [],
|
17
|
-
type: "problem",
|
18
|
-
},
|
19
|
-
create(context) {
|
20
|
-
if (!context.parserServices.isJSON) {
|
21
|
-
return {};
|
22
|
-
}
|
23
|
-
return {
|
24
|
-
JSONIdentifier(node) {
|
25
|
-
if (!(0, jsonc_eslint_parser_1.isNumberIdentifier)(node)) {
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
if (node.name === "NaN") {
|
29
|
-
context.report({
|
30
|
-
loc: node.loc,
|
31
|
-
messageId: "disallow",
|
32
|
-
});
|
33
|
-
}
|
34
|
-
},
|
35
|
-
};
|
36
|
-
},
|
37
|
-
});
|
@@ -1,41 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
exports.default = (0, utils_1.createRule)("no-number-props", {
|
5
|
-
meta: {
|
6
|
-
docs: {
|
7
|
-
description: "disallow number property keys",
|
8
|
-
recommended: ["json", "jsonc", "json5"],
|
9
|
-
extensionRule: false,
|
10
|
-
layout: false,
|
11
|
-
},
|
12
|
-
fixable: "code",
|
13
|
-
schema: [],
|
14
|
-
messages: {
|
15
|
-
unexpected: "The number property keys are not allowed.",
|
16
|
-
},
|
17
|
-
type: "problem",
|
18
|
-
},
|
19
|
-
create(context) {
|
20
|
-
if (!context.parserServices.isJSON) {
|
21
|
-
return {};
|
22
|
-
}
|
23
|
-
return {
|
24
|
-
JSONProperty(node) {
|
25
|
-
if (node.key.type !== "JSONLiteral") {
|
26
|
-
return;
|
27
|
-
}
|
28
|
-
if (typeof node.key.value === "number") {
|
29
|
-
const raw = node.key.raw;
|
30
|
-
context.report({
|
31
|
-
loc: node.key.loc,
|
32
|
-
messageId: "unexpected",
|
33
|
-
fix(fixer) {
|
34
|
-
return fixer.replaceTextRange(node.key.range, `"${raw}"`);
|
35
|
-
},
|
36
|
-
});
|
37
|
-
}
|
38
|
-
},
|
39
|
-
};
|
40
|
-
},
|
41
|
-
});
|
@@ -1,42 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
exports.default = (0, utils_1.createRule)("no-numeric-separators", {
|
5
|
-
meta: {
|
6
|
-
docs: {
|
7
|
-
description: "disallow numeric separators",
|
8
|
-
recommended: ["json", "jsonc", "json5"],
|
9
|
-
extensionRule: false,
|
10
|
-
layout: false,
|
11
|
-
},
|
12
|
-
fixable: "code",
|
13
|
-
schema: [],
|
14
|
-
messages: {
|
15
|
-
unexpected: "Numeric separators are not allowed.",
|
16
|
-
},
|
17
|
-
type: "problem",
|
18
|
-
},
|
19
|
-
create(context) {
|
20
|
-
if (!context.parserServices.isJSON) {
|
21
|
-
return {};
|
22
|
-
}
|
23
|
-
const sourceCode = context.getSourceCode();
|
24
|
-
return {
|
25
|
-
JSONLiteral(node) {
|
26
|
-
if (typeof node.value !== "number") {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
const text = sourceCode.text.slice(...node.range);
|
30
|
-
if (text.includes("_")) {
|
31
|
-
context.report({
|
32
|
-
loc: node.loc,
|
33
|
-
messageId: "unexpected",
|
34
|
-
fix(fixer) {
|
35
|
-
return fixer.replaceTextRange(node.range, text.replace(/_/g, ""));
|
36
|
-
},
|
37
|
-
});
|
38
|
-
}
|
39
|
-
},
|
40
|
-
};
|
41
|
-
},
|
42
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
const coreRule = (0, utils_1.getCoreRule)("no-octal-escape");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-octal-escape", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow octal escape sequences in string literals",
|
10
|
-
recommended: null,
|
11
|
-
extensionRule: true,
|
12
|
-
layout: false,
|
13
|
-
},
|
14
|
-
fixable: (_a = coreRule.meta) === null || _a === void 0 ? void 0 : _a.fixable,
|
15
|
-
hasSuggestions: coreRule.meta.hasSuggestions,
|
16
|
-
schema: coreRule.meta.schema,
|
17
|
-
messages: coreRule.meta.messages,
|
18
|
-
type: coreRule.meta.type,
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
return (0, utils_1.defineWrapperListener)(coreRule, context, context.options);
|
22
|
-
},
|
23
|
-
});
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
const octalNumericLiteralPattern = /^0[Oo]/u;
|
5
|
-
exports.default = (0, utils_1.createRule)("no-octal-numeric-literals", {
|
6
|
-
meta: {
|
7
|
-
docs: {
|
8
|
-
description: "disallow octal numeric literals",
|
9
|
-
recommended: ["json", "jsonc", "json5"],
|
10
|
-
extensionRule: false,
|
11
|
-
layout: false,
|
12
|
-
},
|
13
|
-
fixable: "code",
|
14
|
-
messages: {
|
15
|
-
disallow: "Octal numeric literals should not be used.",
|
16
|
-
},
|
17
|
-
schema: [],
|
18
|
-
type: "problem",
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
if (!context.parserServices.isJSON) {
|
22
|
-
return {};
|
23
|
-
}
|
24
|
-
return {
|
25
|
-
JSONLiteral(node) {
|
26
|
-
if (typeof node.value === "number" &&
|
27
|
-
octalNumericLiteralPattern.test(node.raw)) {
|
28
|
-
context.report({
|
29
|
-
loc: node.loc,
|
30
|
-
messageId: "disallow",
|
31
|
-
fix: (fixer) => {
|
32
|
-
return fixer.replaceTextRange(node.range, `${node.value}`);
|
33
|
-
},
|
34
|
-
});
|
35
|
-
}
|
36
|
-
},
|
37
|
-
};
|
38
|
-
},
|
39
|
-
});
|
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var _a;
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const utils_1 = require("../utils");
|
5
|
-
const coreRule = (0, utils_1.getCoreRule)("no-octal");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-octal", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow legacy octal literals",
|
10
|
-
recommended: ["json", "jsonc", "json5"],
|
11
|
-
extensionRule: true,
|
12
|
-
layout: false,
|
13
|
-
},
|
14
|
-
fixable: (_a = coreRule.meta) === null || _a === void 0 ? void 0 : _a.fixable,
|
15
|
-
hasSuggestions: coreRule.meta.hasSuggestions,
|
16
|
-
schema: coreRule.meta.schema,
|
17
|
-
messages: coreRule.meta.messages,
|
18
|
-
type: coreRule.meta.type,
|
19
|
-
},
|
20
|
-
create(context) {
|
21
|
-
return (0, utils_1.defineWrapperListener)(coreRule, context, context.options);
|
22
|
-
},
|
23
|
-
});
|
@@ -1,70 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const eslint_utils_1 = require("@eslint-community/eslint-utils");
|
4
|
-
const jsonc_eslint_parser_1 = require("jsonc-eslint-parser");
|
5
|
-
const utils_1 = require("../utils");
|
6
|
-
exports.default = (0, utils_1.createRule)("no-parenthesized", {
|
7
|
-
meta: {
|
8
|
-
docs: {
|
9
|
-
description: "disallow parentheses around the expression",
|
10
|
-
recommended: ["json", "jsonc", "json5"],
|
11
|
-
extensionRule: false,
|
12
|
-
layout: false,
|
13
|
-
},
|
14
|
-
fixable: "code",
|
15
|
-
hasSuggestions: false,
|
16
|
-
schema: [],
|
17
|
-
messages: {
|
18
|
-
disallow: "Parentheses around expression should not be used.",
|
19
|
-
},
|
20
|
-
type: "problem",
|
21
|
-
},
|
22
|
-
create(context) {
|
23
|
-
if (!context.parserServices.isJSON) {
|
24
|
-
return {};
|
25
|
-
}
|
26
|
-
const sourceCode = context.getSourceCode();
|
27
|
-
const handlers = {
|
28
|
-
JSONArrayExpression: handler,
|
29
|
-
JSONBinaryExpression: handler,
|
30
|
-
JSONIdentifier: handler,
|
31
|
-
JSONLiteral: handler,
|
32
|
-
JSONObjectExpression: handler,
|
33
|
-
JSONTemplateLiteral: handler,
|
34
|
-
JSONUnaryExpression: handler,
|
35
|
-
};
|
36
|
-
return handlers;
|
37
|
-
function handler(node) {
|
38
|
-
if (!(0, jsonc_eslint_parser_1.isExpression)(node) || !(0, eslint_utils_1.isParenthesized)(node, sourceCode)) {
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
const leftParen = sourceCode.getTokenBefore(node);
|
42
|
-
const rightParen = sourceCode.getTokenAfter(node);
|
43
|
-
context.report({
|
44
|
-
loc: leftParen.loc,
|
45
|
-
messageId: "disallow",
|
46
|
-
fix,
|
47
|
-
});
|
48
|
-
context.report({
|
49
|
-
loc: rightParen.loc,
|
50
|
-
messageId: "disallow",
|
51
|
-
fix,
|
52
|
-
});
|
53
|
-
function fix(fixer) {
|
54
|
-
const parent = node.parent;
|
55
|
-
if (!parent) {
|
56
|
-
return [];
|
57
|
-
}
|
58
|
-
if (parent.type !== "JSONArrayExpression" &&
|
59
|
-
parent.type !== "JSONExpressionStatement" &&
|
60
|
-
parent.type !== "JSONProperty") {
|
61
|
-
return [];
|
62
|
-
}
|
63
|
-
return [
|
64
|
-
fixer.removeRange(leftParen.range),
|
65
|
-
fixer.removeRange(rightParen.range),
|
66
|
-
];
|
67
|
-
}
|
68
|
-
}
|
69
|
-
},
|
70
|
-
});
|
@@ -1,39 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("../utils");
|
4
|
-
exports.default = (0, utils_1.createRule)("no-plus-sign", {
|
5
|
-
meta: {
|
6
|
-
docs: {
|
7
|
-
description: "disallow plus sign",
|
8
|
-
recommended: ["json", "jsonc"],
|
9
|
-
extensionRule: false,
|
10
|
-
layout: false,
|
11
|
-
},
|
12
|
-
fixable: "code",
|
13
|
-
messages: {
|
14
|
-
disallow: "Plus sign should not be used.",
|
15
|
-
},
|
16
|
-
schema: [],
|
17
|
-
type: "problem",
|
18
|
-
},
|
19
|
-
create(context) {
|
20
|
-
if (!context.parserServices.isJSON) {
|
21
|
-
return {};
|
22
|
-
}
|
23
|
-
const sourceCode = context.getSourceCode();
|
24
|
-
return {
|
25
|
-
JSONUnaryExpression(node) {
|
26
|
-
if (node.operator === "+") {
|
27
|
-
const operator = sourceCode.getFirstToken(node, (token) => token.type === "Punctuator" && token.value === node.operator);
|
28
|
-
context.report({
|
29
|
-
loc: (operator === null || operator === void 0 ? void 0 : operator.loc) || node.loc,
|
30
|
-
messageId: "disallow",
|
31
|
-
fix(fixer) {
|
32
|
-
return operator ? fixer.removeRange(operator.range) : null;
|
33
|
-
},
|
34
|
-
});
|
35
|
-
}
|
36
|
-
},
|
37
|
-
};
|
38
|
-
},
|
39
|
-
});
|