@bfra.me/eslint-config 0.49.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +28 -3
- package/lib/index.js +16 -49
- package/package.json +16 -16
- package/src/config.d.ts +0 -2
- package/src/configs/jsonc.ts +4 -6
- package/src/configs/markdown.ts +1 -6
- package/src/configs/pnpm.ts +10 -75
- package/src/rules.d.ts +28 -1
package/lib/index.d.ts
CHANGED
|
@@ -5713,11 +5713,21 @@ interface Rules {
|
|
|
5713
5713
|
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/indent.html
|
|
5714
5714
|
*/
|
|
5715
5715
|
'toml/indent'?: Linter.RuleEntry<TomlIndent>
|
|
5716
|
+
/**
|
|
5717
|
+
* enforce linebreaks after opening and before closing braces
|
|
5718
|
+
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-newline.html
|
|
5719
|
+
*/
|
|
5720
|
+
'toml/inline-table-curly-newline'?: Linter.RuleEntry<TomlInlineTableCurlyNewline>
|
|
5716
5721
|
/**
|
|
5717
5722
|
* enforce consistent spacing inside braces
|
|
5718
5723
|
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-spacing.html
|
|
5719
5724
|
*/
|
|
5720
5725
|
'toml/inline-table-curly-spacing'?: Linter.RuleEntry<TomlInlineTableCurlySpacing>
|
|
5726
|
+
/**
|
|
5727
|
+
* enforce placing inline table key-value pairs on separate lines
|
|
5728
|
+
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-key-value-newline.html
|
|
5729
|
+
*/
|
|
5730
|
+
'toml/inline-table-key-value-newline'?: Linter.RuleEntry<TomlInlineTableKeyValueNewline>
|
|
5721
5731
|
/**
|
|
5722
5732
|
* enforce consistent spacing between keys and values in key/value pairs
|
|
5723
5733
|
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/key-spacing.html
|
|
@@ -8273,13 +8283,17 @@ type StylisticPaddedBlocks = []|[(("always" | "never" | "start" | "end") | {
|
|
|
8273
8283
|
}]
|
|
8274
8284
|
// ----- @stylistic/padding-line-between-statements -----
|
|
8275
8285
|
type _StylisticPaddingLineBetweenStatementsPaddingType = ("any" | "never" | "always")
|
|
8276
|
-
type _StylisticPaddingLineBetweenStatementsStatementOption = (
|
|
8286
|
+
type _StylisticPaddingLineBetweenStatementsStatementOption = (_StylisticPaddingLineBetweenStatementsStatementMatcher | [_StylisticPaddingLineBetweenStatementsStatementMatcher, ...(_StylisticPaddingLineBetweenStatementsStatementMatcher)[]])
|
|
8287
|
+
type _StylisticPaddingLineBetweenStatementsStatementMatcher = (_StylisticPaddingLineBetweenStatementsStatementType | _StylisticPaddingLineBetweenStatements_SelectorOption)
|
|
8277
8288
|
type _StylisticPaddingLineBetweenStatementsStatementType = ("*" | "exports" | "require" | "directive" | "iife" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "continue" | "debugger" | "default" | "do" | "for" | "if" | "import" | "switch" | "throw" | "try" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "function-overload" | "block-like" | "singleline-block-like" | "multiline-block-like" | "expression" | "singleline-expression" | "multiline-expression" | "return" | "singleline-return" | "multiline-return" | "export" | "singleline-export" | "multiline-export" | "var" | "singleline-var" | "multiline-var" | "let" | "singleline-let" | "multiline-let" | "const" | "singleline-const" | "multiline-const" | "using" | "singleline-using" | "multiline-using" | "type" | "singleline-type" | "multiline-type")
|
|
8278
8289
|
type StylisticPaddingLineBetweenStatements = {
|
|
8279
8290
|
blankLine: _StylisticPaddingLineBetweenStatementsPaddingType
|
|
8280
8291
|
prev: _StylisticPaddingLineBetweenStatementsStatementOption
|
|
8281
8292
|
next: _StylisticPaddingLineBetweenStatementsStatementOption
|
|
8282
8293
|
}[]
|
|
8294
|
+
interface _StylisticPaddingLineBetweenStatements_SelectorOption {
|
|
8295
|
+
selector: string
|
|
8296
|
+
}
|
|
8283
8297
|
// ----- @stylistic/quote-props -----
|
|
8284
8298
|
type StylisticQuoteProps = ([]|[("always" | "as-needed" | "consistent" | "consistent-as-needed")] | []|[("always" | "as-needed" | "consistent" | "consistent-as-needed")]|[("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
|
|
8285
8299
|
keywords?: boolean
|
|
@@ -11353,6 +11367,7 @@ type JsoncObjectCurlyNewline = []|[((("always" | "never") | {
|
|
|
11353
11367
|
type JsoncObjectCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
11354
11368
|
arraysInObjects?: boolean
|
|
11355
11369
|
objectsInObjects?: boolean
|
|
11370
|
+
emptyObjects?: ("ignore" | "always" | "never")
|
|
11356
11371
|
}]
|
|
11357
11372
|
// ----- jsonc/object-property-newline -----
|
|
11358
11373
|
type JsoncObjectPropertyNewline = []|[{
|
|
@@ -17656,10 +17671,21 @@ type TomlIndent = []|[("tab" | number)]|[("tab" | number), {
|
|
|
17656
17671
|
subTables?: number
|
|
17657
17672
|
keyValuePairs?: number
|
|
17658
17673
|
}]
|
|
17674
|
+
// ----- toml/inline-table-curly-newline -----
|
|
17675
|
+
type TomlInlineTableCurlyNewline = []|[(("always" | "never") | {
|
|
17676
|
+
multiline?: boolean
|
|
17677
|
+
minProperties?: number
|
|
17678
|
+
consistent?: boolean
|
|
17679
|
+
})]
|
|
17659
17680
|
// ----- toml/inline-table-curly-spacing -----
|
|
17660
17681
|
type TomlInlineTableCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
17661
17682
|
arraysInObjects?: boolean
|
|
17662
17683
|
objectsInObjects?: boolean
|
|
17684
|
+
emptyObjects?: ("ignore" | "always" | "never")
|
|
17685
|
+
}]
|
|
17686
|
+
// ----- toml/inline-table-key-value-newline -----
|
|
17687
|
+
type TomlInlineTableKeyValueNewline = []|[{
|
|
17688
|
+
allowAllPropertiesOnSameLine?: boolean
|
|
17663
17689
|
}]
|
|
17664
17690
|
// ----- toml/key-spacing -----
|
|
17665
17691
|
type TomlKeySpacing = []|[({
|
|
@@ -18209,6 +18235,7 @@ type YmlFlowMappingCurlyNewline = []|[(("always" | "never") | {
|
|
|
18209
18235
|
type YmlFlowMappingCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
18210
18236
|
arraysInObjects?: boolean
|
|
18211
18237
|
objectsInObjects?: boolean
|
|
18238
|
+
emptyObjects?: ("ignore" | "always" | "never")
|
|
18212
18239
|
}]
|
|
18213
18240
|
// ----- yml/flow-sequence-bracket-newline -----
|
|
18214
18241
|
type YmlFlowSequenceBracketNewline = []|[(("always" | "never" | "consistent") | {
|
|
@@ -18422,8 +18449,6 @@ type ConfigNames =
|
|
|
18422
18449
|
| '@bfra.me/javascript/options'
|
|
18423
18450
|
| '@bfra.me/javascript/rules'
|
|
18424
18451
|
| '@bfra.me/jsdoc'
|
|
18425
|
-
| '@bfra.me/jsonc/plugins'
|
|
18426
|
-
| '@bfra.me/jsonc/unnamed1'
|
|
18427
18452
|
| '@bfra.me/jsonc/json-schema/plugins'
|
|
18428
18453
|
| '@bfra.me/jsonc/json-schema/unnamed1'
|
|
18429
18454
|
| '@bfra.me/jsonc/json-schema'
|
package/lib/index.js
CHANGED
|
@@ -147,7 +147,7 @@ var GLOB_EXCLUDE = [
|
|
|
147
147
|
import { fileURLToPath } from "url";
|
|
148
148
|
|
|
149
149
|
// package.json
|
|
150
|
-
var version = "0.
|
|
150
|
+
var version = "0.50.1";
|
|
151
151
|
|
|
152
152
|
// src/parsers/any-parser.ts
|
|
153
153
|
var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
|
|
@@ -712,15 +712,14 @@ async function jsonc(options = {}) {
|
|
|
712
712
|
const indent = typeof stylisticConfig.indent === "number" ? stylisticConfig.indent : 2;
|
|
713
713
|
const includeStylistic = typeof stylistic2 === "boolean" ? stylistic2 : true;
|
|
714
714
|
const pluginJsonc = await interopDefault(import("eslint-plugin-jsonc"));
|
|
715
|
+
const baseConfigs = pluginJsonc.configs.base ?? pluginJsonc.configs["flat/base"] ?? [];
|
|
715
716
|
return [
|
|
716
|
-
...
|
|
717
|
-
...config2,
|
|
718
|
-
name: config2.plugins ? `@bfra.me/jsonc/plugins` : `@bfra.me/${(config2.name ?? "") || `jsonc/unnamed${index}`}`
|
|
719
|
-
})),
|
|
717
|
+
...baseConfigs,
|
|
720
718
|
...await jsonSchema("jsonc", files),
|
|
721
719
|
{
|
|
722
720
|
name: "@bfra.me/jsonc",
|
|
723
721
|
files,
|
|
722
|
+
language: "jsonc/x",
|
|
724
723
|
rules: {
|
|
725
724
|
"jsonc/no-bigint-literals": "error",
|
|
726
725
|
"jsonc/no-binary-expression": "error",
|
|
@@ -1022,8 +1021,6 @@ async function markdown(options = {}) {
|
|
|
1022
1021
|
});
|
|
1023
1022
|
}
|
|
1024
1023
|
if (json) {
|
|
1025
|
-
const pluginJsonc = await interopDefault(import("eslint-plugin-jsonc"));
|
|
1026
|
-
const baseConfigs = pluginJsonc.configs["flat/base"];
|
|
1027
1024
|
configs.push({
|
|
1028
1025
|
name: "@bfra.me/markdown/code-blocks/json",
|
|
1029
1026
|
files: GLOB_MARKDOWN_FILES.flatMap((p) => [
|
|
@@ -1031,7 +1028,7 @@ async function markdown(options = {}) {
|
|
|
1031
1028
|
`${p}/${GLOB_JSON5}`,
|
|
1032
1029
|
`${p}/${GLOB_JSONC}`
|
|
1033
1030
|
]),
|
|
1034
|
-
|
|
1031
|
+
language: "jsonc/x",
|
|
1035
1032
|
rules: {
|
|
1036
1033
|
// Examples may show JSON with trailing commas or explanatory comments
|
|
1037
1034
|
"jsonc/comma-dangle": "off",
|
|
@@ -1251,33 +1248,16 @@ async function pnpm() {
|
|
|
1251
1248
|
return requireOf(
|
|
1252
1249
|
["eslint-plugin-pnpm"],
|
|
1253
1250
|
async () => {
|
|
1254
|
-
const [
|
|
1255
|
-
interopDefault(import("eslint-plugin-jsonc")),
|
|
1251
|
+
const [pluginPnpm, pluginYaml] = await Promise.all([
|
|
1256
1252
|
interopDefault(import("eslint-plugin-pnpm")),
|
|
1257
1253
|
interopDefault(import("eslint-plugin-yml"))
|
|
1258
1254
|
]);
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
const jsoncConfigs = Array.isArray(jsoncBaseConfigs) ? jsoncBaseConfigs : jsoncBaseConfigs ? [jsoncBaseConfigs] : [];
|
|
1262
|
-
const yamlConfigs = Array.isArray(yamlBaseConfigs) ? yamlBaseConfigs : yamlBaseConfigs ? [yamlBaseConfigs] : [];
|
|
1263
|
-
const configs = [];
|
|
1264
|
-
const jsoncLanguageSetup = jsoncConfigs.find(
|
|
1265
|
-
(config2) => config2 != null && typeof config2 === "object" && "language" in config2
|
|
1266
|
-
);
|
|
1267
|
-
const jsoncParserSetup = jsoncConfigs.find(
|
|
1268
|
-
(config2) => config2 != null && typeof config2 === "object" && "languageOptions" in config2 && config2.languageOptions != null
|
|
1269
|
-
);
|
|
1270
|
-
const jsoncPluginSetup = jsoncConfigs.find(
|
|
1271
|
-
(config2) => config2 != null && typeof config2 === "object" && "plugins" in config2 && config2.plugins != null
|
|
1272
|
-
);
|
|
1273
|
-
if (jsoncLanguageSetup ?? jsoncParserSetup ?? jsoncPluginSetup) {
|
|
1274
|
-
configs.push({
|
|
1255
|
+
return [
|
|
1256
|
+
{
|
|
1275
1257
|
name: "@bfra.me/pnpm/package-json",
|
|
1276
1258
|
files: ["package.json", "**/package.json"],
|
|
1277
|
-
|
|
1278
|
-
...jsoncParserSetup ? { languageOptions: jsoncParserSetup.languageOptions } : {},
|
|
1259
|
+
language: "jsonc/x",
|
|
1279
1260
|
plugins: {
|
|
1280
|
-
...jsoncPluginSetup?.plugins ?? {},
|
|
1281
1261
|
pnpm: pluginPnpm
|
|
1282
1262
|
},
|
|
1283
1263
|
rules: {
|
|
@@ -1285,34 +1265,21 @@ async function pnpm() {
|
|
|
1285
1265
|
"pnpm/json-prefer-workspace-settings": "error",
|
|
1286
1266
|
"pnpm/json-valid-catalog": "error"
|
|
1287
1267
|
}
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
const yamlLanguageSetup = yamlConfigs.find(
|
|
1291
|
-
(config2) => config2 != null && typeof config2 === "object" && "language" in config2
|
|
1292
|
-
);
|
|
1293
|
-
const yamlParserSetup = yamlConfigs.find(
|
|
1294
|
-
(config2) => config2 != null && typeof config2 === "object" && "languageOptions" in config2 && config2.languageOptions != null
|
|
1295
|
-
);
|
|
1296
|
-
const yamlPluginSetup = yamlConfigs.find(
|
|
1297
|
-
(config2) => config2 != null && typeof config2 === "object" && "plugins" in config2 && config2.plugins != null
|
|
1298
|
-
);
|
|
1299
|
-
if (yamlLanguageSetup ?? yamlParserSetup ?? yamlPluginSetup) {
|
|
1300
|
-
configs.push({
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1301
1270
|
name: "@bfra.me/pnpm/pnpm-workspace-yaml",
|
|
1302
1271
|
files: ["pnpm-workspace.yaml"],
|
|
1303
|
-
|
|
1304
|
-
...yamlParserSetup ? { languageOptions: yamlParserSetup.languageOptions } : {},
|
|
1272
|
+
language: "yaml",
|
|
1305
1273
|
plugins: {
|
|
1306
|
-
|
|
1307
|
-
|
|
1274
|
+
pnpm: pluginPnpm,
|
|
1275
|
+
yml: pluginYaml
|
|
1308
1276
|
},
|
|
1309
1277
|
rules: {
|
|
1310
1278
|
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
1311
1279
|
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
1312
1280
|
}
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
return configs;
|
|
1281
|
+
}
|
|
1282
|
+
];
|
|
1316
1283
|
},
|
|
1317
1284
|
fallback
|
|
1318
1285
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bfra.me/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"description": "Shared ESLint configuration for bfra.me",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bfra.me",
|
|
@@ -39,28 +39,28 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@eslint-community/eslint-plugin-eslint-comments": "4.6.0",
|
|
41
41
|
"@eslint/markdown": "7.5.1",
|
|
42
|
-
"@stylistic/eslint-plugin": "5.
|
|
43
|
-
"eslint-config-flat-gitignore": "2.1
|
|
42
|
+
"@stylistic/eslint-plugin": "5.9.0",
|
|
43
|
+
"eslint-config-flat-gitignore": "2.2.1",
|
|
44
44
|
"eslint-flat-config-utils": "3.0.1",
|
|
45
45
|
"eslint-merge-processors": "2.0.0",
|
|
46
|
-
"eslint-plugin-command": "3.
|
|
46
|
+
"eslint-plugin-command": "3.5.2",
|
|
47
47
|
"eslint-plugin-import-x": "4.16.1",
|
|
48
|
-
"eslint-plugin-jsdoc": "62.
|
|
49
|
-
"eslint-plugin-json-schema-validator": "6.0
|
|
50
|
-
"eslint-plugin-jsonc": "
|
|
48
|
+
"eslint-plugin-jsdoc": "62.7.1",
|
|
49
|
+
"eslint-plugin-json-schema-validator": "6.2.0",
|
|
50
|
+
"eslint-plugin-jsonc": "3.1.1",
|
|
51
51
|
"eslint-plugin-n": "17.24.0",
|
|
52
52
|
"eslint-plugin-perfectionist": "5.6.0",
|
|
53
53
|
"eslint-plugin-regexp": "3.0.0",
|
|
54
|
-
"eslint-plugin-toml": "1.
|
|
54
|
+
"eslint-plugin-toml": "1.3.0",
|
|
55
55
|
"eslint-plugin-unicorn": "63.0.0",
|
|
56
56
|
"eslint-plugin-unused-imports": "4.4.1",
|
|
57
|
-
"eslint-plugin-yml": "3.
|
|
57
|
+
"eslint-plugin-yml": "3.3.0",
|
|
58
58
|
"globals": "17.3.0",
|
|
59
59
|
"is-in-ci": "2.0.0",
|
|
60
60
|
"local-pkg": "1.1.2",
|
|
61
61
|
"package-manager-detector": "1.6.0",
|
|
62
62
|
"sort-package-json": "3.6.1",
|
|
63
|
-
"typescript-eslint": "8.56.
|
|
63
|
+
"typescript-eslint": "8.56.1",
|
|
64
64
|
"@bfra.me/es": "0.1.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
@@ -70,20 +70,20 @@
|
|
|
70
70
|
"@next/eslint-plugin-next": "16.1.6",
|
|
71
71
|
"@types/eslint-config-prettier": "6.11.3",
|
|
72
72
|
"@types/eslint-plugin-jsx-a11y": "6.10.1",
|
|
73
|
-
"@typescript-eslint/types": "8.56.
|
|
73
|
+
"@typescript-eslint/types": "8.56.1",
|
|
74
74
|
"@vitest/eslint-plugin": "1.6.9",
|
|
75
75
|
"astro-eslint-parser": "1.3.0",
|
|
76
|
-
"eslint": "10.0.
|
|
76
|
+
"eslint": "10.0.2",
|
|
77
77
|
"eslint-config-prettier": "10.1.8",
|
|
78
78
|
"eslint-plugin-astro": "1.6.0",
|
|
79
79
|
"eslint-plugin-erasable-syntax-only": "0.4.0",
|
|
80
80
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
81
|
-
"eslint-plugin-node-dependencies": "1.
|
|
82
|
-
"eslint-plugin-pnpm": "1.
|
|
81
|
+
"eslint-plugin-node-dependencies": "2.1.0",
|
|
82
|
+
"eslint-plugin-pnpm": "1.6.0",
|
|
83
83
|
"eslint-plugin-prettier": "5.5.5",
|
|
84
84
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
85
|
-
"eslint-plugin-react-refresh": "0.5.
|
|
86
|
-
"eslint-typegen": "2.3.
|
|
85
|
+
"eslint-plugin-react-refresh": "0.5.2",
|
|
86
|
+
"eslint-typegen": "2.3.1",
|
|
87
87
|
"@bfra.me/prettier-config": "0.16.7",
|
|
88
88
|
"@bfra.me/tsconfig": "0.12.2",
|
|
89
89
|
"@bfra.me/works": "0.0.0-development"
|
package/src/config.d.ts
CHANGED
|
@@ -36,8 +36,6 @@ export type ConfigNames =
|
|
|
36
36
|
| '@bfra.me/javascript/options'
|
|
37
37
|
| '@bfra.me/javascript/rules'
|
|
38
38
|
| '@bfra.me/jsdoc'
|
|
39
|
-
| '@bfra.me/jsonc/plugins'
|
|
40
|
-
| '@bfra.me/jsonc/unnamed1'
|
|
41
39
|
| '@bfra.me/jsonc/json-schema/plugins'
|
|
42
40
|
| '@bfra.me/jsonc/json-schema/unnamed1'
|
|
43
41
|
| '@bfra.me/jsonc/json-schema'
|
package/src/configs/jsonc.ts
CHANGED
|
@@ -21,17 +21,15 @@ export async function jsonc(options: JsoncOptions = {}): Promise<Config[]> {
|
|
|
21
21
|
const includeStylistic = typeof stylistic === 'boolean' ? stylistic : true
|
|
22
22
|
const pluginJsonc = await interopDefault(import('eslint-plugin-jsonc'))
|
|
23
23
|
|
|
24
|
+
const baseConfigs = pluginJsonc.configs.base ?? pluginJsonc.configs['flat/base'] ?? []
|
|
25
|
+
|
|
24
26
|
return [
|
|
25
|
-
...
|
|
26
|
-
...config,
|
|
27
|
-
name: config.plugins
|
|
28
|
-
? `@bfra.me/jsonc/plugins`
|
|
29
|
-
: `@bfra.me/${(config.name ?? '') || `jsonc/unnamed${index}`}`,
|
|
30
|
-
})),
|
|
27
|
+
...baseConfigs,
|
|
31
28
|
...(await jsonSchema('jsonc', files as string[])),
|
|
32
29
|
{
|
|
33
30
|
name: '@bfra.me/jsonc',
|
|
34
31
|
files,
|
|
32
|
+
language: 'jsonc/x',
|
|
35
33
|
rules: {
|
|
36
34
|
'jsonc/no-bigint-literals': 'error',
|
|
37
35
|
'jsonc/no-binary-expression': 'error',
|
package/src/configs/markdown.ts
CHANGED
|
@@ -376,11 +376,6 @@ export async function markdown(options: MarkdownOptions = {}): Promise<Config[]>
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
if (json) {
|
|
379
|
-
const pluginJsonc = await interopDefault(import('eslint-plugin-jsonc'))
|
|
380
|
-
|
|
381
|
-
// Use plugin's base config to inherit parser configuration
|
|
382
|
-
const baseConfigs = pluginJsonc.configs['flat/base']
|
|
383
|
-
|
|
384
379
|
configs.push({
|
|
385
380
|
name: '@bfra.me/markdown/code-blocks/json',
|
|
386
381
|
files: GLOB_MARKDOWN_FILES.flatMap(p => [
|
|
@@ -388,7 +383,7 @@ export async function markdown(options: MarkdownOptions = {}): Promise<Config[]>
|
|
|
388
383
|
`${p}/${GLOB_JSON5}`,
|
|
389
384
|
`${p}/${GLOB_JSONC}`,
|
|
390
385
|
]),
|
|
391
|
-
|
|
386
|
+
language: 'jsonc/x',
|
|
392
387
|
rules: {
|
|
393
388
|
// Examples may show JSON with trailing commas or explanatory comments
|
|
394
389
|
'jsonc/comma-dangle': 'off',
|
package/src/configs/pnpm.ts
CHANGED
|
@@ -11,57 +11,17 @@ export async function pnpm(): Promise<Config[]> {
|
|
|
11
11
|
return requireOf(
|
|
12
12
|
['eslint-plugin-pnpm'],
|
|
13
13
|
async () => {
|
|
14
|
-
const [
|
|
15
|
-
interopDefault(import('eslint-plugin-jsonc')),
|
|
14
|
+
const [pluginPnpm, pluginYaml] = await Promise.all([
|
|
16
15
|
interopDefault(import('eslint-plugin-pnpm')),
|
|
17
16
|
interopDefault(import('eslint-plugin-yml')),
|
|
18
17
|
])
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const yamlBaseConfigs = (pluginYaml.configs.standard ??
|
|
23
|
-
pluginYaml.configs['flat/standard']) as unknown as Config[] | Config | undefined
|
|
24
|
-
|
|
25
|
-
const jsoncConfigs = Array.isArray(jsoncBaseConfigs)
|
|
26
|
-
? jsoncBaseConfigs
|
|
27
|
-
: jsoncBaseConfigs
|
|
28
|
-
? [jsoncBaseConfigs]
|
|
29
|
-
: []
|
|
30
|
-
const yamlConfigs = Array.isArray(yamlBaseConfigs)
|
|
31
|
-
? yamlBaseConfigs
|
|
32
|
-
: yamlBaseConfigs
|
|
33
|
-
? [yamlBaseConfigs]
|
|
34
|
-
: []
|
|
35
|
-
|
|
36
|
-
const configs: Config[] = []
|
|
37
|
-
|
|
38
|
-
const jsoncLanguageSetup = jsoncConfigs.find(
|
|
39
|
-
(config): config is Config & {language: string} =>
|
|
40
|
-
config != null && typeof config === 'object' && 'language' in config,
|
|
41
|
-
)
|
|
42
|
-
const jsoncParserSetup = jsoncConfigs.find(
|
|
43
|
-
(config): config is Config & {languageOptions: Record<string, unknown>} =>
|
|
44
|
-
config != null &&
|
|
45
|
-
typeof config === 'object' &&
|
|
46
|
-
'languageOptions' in config &&
|
|
47
|
-
config.languageOptions != null,
|
|
48
|
-
)
|
|
49
|
-
const jsoncPluginSetup = jsoncConfigs.find(
|
|
50
|
-
(config): config is Config & {plugins: Record<string, unknown>} =>
|
|
51
|
-
config != null &&
|
|
52
|
-
typeof config === 'object' &&
|
|
53
|
-
'plugins' in config &&
|
|
54
|
-
config.plugins != null,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
if (jsoncLanguageSetup ?? jsoncParserSetup ?? jsoncPluginSetup) {
|
|
58
|
-
configs.push({
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
59
21
|
name: '@bfra.me/pnpm/package-json',
|
|
60
22
|
files: ['package.json', '**/package.json'],
|
|
61
|
-
|
|
62
|
-
...(jsoncParserSetup ? {languageOptions: jsoncParserSetup.languageOptions} : {}),
|
|
23
|
+
language: 'jsonc/x',
|
|
63
24
|
plugins: {
|
|
64
|
-
...(jsoncPluginSetup?.plugins ?? {}),
|
|
65
25
|
pnpm: pluginPnpm,
|
|
66
26
|
},
|
|
67
27
|
rules: {
|
|
@@ -69,46 +29,21 @@ export async function pnpm(): Promise<Config[]> {
|
|
|
69
29
|
'pnpm/json-prefer-workspace-settings': 'error',
|
|
70
30
|
'pnpm/json-valid-catalog': 'error',
|
|
71
31
|
},
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const yamlLanguageSetup = yamlConfigs.find(
|
|
76
|
-
(config): config is Config & {language: string} =>
|
|
77
|
-
config != null && typeof config === 'object' && 'language' in config,
|
|
78
|
-
)
|
|
79
|
-
const yamlParserSetup = yamlConfigs.find(
|
|
80
|
-
(config): config is Config & {languageOptions: Record<string, unknown>} =>
|
|
81
|
-
config != null &&
|
|
82
|
-
typeof config === 'object' &&
|
|
83
|
-
'languageOptions' in config &&
|
|
84
|
-
config.languageOptions != null,
|
|
85
|
-
)
|
|
86
|
-
const yamlPluginSetup = yamlConfigs.find(
|
|
87
|
-
(config): config is Config & {plugins: Record<string, unknown>} =>
|
|
88
|
-
config != null &&
|
|
89
|
-
typeof config === 'object' &&
|
|
90
|
-
'plugins' in config &&
|
|
91
|
-
config.plugins != null,
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
if (yamlLanguageSetup ?? yamlParserSetup ?? yamlPluginSetup) {
|
|
95
|
-
configs.push({
|
|
32
|
+
},
|
|
33
|
+
{
|
|
96
34
|
name: '@bfra.me/pnpm/pnpm-workspace-yaml',
|
|
97
35
|
files: ['pnpm-workspace.yaml'],
|
|
98
|
-
|
|
99
|
-
...(yamlParserSetup ? {languageOptions: yamlParserSetup.languageOptions} : {}),
|
|
36
|
+
language: 'yaml',
|
|
100
37
|
plugins: {
|
|
101
|
-
...(yamlPluginSetup?.plugins ?? {}),
|
|
102
38
|
pnpm: pluginPnpm,
|
|
39
|
+
yml: pluginYaml,
|
|
103
40
|
},
|
|
104
41
|
rules: {
|
|
105
42
|
'pnpm/yaml-no-duplicate-catalog-item': 'error',
|
|
106
43
|
'pnpm/yaml-no-unused-catalog-item': 'error',
|
|
107
44
|
},
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return configs
|
|
45
|
+
},
|
|
46
|
+
] as Config[]
|
|
112
47
|
},
|
|
113
48
|
fallback,
|
|
114
49
|
)
|
package/src/rules.d.ts
CHANGED
|
@@ -5704,11 +5704,21 @@ export interface Rules {
|
|
|
5704
5704
|
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/indent.html
|
|
5705
5705
|
*/
|
|
5706
5706
|
'toml/indent'?: Linter.RuleEntry<TomlIndent>
|
|
5707
|
+
/**
|
|
5708
|
+
* enforce linebreaks after opening and before closing braces
|
|
5709
|
+
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-newline.html
|
|
5710
|
+
*/
|
|
5711
|
+
'toml/inline-table-curly-newline'?: Linter.RuleEntry<TomlInlineTableCurlyNewline>
|
|
5707
5712
|
/**
|
|
5708
5713
|
* enforce consistent spacing inside braces
|
|
5709
5714
|
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-spacing.html
|
|
5710
5715
|
*/
|
|
5711
5716
|
'toml/inline-table-curly-spacing'?: Linter.RuleEntry<TomlInlineTableCurlySpacing>
|
|
5717
|
+
/**
|
|
5718
|
+
* enforce placing inline table key-value pairs on separate lines
|
|
5719
|
+
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-key-value-newline.html
|
|
5720
|
+
*/
|
|
5721
|
+
'toml/inline-table-key-value-newline'?: Linter.RuleEntry<TomlInlineTableKeyValueNewline>
|
|
5712
5722
|
/**
|
|
5713
5723
|
* enforce consistent spacing between keys and values in key/value pairs
|
|
5714
5724
|
* @see https://ota-meshi.github.io/eslint-plugin-toml/rules/key-spacing.html
|
|
@@ -8264,13 +8274,17 @@ type StylisticPaddedBlocks = []|[(("always" | "never" | "start" | "end") | {
|
|
|
8264
8274
|
}]
|
|
8265
8275
|
// ----- @stylistic/padding-line-between-statements -----
|
|
8266
8276
|
type _StylisticPaddingLineBetweenStatementsPaddingType = ("any" | "never" | "always")
|
|
8267
|
-
type _StylisticPaddingLineBetweenStatementsStatementOption = (
|
|
8277
|
+
type _StylisticPaddingLineBetweenStatementsStatementOption = (_StylisticPaddingLineBetweenStatementsStatementMatcher | [_StylisticPaddingLineBetweenStatementsStatementMatcher, ...(_StylisticPaddingLineBetweenStatementsStatementMatcher)[]])
|
|
8278
|
+
type _StylisticPaddingLineBetweenStatementsStatementMatcher = (_StylisticPaddingLineBetweenStatementsStatementType | _StylisticPaddingLineBetweenStatements_SelectorOption)
|
|
8268
8279
|
type _StylisticPaddingLineBetweenStatementsStatementType = ("*" | "exports" | "require" | "directive" | "iife" | "block" | "empty" | "function" | "ts-method" | "break" | "case" | "class" | "continue" | "debugger" | "default" | "do" | "for" | "if" | "import" | "switch" | "throw" | "try" | "while" | "with" | "cjs-export" | "cjs-import" | "enum" | "interface" | "function-overload" | "block-like" | "singleline-block-like" | "multiline-block-like" | "expression" | "singleline-expression" | "multiline-expression" | "return" | "singleline-return" | "multiline-return" | "export" | "singleline-export" | "multiline-export" | "var" | "singleline-var" | "multiline-var" | "let" | "singleline-let" | "multiline-let" | "const" | "singleline-const" | "multiline-const" | "using" | "singleline-using" | "multiline-using" | "type" | "singleline-type" | "multiline-type")
|
|
8269
8280
|
type StylisticPaddingLineBetweenStatements = {
|
|
8270
8281
|
blankLine: _StylisticPaddingLineBetweenStatementsPaddingType
|
|
8271
8282
|
prev: _StylisticPaddingLineBetweenStatementsStatementOption
|
|
8272
8283
|
next: _StylisticPaddingLineBetweenStatementsStatementOption
|
|
8273
8284
|
}[]
|
|
8285
|
+
interface _StylisticPaddingLineBetweenStatements_SelectorOption {
|
|
8286
|
+
selector: string
|
|
8287
|
+
}
|
|
8274
8288
|
// ----- @stylistic/quote-props -----
|
|
8275
8289
|
type StylisticQuoteProps = ([]|[("always" | "as-needed" | "consistent" | "consistent-as-needed")] | []|[("always" | "as-needed" | "consistent" | "consistent-as-needed")]|[("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
|
|
8276
8290
|
keywords?: boolean
|
|
@@ -11344,6 +11358,7 @@ type JsoncObjectCurlyNewline = []|[((("always" | "never") | {
|
|
|
11344
11358
|
type JsoncObjectCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
11345
11359
|
arraysInObjects?: boolean
|
|
11346
11360
|
objectsInObjects?: boolean
|
|
11361
|
+
emptyObjects?: ("ignore" | "always" | "never")
|
|
11347
11362
|
}]
|
|
11348
11363
|
// ----- jsonc/object-property-newline -----
|
|
11349
11364
|
type JsoncObjectPropertyNewline = []|[{
|
|
@@ -17647,10 +17662,21 @@ type TomlIndent = []|[("tab" | number)]|[("tab" | number), {
|
|
|
17647
17662
|
subTables?: number
|
|
17648
17663
|
keyValuePairs?: number
|
|
17649
17664
|
}]
|
|
17665
|
+
// ----- toml/inline-table-curly-newline -----
|
|
17666
|
+
type TomlInlineTableCurlyNewline = []|[(("always" | "never") | {
|
|
17667
|
+
multiline?: boolean
|
|
17668
|
+
minProperties?: number
|
|
17669
|
+
consistent?: boolean
|
|
17670
|
+
})]
|
|
17650
17671
|
// ----- toml/inline-table-curly-spacing -----
|
|
17651
17672
|
type TomlInlineTableCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
17652
17673
|
arraysInObjects?: boolean
|
|
17653
17674
|
objectsInObjects?: boolean
|
|
17675
|
+
emptyObjects?: ("ignore" | "always" | "never")
|
|
17676
|
+
}]
|
|
17677
|
+
// ----- toml/inline-table-key-value-newline -----
|
|
17678
|
+
type TomlInlineTableKeyValueNewline = []|[{
|
|
17679
|
+
allowAllPropertiesOnSameLine?: boolean
|
|
17654
17680
|
}]
|
|
17655
17681
|
// ----- toml/key-spacing -----
|
|
17656
17682
|
type TomlKeySpacing = []|[({
|
|
@@ -18200,6 +18226,7 @@ type YmlFlowMappingCurlyNewline = []|[(("always" | "never") | {
|
|
|
18200
18226
|
type YmlFlowMappingCurlySpacing = []|[("always" | "never")]|[("always" | "never"), {
|
|
18201
18227
|
arraysInObjects?: boolean
|
|
18202
18228
|
objectsInObjects?: boolean
|
|
18229
|
+
emptyObjects?: ("ignore" | "always" | "never")
|
|
18203
18230
|
}]
|
|
18204
18231
|
// ----- yml/flow-sequence-bracket-newline -----
|
|
18205
18232
|
type YmlFlowSequenceBracketNewline = []|[(("always" | "never" | "consistent") | {
|