@bfra.me/eslint-config 0.49.0 → 0.50.0

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 CHANGED
@@ -8273,13 +8273,17 @@ type StylisticPaddedBlocks = []|[(("always" | "never" | "start" | "end") | {
8273
8273
  }]
8274
8274
  // ----- @stylistic/padding-line-between-statements -----
8275
8275
  type _StylisticPaddingLineBetweenStatementsPaddingType = ("any" | "never" | "always")
8276
- type _StylisticPaddingLineBetweenStatementsStatementOption = (_StylisticPaddingLineBetweenStatementsStatementType | [_StylisticPaddingLineBetweenStatementsStatementType, ...(_StylisticPaddingLineBetweenStatementsStatementType)[]])
8276
+ type _StylisticPaddingLineBetweenStatementsStatementOption = (_StylisticPaddingLineBetweenStatementsStatementMatcher | [_StylisticPaddingLineBetweenStatementsStatementMatcher, ...(_StylisticPaddingLineBetweenStatementsStatementMatcher)[]])
8277
+ type _StylisticPaddingLineBetweenStatementsStatementMatcher = (_StylisticPaddingLineBetweenStatementsStatementType | _StylisticPaddingLineBetweenStatements_SelectorOption)
8277
8278
  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
8279
  type StylisticPaddingLineBetweenStatements = {
8279
8280
  blankLine: _StylisticPaddingLineBetweenStatementsPaddingType
8280
8281
  prev: _StylisticPaddingLineBetweenStatementsStatementOption
8281
8282
  next: _StylisticPaddingLineBetweenStatementsStatementOption
8282
8283
  }[]
8284
+ interface _StylisticPaddingLineBetweenStatements_SelectorOption {
8285
+ selector: string
8286
+ }
8283
8287
  // ----- @stylistic/quote-props -----
8284
8288
  type StylisticQuoteProps = ([]|[("always" | "as-needed" | "consistent" | "consistent-as-needed")] | []|[("always" | "as-needed" | "consistent" | "consistent-as-needed")]|[("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
8285
8289
  keywords?: boolean
@@ -18422,8 +18426,6 @@ type ConfigNames =
18422
18426
  | '@bfra.me/javascript/options'
18423
18427
  | '@bfra.me/javascript/rules'
18424
18428
  | '@bfra.me/jsdoc'
18425
- | '@bfra.me/jsonc/plugins'
18426
- | '@bfra.me/jsonc/unnamed1'
18427
18429
  | '@bfra.me/jsonc/json-schema/plugins'
18428
18430
  | '@bfra.me/jsonc/json-schema/unnamed1'
18429
18431
  | '@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.49.0";
150
+ var version = "0.50.0";
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
- ...pluginJsonc.configs["flat/base"].map((config2, index) => ({
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
- languageOptions: baseConfigs[1]?.languageOptions ?? {},
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 [pluginJsonc, pluginPnpm, pluginYaml] = await Promise.all([
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
- const jsoncBaseConfigs = pluginJsonc.configs["flat/base"] ?? pluginJsonc.configs.base;
1260
- const yamlBaseConfigs = pluginYaml.configs.standard ?? pluginYaml.configs["flat/standard"];
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
- ...jsoncLanguageSetup ? { language: jsoncLanguageSetup.language } : {},
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
- ...yamlLanguageSetup ? { language: yamlLanguageSetup.language } : {},
1304
- ...yamlParserSetup ? { languageOptions: yamlParserSetup.languageOptions } : {},
1272
+ language: "yaml",
1305
1273
  plugins: {
1306
- ...yamlPluginSetup?.plugins ?? {},
1307
- pnpm: pluginPnpm
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.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "Shared ESLint configuration for bfra.me",
5
5
  "keywords": [
6
6
  "bfra.me",
@@ -39,22 +39,22 @@
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.8.0",
43
- "eslint-config-flat-gitignore": "2.1.0",
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
46
  "eslint-plugin-command": "3.4.0",
47
47
  "eslint-plugin-import-x": "4.16.1",
48
- "eslint-plugin-jsdoc": "62.6.0",
48
+ "eslint-plugin-jsdoc": "62.6.1",
49
49
  "eslint-plugin-json-schema-validator": "6.0.3",
50
- "eslint-plugin-jsonc": "2.21.1",
50
+ "eslint-plugin-jsonc": "3.0.0",
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.1.0",
54
+ "eslint-plugin-toml": "1.1.1",
55
55
  "eslint-plugin-unicorn": "63.0.0",
56
56
  "eslint-plugin-unused-imports": "4.4.1",
57
- "eslint-plugin-yml": "3.2.0",
57
+ "eslint-plugin-yml": "3.2.1",
58
58
  "globals": "17.3.0",
59
59
  "is-in-ci": "2.0.0",
60
60
  "local-pkg": "1.1.2",
@@ -83,10 +83,10 @@
83
83
  "eslint-plugin-prettier": "5.5.5",
84
84
  "eslint-plugin-react-hooks": "7.0.1",
85
85
  "eslint-plugin-react-refresh": "0.5.0",
86
- "eslint-typegen": "2.3.0",
87
- "@bfra.me/prettier-config": "0.16.7",
86
+ "eslint-typegen": "2.3.1",
88
87
  "@bfra.me/tsconfig": "0.12.2",
89
- "@bfra.me/works": "0.0.0-development"
88
+ "@bfra.me/works": "0.0.0-development",
89
+ "@bfra.me/prettier-config": "0.16.7"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@eslint-react/eslint-plugin": "^2.2.3",
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'
@@ -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
- ...(pluginJsonc.configs['flat/base'] as unknown as Config[]).map((config: Config, index) => ({
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',
@@ -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
- languageOptions: baseConfigs[1]?.languageOptions ?? {},
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',
@@ -11,57 +11,17 @@ export async function pnpm(): Promise<Config[]> {
11
11
  return requireOf(
12
12
  ['eslint-plugin-pnpm'],
13
13
  async () => {
14
- const [pluginJsonc, pluginPnpm, pluginYaml] = await Promise.all([
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
- const jsoncBaseConfigs = (pluginJsonc.configs['flat/base'] ??
21
- pluginJsonc.configs.base) as unknown as Config[] | Config | undefined
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
- ...(jsoncLanguageSetup ? {language: jsoncLanguageSetup.language} : {}),
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
- ...(yamlLanguageSetup ? {language: yamlLanguageSetup.language} : {}),
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
@@ -8264,13 +8264,17 @@ type StylisticPaddedBlocks = []|[(("always" | "never" | "start" | "end") | {
8264
8264
  }]
8265
8265
  // ----- @stylistic/padding-line-between-statements -----
8266
8266
  type _StylisticPaddingLineBetweenStatementsPaddingType = ("any" | "never" | "always")
8267
- type _StylisticPaddingLineBetweenStatementsStatementOption = (_StylisticPaddingLineBetweenStatementsStatementType | [_StylisticPaddingLineBetweenStatementsStatementType, ...(_StylisticPaddingLineBetweenStatementsStatementType)[]])
8267
+ type _StylisticPaddingLineBetweenStatementsStatementOption = (_StylisticPaddingLineBetweenStatementsStatementMatcher | [_StylisticPaddingLineBetweenStatementsStatementMatcher, ...(_StylisticPaddingLineBetweenStatementsStatementMatcher)[]])
8268
+ type _StylisticPaddingLineBetweenStatementsStatementMatcher = (_StylisticPaddingLineBetweenStatementsStatementType | _StylisticPaddingLineBetweenStatements_SelectorOption)
8268
8269
  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
8270
  type StylisticPaddingLineBetweenStatements = {
8270
8271
  blankLine: _StylisticPaddingLineBetweenStatementsPaddingType
8271
8272
  prev: _StylisticPaddingLineBetweenStatementsStatementOption
8272
8273
  next: _StylisticPaddingLineBetweenStatementsStatementOption
8273
8274
  }[]
8275
+ interface _StylisticPaddingLineBetweenStatements_SelectorOption {
8276
+ selector: string
8277
+ }
8274
8278
  // ----- @stylistic/quote-props -----
8275
8279
  type StylisticQuoteProps = ([]|[("always" | "as-needed" | "consistent" | "consistent-as-needed")] | []|[("always" | "as-needed" | "consistent" | "consistent-as-needed")]|[("always" | "as-needed" | "consistent" | "consistent-as-needed"), {
8276
8280
  keywords?: boolean