@bfra.me/eslint-config 0.39.1 → 0.41.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 +184 -9
- package/lib/index.js +201 -84
- package/lib/{missing-module-for-config-DNGJUDHU.js → missing-module-for-config-QFYTX2KG.js} +3 -3
- package/package.json +11 -14
- package/readme.md +410 -0
- package/src/config.d.ts +4 -1
- package/src/configs/markdown.ts +380 -89
- package/src/define-config.ts +1 -0
- package/src/globs.ts +8 -1
- package/src/options.ts +23 -2
- package/src/rules/missing-module-for-config.ts +2 -3
- package/src/rules.d.ts +7 -0
package/lib/index.d.ts
CHANGED
|
@@ -1047,6 +1047,11 @@ interface Rules {
|
|
|
1047
1047
|
* @see https://typescript-eslint.io/rules/no-unused-expressions
|
|
1048
1048
|
*/
|
|
1049
1049
|
'@typescript-eslint/no-unused-expressions'?: Linter.RuleEntry<TypescriptEslintNoUnusedExpressions>
|
|
1050
|
+
/**
|
|
1051
|
+
* Disallow unused private class members
|
|
1052
|
+
* @see https://typescript-eslint.io/rules/no-unused-private-class-members
|
|
1053
|
+
*/
|
|
1054
|
+
'@typescript-eslint/no-unused-private-class-members'?: Linter.RuleEntry<[]>
|
|
1050
1055
|
/**
|
|
1051
1056
|
* Disallow unused variables
|
|
1052
1057
|
* @see https://typescript-eslint.io/rules/no-unused-vars
|
|
@@ -9895,6 +9900,8 @@ type JsdocCheckExamples = []|[{
|
|
|
9895
9900
|
// ----- jsdoc/check-indentation -----
|
|
9896
9901
|
type JsdocCheckIndentation = []|[{
|
|
9897
9902
|
|
|
9903
|
+
allowIndentedSections?: boolean
|
|
9904
|
+
|
|
9898
9905
|
excludeTags?: string[]
|
|
9899
9906
|
}]
|
|
9900
9907
|
// ----- jsdoc/check-line-alignment -----
|
|
@@ -16477,9 +16484,12 @@ type ConfigNames =
|
|
|
16477
16484
|
| '@bfra.me/jsonc'
|
|
16478
16485
|
| '@bfra.me/markdown/plugin'
|
|
16479
16486
|
| '@bfra.me/markdown/processor'
|
|
16480
|
-
| '@bfra.me/markdown/
|
|
16487
|
+
| '@bfra.me/markdown/parser'
|
|
16481
16488
|
| '@bfra.me/markdown/disabled'
|
|
16482
16489
|
| '@bfra.me/markdown/overrides'
|
|
16490
|
+
| '@bfra.me/markdown/code-blocks/typescript-javascript'
|
|
16491
|
+
| '@bfra.me/markdown/code-blocks/json'
|
|
16492
|
+
| '@bfra.me/markdown/code-blocks/yaml'
|
|
16483
16493
|
| '@bfra.me/nextjs/setup'
|
|
16484
16494
|
| '@bfra.me/nextjs/rules'
|
|
16485
16495
|
| '@bfra.me/node'
|
|
@@ -16657,13 +16667,156 @@ type JsoncOptions = Flatten<OptionsFiles & OptionsOverrides & OptionsStylistic>;
|
|
|
16657
16667
|
declare function jsonc(options?: JsoncOptions): Promise<Config[]>;
|
|
16658
16668
|
|
|
16659
16669
|
/**
|
|
16660
|
-
*
|
|
16670
|
+
* Markdown language mode for parsing.
|
|
16671
|
+
*
|
|
16672
|
+
* - `commonmark`: Standard CommonMark - strict, portable, widely compatible
|
|
16673
|
+
* - `gfm`: GitHub Flavored Markdown - adds tables, task lists, strikethrough, autolinks
|
|
16674
|
+
*
|
|
16675
|
+
* @example
|
|
16676
|
+
* ```typescript
|
|
16677
|
+
* // Use CommonMark for maximum portability
|
|
16678
|
+
* defineConfig({ markdown: { language: 'commonmark' } })
|
|
16679
|
+
*
|
|
16680
|
+
* // Use GFM for documentation sites
|
|
16681
|
+
* defineConfig({ markdown: { language: 'gfm' } })
|
|
16682
|
+
* ```
|
|
16683
|
+
*
|
|
16684
|
+
* @see {@link https://commonmark.org/ | CommonMark Specification}
|
|
16685
|
+
* @see {@link https://github.github.com/gfm/ | GitHub Flavored Markdown Specification}
|
|
16661
16686
|
*/
|
|
16662
|
-
type
|
|
16687
|
+
type MarkdownLanguage = 'commonmark' | 'gfm';
|
|
16663
16688
|
/**
|
|
16664
|
-
*
|
|
16665
|
-
*
|
|
16666
|
-
*
|
|
16689
|
+
* Frontmatter format options for Markdown files.
|
|
16690
|
+
*
|
|
16691
|
+
* Frontmatter is metadata at the beginning of a file, commonly used in static site generators.
|
|
16692
|
+
* When enabled, the parser extracts and validates the frontmatter block.
|
|
16693
|
+
*
|
|
16694
|
+
* @example
|
|
16695
|
+
* ```typescript
|
|
16696
|
+
* // YAML frontmatter (most common)
|
|
16697
|
+
* defineConfig({ markdown: { frontmatter: 'yaml' } })
|
|
16698
|
+
*
|
|
16699
|
+
* // TOML frontmatter
|
|
16700
|
+
* defineConfig({ markdown: { frontmatter: 'toml' } })
|
|
16701
|
+
*
|
|
16702
|
+
* // Disable frontmatter parsing
|
|
16703
|
+
* defineConfig({ markdown: { frontmatter: false } })
|
|
16704
|
+
* ```
|
|
16705
|
+
*/
|
|
16706
|
+
type MarkdownFrontmatterOptions = false | 'yaml' | 'toml' | 'json';
|
|
16707
|
+
/**
|
|
16708
|
+
* Code block processing configuration for Markdown files.
|
|
16709
|
+
*
|
|
16710
|
+
* Configure which languages are extracted and linted from code blocks,
|
|
16711
|
+
* including TypeScript, JavaScript, JSX, TSX, JSON, and YAML.
|
|
16712
|
+
*
|
|
16713
|
+
* @example
|
|
16714
|
+
* ```typescript
|
|
16715
|
+
* defineConfig({
|
|
16716
|
+
* markdown: {
|
|
16717
|
+
* codeBlocks: { typescript: true, javascript: true }
|
|
16718
|
+
* }
|
|
16719
|
+
* })
|
|
16720
|
+
* ```
|
|
16721
|
+
*/
|
|
16722
|
+
interface MarkdownCodeBlockOptions {
|
|
16723
|
+
/**
|
|
16724
|
+
* Enable TypeScript code block processing.
|
|
16725
|
+
*
|
|
16726
|
+
* @default true
|
|
16727
|
+
*/
|
|
16728
|
+
typescript?: boolean;
|
|
16729
|
+
/**
|
|
16730
|
+
* Enable JavaScript code block processing.
|
|
16731
|
+
*
|
|
16732
|
+
* @default true
|
|
16733
|
+
*/
|
|
16734
|
+
javascript?: boolean;
|
|
16735
|
+
/**
|
|
16736
|
+
* Enable JSX code block processing.
|
|
16737
|
+
*
|
|
16738
|
+
* @default true
|
|
16739
|
+
*/
|
|
16740
|
+
jsx?: boolean;
|
|
16741
|
+
/**
|
|
16742
|
+
* Enable JSON code block processing.
|
|
16743
|
+
*
|
|
16744
|
+
* @default true
|
|
16745
|
+
*/
|
|
16746
|
+
json?: boolean;
|
|
16747
|
+
/**
|
|
16748
|
+
* Enable YAML code block processing.
|
|
16749
|
+
*
|
|
16750
|
+
* @default true
|
|
16751
|
+
*/
|
|
16752
|
+
yaml?: boolean;
|
|
16753
|
+
}
|
|
16754
|
+
/**
|
|
16755
|
+
* Configuration options for Markdown linting.
|
|
16756
|
+
*
|
|
16757
|
+
* Provides control over Markdown parsing, frontmatter handling, code block extraction,
|
|
16758
|
+
* and rule configuration. Supports CommonMark and GitHub Flavored Markdown with optional
|
|
16759
|
+
* TypeScript-ESLint integration for code blocks.
|
|
16760
|
+
*
|
|
16761
|
+
* @example
|
|
16762
|
+
* ```typescript
|
|
16763
|
+
* // Documentation site with GFM and YAML frontmatter
|
|
16764
|
+
* defineConfig({
|
|
16765
|
+
* markdown: {
|
|
16766
|
+
* language: 'gfm',
|
|
16767
|
+
* frontmatter: 'yaml',
|
|
16768
|
+
* codeBlocks: { typescript: true, javascript: true }
|
|
16769
|
+
* }
|
|
16770
|
+
* })
|
|
16771
|
+
*
|
|
16772
|
+
* // Simple README files
|
|
16773
|
+
* defineConfig({
|
|
16774
|
+
* markdown: {
|
|
16775
|
+
* language: 'commonmark',
|
|
16776
|
+
* frontmatter: false,
|
|
16777
|
+
* files: ['README.md']
|
|
16778
|
+
* }
|
|
16779
|
+
* })
|
|
16780
|
+
* ```
|
|
16781
|
+
*
|
|
16782
|
+
* @see {@link https://github.com/eslint/markdown | @eslint/markdown}
|
|
16783
|
+
*/
|
|
16784
|
+
interface MarkdownOptions extends Flatten<OptionsFiles & OptionsOverrides> {
|
|
16785
|
+
/**
|
|
16786
|
+
* Markdown language mode.
|
|
16787
|
+
*
|
|
16788
|
+
* Choose between CommonMark (standard) and GitHub Flavored Markdown (GFM).
|
|
16789
|
+
* GFM adds tables, task lists, strikethrough, and autolinks.
|
|
16790
|
+
*
|
|
16791
|
+
* @default 'gfm'
|
|
16792
|
+
*/
|
|
16793
|
+
language?: MarkdownLanguage;
|
|
16794
|
+
/**
|
|
16795
|
+
* Frontmatter format to parse from Markdown files.
|
|
16796
|
+
*
|
|
16797
|
+
* Frontmatter is metadata at the beginning of a file, commonly used in static site generators.
|
|
16798
|
+
* Set to `false` to disable frontmatter parsing.
|
|
16799
|
+
*
|
|
16800
|
+
* @default 'yaml'
|
|
16801
|
+
*/
|
|
16802
|
+
frontmatter?: MarkdownFrontmatterOptions;
|
|
16803
|
+
/**
|
|
16804
|
+
* Code block processing configuration.
|
|
16805
|
+
*
|
|
16806
|
+
* Configure which languages are extracted and linted from code blocks.
|
|
16807
|
+
*
|
|
16808
|
+
* @default true (enables all supported languages)
|
|
16809
|
+
*/
|
|
16810
|
+
codeBlocks?: boolean | MarkdownCodeBlockOptions;
|
|
16811
|
+
}
|
|
16812
|
+
/**
|
|
16813
|
+
* Configures ESLint rules for Markdown files with support for CommonMark/GFM,
|
|
16814
|
+
* frontmatter parsing, and optional code block extraction.
|
|
16815
|
+
*
|
|
16816
|
+
* @param options - Configuration options for Markdown linting
|
|
16817
|
+
* @returns ESLint configuration array
|
|
16818
|
+
*
|
|
16819
|
+
* @see {@link https://github.com/eslint/markdown | @eslint/markdown}
|
|
16667
16820
|
*/
|
|
16668
16821
|
declare function markdown(options?: MarkdownOptions): Promise<Config[]>;
|
|
16669
16822
|
|
|
@@ -17094,8 +17247,29 @@ type Options = Flatten<{
|
|
|
17094
17247
|
jsx?: boolean;
|
|
17095
17248
|
/**
|
|
17096
17249
|
* Options to override the behavior of linting Markdown files.
|
|
17250
|
+
*
|
|
17251
|
+
* @remarks
|
|
17252
|
+
* Enable comprehensive Markdown linting with support for CommonMark and GitHub Flavored Markdown,
|
|
17253
|
+
* frontmatter parsing, and code block extraction.
|
|
17254
|
+
*
|
|
17255
|
+
* @example
|
|
17256
|
+
* ```typescript
|
|
17257
|
+
* // Enable with defaults
|
|
17258
|
+
* const config = defineConfig({ markdown: true });
|
|
17259
|
+
*
|
|
17260
|
+
* // Documentation site configuration
|
|
17261
|
+
* const config = defineConfig({
|
|
17262
|
+
* markdown: {
|
|
17263
|
+
* language: 'gfm',
|
|
17264
|
+
* frontmatter: 'yaml',
|
|
17265
|
+
* processor: { enabled: true, extractCodeBlocks: true }
|
|
17266
|
+
* }
|
|
17267
|
+
* });
|
|
17268
|
+
* ```
|
|
17269
|
+
*
|
|
17270
|
+
* @default true
|
|
17097
17271
|
*/
|
|
17098
|
-
markdown?: boolean |
|
|
17272
|
+
markdown?: boolean | MarkdownOptions;
|
|
17099
17273
|
/**
|
|
17100
17274
|
* Enable Next.js support.
|
|
17101
17275
|
*
|
|
@@ -17232,9 +17406,10 @@ declare const isInEditor: boolean;
|
|
|
17232
17406
|
|
|
17233
17407
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
17234
17408
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
17409
|
+
declare const GLOB_JS = "**/*.?([cm])js";
|
|
17235
17410
|
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
17236
17411
|
declare const GLOB_TS = "**/*.?([cm])ts";
|
|
17237
|
-
declare const GLOB_TSX = "
|
|
17412
|
+
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
17238
17413
|
declare const GLOB_JSON = "**/*.json";
|
|
17239
17414
|
declare const GLOB_JSON5 = "**/*.json5";
|
|
17240
17415
|
declare const GLOB_JSONC = "**/*.jsonc";
|
|
@@ -17259,4 +17434,4 @@ declare const GLOB_EXCLUDE: string[];
|
|
|
17259
17434
|
|
|
17260
17435
|
declare const config: eslint_flat_config_utils.FlatConfigComposer<Config, ConfigNames>;
|
|
17261
17436
|
|
|
17262
|
-
export { type AstroOptions, type Config, type ConfigNames, type FallbackOptions, type Flatten, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CODE_IN_MARKDOWN_FILES, GLOB_EXCLUDE, GLOB_EXT_IN_MARKDOWN_FILES, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_FILES, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_FILES, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_PACKAGE_JSON_FILES, GLOB_RENOVATE_CONFIG, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TOML, GLOB_TOML_FILES, GLOB_TS, GLOB_TSX, GLOB_TS_CONFIG, GLOB_YAML, GLOB_YAML_FILES, type ImportsOptions, type JSDocOptions, type JavaScriptOptions, type JsoncOptions, type MarkdownOptions, type NextjsOptions, type Options, type OptionsFiles, type OptionsIsInEditor, type OptionsOverrides, type OptionsPerfectionist, type OptionsStylistic, type OptionsTypeScript, type OptionsTypeScriptErasableSyntaxOnly, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PackageJsonOptions, type PerfectionistOptions, type PrettierOptions, type ReactOptions, type RegexpOptions, type Rules, type StylisticConfig, type StylisticOptions, type TomlOptions, type TypeScriptOptions, type UnicornOptions, type VitestOptions, type YamlOptions, astro, command, composeConfig, config, config as default, defineConfig, epilogue, eslintComments, fallback, gitignore, ignores, imports, isInEditor, isInGitLifecycle, javascript, jsdoc, jsonc, markdown, nextjs, node, packageJson, perfectionist, pnpm, prettier, react, regexp, sortPackageJson, sortRenovateConfig, sortTsconfig, stylistic, toml, typescript, unicorn, vitest, yaml };
|
|
17437
|
+
export { type AstroOptions, type Config, type ConfigNames, type FallbackOptions, type Flatten, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CODE_IN_MARKDOWN_FILES, GLOB_EXCLUDE, GLOB_EXT_IN_MARKDOWN_FILES, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_FILES, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_FILES, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_PACKAGE_JSON_FILES, GLOB_RENOVATE_CONFIG, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TOML, GLOB_TOML_FILES, GLOB_TS, GLOB_TSX, GLOB_TS_CONFIG, GLOB_YAML, GLOB_YAML_FILES, type ImportsOptions, type JSDocOptions, type JavaScriptOptions, type JsoncOptions, type MarkdownCodeBlockOptions, type MarkdownFrontmatterOptions, type MarkdownLanguage, type MarkdownOptions, type NextjsOptions, type Options, type OptionsFiles, type OptionsIsInEditor, type OptionsOverrides, type OptionsPerfectionist, type OptionsStylistic, type OptionsTypeScript, type OptionsTypeScriptErasableSyntaxOnly, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PackageJsonOptions, type PerfectionistOptions, type PrettierOptions, type ReactOptions, type RegexpOptions, type Rules, type StylisticConfig, type StylisticOptions, type TomlOptions, type TypeScriptOptions, type UnicornOptions, type VitestOptions, type YamlOptions, astro, command, composeConfig, config, config as default, defineConfig, epilogue, eslintComments, fallback, gitignore, ignores, imports, isInEditor, isInGitLifecycle, javascript, jsdoc, jsonc, markdown, nextjs, node, packageJson, perfectionist, pnpm, prettier, react, regexp, sortPackageJson, sortRenovateConfig, sortTsconfig, stylistic, toml, typescript, unicorn, vitest, yaml };
|
package/lib/index.js
CHANGED
|
@@ -8,9 +8,10 @@ var composeConfig = (...configs) => composer(...configs);
|
|
|
8
8
|
// src/globs.ts
|
|
9
9
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
10
10
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
11
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
11
12
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
12
13
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
13
|
-
var GLOB_TSX = "
|
|
14
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
14
15
|
var GLOB_JSON = "**/*.json";
|
|
15
16
|
var GLOB_JSON5 = "**/*.json5";
|
|
16
17
|
var GLOB_JSONC = "**/*.jsonc";
|
|
@@ -30,7 +31,13 @@ var GLOB_CODE_IN_MARKDOWN_FILES = GLOB_MARKDOWN_FILES.flatMap((p) => [
|
|
|
30
31
|
`${p}/*.ts`,
|
|
31
32
|
`${p}/*.tsx`,
|
|
32
33
|
`${p}/*.cts`,
|
|
33
|
-
`${p}/*.mts
|
|
34
|
+
`${p}/*.mts`,
|
|
35
|
+
`${p}/*.json`,
|
|
36
|
+
`${p}/*.json5`,
|
|
37
|
+
`${p}/*.jsonc`,
|
|
38
|
+
`${p}/*.yaml`,
|
|
39
|
+
`${p}/*.yml`,
|
|
40
|
+
`${p}/*.toml`
|
|
34
41
|
]);
|
|
35
42
|
var GLOB_EXT_IN_MARKDOWN_FILES = [
|
|
36
43
|
...GLOB_CODE_IN_MARKDOWN_FILES,
|
|
@@ -105,7 +112,7 @@ var GLOB_EXCLUDE = [
|
|
|
105
112
|
import { fileURLToPath } from "url";
|
|
106
113
|
|
|
107
114
|
// package.json
|
|
108
|
-
var version = "0.
|
|
115
|
+
var version = "0.41.0";
|
|
109
116
|
|
|
110
117
|
// src/parsers/any-parser.ts
|
|
111
118
|
var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
|
|
@@ -164,7 +171,7 @@ async function interopDefault(m) {
|
|
|
164
171
|
|
|
165
172
|
// src/configs/fallback.ts
|
|
166
173
|
async function fallback(missingList = [], options) {
|
|
167
|
-
const rules = await interopDefault(import("./missing-module-for-config-
|
|
174
|
+
const rules = await interopDefault(import("./missing-module-for-config-QFYTX2KG.js"));
|
|
168
175
|
const pluginName = `@bfra.me${missingList.length > 0 ? `/missing-modules-${missingList.map((m) => m.replaceAll(/[^a-z0-9]/gi, "-").toLowerCase()).join("-")}` : ""}`;
|
|
169
176
|
return [
|
|
170
177
|
{
|
|
@@ -789,88 +796,196 @@ var plainParser = {
|
|
|
789
796
|
|
|
790
797
|
// src/configs/markdown.ts
|
|
791
798
|
async function markdown(options = {}) {
|
|
792
|
-
const {
|
|
793
|
-
|
|
794
|
-
[
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
799
|
+
const {
|
|
800
|
+
codeBlocks = true,
|
|
801
|
+
files = [GLOB_MARKDOWN],
|
|
802
|
+
frontmatter = "yaml",
|
|
803
|
+
language = "gfm",
|
|
804
|
+
overrides = {}
|
|
805
|
+
} = options;
|
|
806
|
+
const markdown2 = await interopDefault(import("@eslint/markdown"));
|
|
807
|
+
const configs = [
|
|
808
|
+
{
|
|
809
|
+
name: "@bfra.me/markdown/plugin",
|
|
810
|
+
plugins: {
|
|
811
|
+
markdown: markdown2
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "@bfra.me/markdown/processor",
|
|
816
|
+
files,
|
|
817
|
+
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
818
|
+
language: `markdown/${language}`,
|
|
819
|
+
processor: mergeProcessors([markdown2.processors.markdown, processorPassThrough]),
|
|
820
|
+
...frontmatter !== false && {
|
|
821
|
+
languageOptions: { frontmatter }
|
|
822
|
+
}
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
name: "@bfra.me/markdown/parser",
|
|
826
|
+
files,
|
|
827
|
+
languageOptions: {
|
|
828
|
+
parser: plainParser
|
|
829
|
+
}
|
|
830
|
+
},
|
|
831
|
+
// Disable rules incompatible with Markdown processor's virtual files
|
|
832
|
+
// The @eslint/markdown processor creates virtual files that lack complete ESLint SourceCode API
|
|
833
|
+
// (getAllComments, getTokenBefore, etc.) and TypeScript parser services (esTreeNodeToTSNodeMap).
|
|
834
|
+
// This causes failures in plugins that depend on these features.
|
|
835
|
+
{
|
|
836
|
+
name: "@bfra.me/markdown/disabled",
|
|
837
|
+
files,
|
|
838
|
+
rules: {
|
|
839
|
+
"jsdoc/check-property-names": "off",
|
|
840
|
+
"jsdoc/require-property-name": "off",
|
|
841
|
+
"unicorn/filename-case": "off",
|
|
842
|
+
"command/command": "off",
|
|
843
|
+
"jsdoc/check-access": "off",
|
|
844
|
+
"jsdoc/check-types": "off",
|
|
845
|
+
"jsdoc/empty-tags": "off",
|
|
846
|
+
"jsdoc/no-multi-asterisks": "off",
|
|
847
|
+
"jsdoc/require-property": "off",
|
|
848
|
+
"jsdoc/require-property-description": "off",
|
|
849
|
+
"no-irregular-whitespace": "off",
|
|
850
|
+
"perfectionist/sort-exports": "off",
|
|
851
|
+
"perfectionist/sort-imports": "off",
|
|
852
|
+
"regexp/no-legacy-features": "off",
|
|
853
|
+
"regexp/no-missing-g-flag": "off",
|
|
854
|
+
"regexp/no-useless-dollar-replacements": "off",
|
|
855
|
+
"regexp/no-useless-flag": "off"
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
name: "@bfra.me/markdown/overrides",
|
|
860
|
+
files,
|
|
861
|
+
rules: {
|
|
862
|
+
"markdown/fenced-code-language": "warn",
|
|
863
|
+
"markdown/heading-increment": "error",
|
|
864
|
+
"markdown/no-duplicate-definitions": "error",
|
|
865
|
+
"markdown/no-empty-definitions": "error",
|
|
866
|
+
"markdown/no-empty-images": "error",
|
|
867
|
+
"markdown/no-empty-links": "error",
|
|
868
|
+
"markdown/no-invalid-label-refs": "error",
|
|
869
|
+
"markdown/no-missing-atx-heading-space": "error",
|
|
870
|
+
"markdown/no-missing-label-refs": "error",
|
|
871
|
+
"markdown/no-missing-link-fragments": "error",
|
|
872
|
+
"markdown/no-multiple-h1": "error",
|
|
873
|
+
"markdown/no-reference-like-urls": "error",
|
|
874
|
+
"markdown/no-reversed-media-syntax": "error",
|
|
875
|
+
"markdown/no-space-in-emphasis": "error",
|
|
876
|
+
"markdown/no-unused-definitions": "error",
|
|
877
|
+
"markdown/require-alt-text": "error",
|
|
878
|
+
"markdown/table-column-count": "error",
|
|
879
|
+
...overrides
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
];
|
|
883
|
+
if (codeBlocks === false) {
|
|
884
|
+
return configs;
|
|
885
|
+
}
|
|
886
|
+
const {
|
|
887
|
+
javascript: javascript2 = true,
|
|
888
|
+
json = true,
|
|
889
|
+
jsx = true,
|
|
890
|
+
typescript: typescript2 = true,
|
|
891
|
+
yaml: yaml2 = true
|
|
892
|
+
} = codeBlocks === true ? {} : codeBlocks;
|
|
893
|
+
if (typescript2 || javascript2 || jsx) {
|
|
894
|
+
const tselint = await interopDefault(import("typescript-eslint"));
|
|
895
|
+
const tsJsFiles = [];
|
|
896
|
+
if (typescript2) {
|
|
897
|
+
tsJsFiles.push(...GLOB_MARKDOWN_FILES.map((p) => `${p}/${GLOB_TS}`));
|
|
898
|
+
}
|
|
899
|
+
if (typescript2 || jsx) {
|
|
900
|
+
tsJsFiles.push(...GLOB_MARKDOWN_FILES.map((p) => `${p}/${GLOB_TSX}`));
|
|
901
|
+
}
|
|
902
|
+
if (javascript2) {
|
|
903
|
+
tsJsFiles.push(...GLOB_MARKDOWN_FILES.map((p) => `${p}/${GLOB_JS}`));
|
|
904
|
+
}
|
|
905
|
+
if (javascript2 || jsx) {
|
|
906
|
+
tsJsFiles.push(...GLOB_MARKDOWN_FILES.map((p) => `${p}/${GLOB_JSX}`));
|
|
907
|
+
}
|
|
908
|
+
configs.push({
|
|
909
|
+
name: "@bfra.me/markdown/code-blocks/typescript-javascript",
|
|
910
|
+
files: tsJsFiles,
|
|
911
|
+
languageOptions: {
|
|
912
|
+
parser: tselint.parser,
|
|
913
|
+
parserOptions: {
|
|
914
|
+
ecmaFeatures: {
|
|
915
|
+
impliedStrict: true,
|
|
916
|
+
jsx: jsx || javascript2
|
|
836
917
|
},
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
"@stylistic/eol-last": "off",
|
|
842
|
-
"@stylistic/padding-line-between-statements": "off",
|
|
843
|
-
"@typescript-eslint/consistent-type-imports": "off",
|
|
844
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
845
|
-
"@typescript-eslint/no-redeclare": "off",
|
|
846
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
847
|
-
"@typescript-eslint/no-unused-expressions": "off",
|
|
848
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
849
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
850
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
851
|
-
"import-x/newline-after-import": "off",
|
|
852
|
-
"jsdoc/require-returns-check": "off",
|
|
853
|
-
"no-alert": "off",
|
|
854
|
-
"no-console": "off",
|
|
855
|
-
"no-labels": "off",
|
|
856
|
-
"no-lone-blocks": "off",
|
|
857
|
-
"no-restricted-imports": "off",
|
|
858
|
-
"no-restricted-syntax": "off",
|
|
859
|
-
"no-undef": "off",
|
|
860
|
-
"no-unused-expressions": "off",
|
|
861
|
-
"no-unused-labels": "off",
|
|
862
|
-
"no-unused-vars": "off",
|
|
863
|
-
"node/prefer-global/process": "off",
|
|
864
|
-
"unicode-bom": "off",
|
|
865
|
-
"unused-imports/no-unused-imports": "off",
|
|
866
|
-
"unused-imports/no-unused-vars": "off",
|
|
867
|
-
...overrides
|
|
868
|
-
}
|
|
918
|
+
ecmaVersion: "latest",
|
|
919
|
+
// Type-aware rules disabled: documentation snippets lack tsconfig context
|
|
920
|
+
project: null,
|
|
921
|
+
sourceType: "module"
|
|
869
922
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
923
|
+
},
|
|
924
|
+
rules: {
|
|
925
|
+
// Only disable non-type-aware rules we want to skip for markdown code blocks
|
|
926
|
+
"@typescript-eslint/no-namespace": "off",
|
|
927
|
+
"@stylistic/comma-dangle": "off",
|
|
928
|
+
"@stylistic/eol-last": "off",
|
|
929
|
+
"@stylistic/padding-line-between-statements": "off",
|
|
930
|
+
"@typescript-eslint/consistent-type-imports": "off",
|
|
931
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
932
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
933
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
934
|
+
"@typescript-eslint/no-unused-expressions": "off",
|
|
935
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
936
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
937
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
938
|
+
"import-x/newline-after-import": "off",
|
|
939
|
+
"jsdoc/require-returns-check": "off",
|
|
940
|
+
"no-alert": "off",
|
|
941
|
+
"no-console": "off",
|
|
942
|
+
"no-labels": "off",
|
|
943
|
+
"no-lone-blocks": "off",
|
|
944
|
+
"no-restricted-imports": "off",
|
|
945
|
+
"no-restricted-syntax": "off",
|
|
946
|
+
"no-undef": "off",
|
|
947
|
+
"no-unused-expressions": "off",
|
|
948
|
+
"no-unused-labels": "off",
|
|
949
|
+
"no-unused-vars": "off",
|
|
950
|
+
"node/prefer-global/process": "off",
|
|
951
|
+
"unicode-bom": "off",
|
|
952
|
+
"unused-imports/no-unused-imports": "off",
|
|
953
|
+
"unused-imports/no-unused-vars": "off"
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
if (json) {
|
|
958
|
+
const pluginJsonc = await interopDefault(import("eslint-plugin-jsonc"));
|
|
959
|
+
const baseConfigs = pluginJsonc.configs["flat/base"];
|
|
960
|
+
configs.push({
|
|
961
|
+
name: "@bfra.me/markdown/code-blocks/json",
|
|
962
|
+
files: GLOB_MARKDOWN_FILES.flatMap((p) => [
|
|
963
|
+
`${p}/${GLOB_JSON}`,
|
|
964
|
+
`${p}/${GLOB_JSON5}`,
|
|
965
|
+
`${p}/${GLOB_JSONC}`
|
|
966
|
+
]),
|
|
967
|
+
languageOptions: baseConfigs[1]?.languageOptions ?? {},
|
|
968
|
+
rules: {
|
|
969
|
+
// Examples may show JSON with trailing commas or explanatory comments
|
|
970
|
+
"jsonc/comma-dangle": "off",
|
|
971
|
+
"jsonc/no-comments": "off"
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
if (yaml2) {
|
|
976
|
+
const pluginYaml = await interopDefault(import("eslint-plugin-yml"));
|
|
977
|
+
const standardConfigs = pluginYaml.configs["flat/standard"];
|
|
978
|
+
configs.push({
|
|
979
|
+
name: "@bfra.me/markdown/code-blocks/yaml",
|
|
980
|
+
files: GLOB_MARKDOWN_FILES.map((p) => `${p}/${GLOB_YAML}`),
|
|
981
|
+
languageOptions: standardConfigs[1]?.languageOptions ?? {},
|
|
982
|
+
rules: {
|
|
983
|
+
// Examples may show incomplete YAML mappings to focus on specific concepts
|
|
984
|
+
"yml/no-empty-mapping-value": "off"
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
return configs;
|
|
874
989
|
}
|
|
875
990
|
|
|
876
991
|
// src/configs/nextjs.ts
|
|
@@ -2279,6 +2394,7 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
2279
2394
|
if (options.markdown ?? true) {
|
|
2280
2395
|
configs.push(
|
|
2281
2396
|
markdown({
|
|
2397
|
+
...resolveSubOptions(options, "markdown"),
|
|
2282
2398
|
overrides: getOverrides(options, "markdown")
|
|
2283
2399
|
})
|
|
2284
2400
|
);
|
|
@@ -2321,6 +2437,7 @@ export {
|
|
|
2321
2437
|
GLOB_CODE_IN_MARKDOWN_FILES,
|
|
2322
2438
|
GLOB_EXCLUDE,
|
|
2323
2439
|
GLOB_EXT_IN_MARKDOWN_FILES,
|
|
2440
|
+
GLOB_JS,
|
|
2324
2441
|
GLOB_JSON,
|
|
2325
2442
|
GLOB_JSON5,
|
|
2326
2443
|
GLOB_JSONC,
|
|
@@ -126,11 +126,11 @@ function create(context) {
|
|
|
126
126
|
for (const module of modules) {
|
|
127
127
|
let output = "";
|
|
128
128
|
if (shouldFix) {
|
|
129
|
-
const result = tryInstall(module, context.filename
|
|
129
|
+
const result = tryInstall(module, context.filename) ?? "";
|
|
130
130
|
output = result ? `
|
|
131
131
|
${result}` : "";
|
|
132
132
|
}
|
|
133
|
-
const command = getPackageInstallCommand(module, context.filename
|
|
133
|
+
const command = getPackageInstallCommand(module, context.filename) ?? "";
|
|
134
134
|
context.report({
|
|
135
135
|
loc: { column: 0, line: 1 },
|
|
136
136
|
message: `Missing module for config: ${module}. Run: \`${command || `npm i -D ${module}`}\`${output}`
|
|
@@ -142,4 +142,4 @@ export {
|
|
|
142
142
|
create,
|
|
143
143
|
meta
|
|
144
144
|
};
|
|
145
|
-
//# sourceMappingURL=missing-module-for-config-
|
|
145
|
+
//# sourceMappingURL=missing-module-for-config-QFYTX2KG.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bfra.me/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Shared ESLint configuration for bfra.me",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bfra.me",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
|
|
41
41
|
"@eslint/markdown": "7.5.1",
|
|
42
|
-
"@stylistic/eslint-plugin": "5.
|
|
42
|
+
"@stylistic/eslint-plugin": "5.6.1",
|
|
43
43
|
"eslint-config-flat-gitignore": "2.1.0",
|
|
44
44
|
"eslint-flat-config-utils": "2.1.4",
|
|
45
45
|
"eslint-merge-processors": "2.0.0",
|
|
46
46
|
"eslint-plugin-command": "3.3.1",
|
|
47
47
|
"eslint-plugin-import-x": "4.16.1",
|
|
48
|
-
"eslint-plugin-jsdoc": "61.
|
|
48
|
+
"eslint-plugin-jsdoc": "61.3.0",
|
|
49
49
|
"eslint-plugin-json-schema-validator": "5.5.0",
|
|
50
50
|
"eslint-plugin-jsonc": "2.21.0",
|
|
51
51
|
"eslint-plugin-n": "17.23.1",
|
|
@@ -61,32 +61,29 @@
|
|
|
61
61
|
"package-directory": "8.1.0",
|
|
62
62
|
"package-manager-detector": "1.5.0",
|
|
63
63
|
"sort-package-json": "3.4.0",
|
|
64
|
-
"typescript-eslint": "8.
|
|
64
|
+
"typescript-eslint": "8.47.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@eslint-react/eslint-plugin": "2.3.5",
|
|
68
|
-
"@eslint/config-inspector": "1.
|
|
69
|
-
"@eslint/core": "0.
|
|
68
|
+
"@eslint/config-inspector": "1.4.2",
|
|
69
|
+
"@eslint/core": "1.0.0",
|
|
70
70
|
"@next/eslint-plugin-next": "16.0.3",
|
|
71
71
|
"@types/eslint-config-prettier": "6.11.3",
|
|
72
|
-
"@typescript-eslint/types": "8.
|
|
73
|
-
"@vitest/eslint-plugin": "1.4.
|
|
72
|
+
"@typescript-eslint/types": "8.47.0",
|
|
73
|
+
"@vitest/eslint-plugin": "1.4.3",
|
|
74
74
|
"astro-eslint-parser": "1.2.2",
|
|
75
75
|
"eslint": "9.39.1",
|
|
76
76
|
"eslint-config-prettier": "10.1.8",
|
|
77
77
|
"eslint-plugin-astro": "1.5.0",
|
|
78
78
|
"eslint-plugin-erasable-syntax-only": "0.4.0",
|
|
79
|
-
"eslint-plugin-node-dependencies": "1.
|
|
79
|
+
"eslint-plugin-node-dependencies": "1.3.0",
|
|
80
80
|
"eslint-plugin-pnpm": "1.3.0",
|
|
81
81
|
"eslint-plugin-prettier": "5.5.4",
|
|
82
82
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
83
83
|
"eslint-plugin-react-refresh": "0.4.24",
|
|
84
84
|
"eslint-typegen": "2.3.0",
|
|
85
|
-
"
|
|
86
|
-
"@bfra.me/
|
|
87
|
-
"@bfra.me/prettier-config": "0.16.2",
|
|
88
|
-
"@bfra.me/tsconfig": "0.12.0",
|
|
89
|
-
"@bfra.me/works": "0.0.0-development"
|
|
85
|
+
"@bfra.me/works": "0.0.0-development",
|
|
86
|
+
"@bfra.me/prettier-config": "0.16.3"
|
|
90
87
|
},
|
|
91
88
|
"peerDependencies": {
|
|
92
89
|
"@eslint-react/eslint-plugin": "^2.0.1",
|