@enormora/eslint-config-base 0.0.33 → 0.0.35

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/package.json CHANGED
@@ -4,14 +4,22 @@
4
4
  "Christian Rackerseder <github@echooff.de>"
5
5
  ],
6
6
  "dependencies": {
7
- "@ben_12/eslint-plugin-dprint": "1.19.0",
7
+ "@ben_12/eslint-plugin-dprint": "1.21.0",
8
8
  "@ben_12/eslint-simple-parser": "0.1.0",
9
- "@cspell/eslint-plugin": "10.0.0",
10
- "@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
9
+ "@cspell/eslint-plugin": "10.0.1",
10
+ "@dprint/json": "0.21.3",
11
+ "@dprint/markdown": "0.22.1",
12
+ "@dprint/toml": "0.7.0",
13
+ "@dprint/typescript": "0.96.1",
14
+ "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
15
+ "@eslint/markdown": "8.0.2",
11
16
  "@stylistic/eslint-plugin": "5.10.0",
17
+ "dprint-plugin-yaml": "0.6.0",
12
18
  "eslint-plugin-array-func": "5.1.1",
13
19
  "eslint-plugin-destructuring": "2.2.1",
14
20
  "eslint-plugin-import-x": "4.16.2",
21
+ "eslint-plugin-markdown-links": "0.9.0",
22
+ "eslint-plugin-markdown-preferences": "0.41.1",
15
23
  "eslint-plugin-no-barrel-files": "1.3.1",
16
24
  "eslint-plugin-no-secrets": "2.3.3",
17
25
  "eslint-plugin-promise": "7.3.0",
@@ -48,9 +56,11 @@
48
56
  "sideEffects": [
49
57
  "./presets/base/base-shared.js",
50
58
  "./presets/base/base.js",
59
+ "./presets/base/dprint-formatters.js",
60
+ "./presets/base/markdown.js",
51
61
  "./rule-sets/best-practices.js",
52
62
  "./rule-sets/restricted-syntax.js"
53
63
  ],
54
64
  "type": "module",
55
- "version": "0.0.33"
65
+ "version": "0.0.35"
56
66
  }
@@ -20,6 +20,31 @@ const restrictedSyntaxPlugin = createRestrictedSyntaxPlugin([
20
20
  'no-in-operator'
21
21
  ]);
22
22
 
23
+ export const cspellSpellcheckerOptions = {
24
+ autoFix: false,
25
+ numSuggestions: 3,
26
+ generateSuggestions: true,
27
+ ignoreImports: true,
28
+ ignoreImportProperties: true,
29
+ checkIdentifiers: true,
30
+ checkStrings: true,
31
+ checkStringTemplates: true,
32
+ checkJSXText: true,
33
+ checkComments: true,
34
+ cspell: {
35
+ words: [],
36
+ ignoreWords: [],
37
+ flagWords: [],
38
+ ignoreRegExpList: [],
39
+ includeRegExpList: [],
40
+ allowCompoundWords: true,
41
+ import: [],
42
+ dictionaries: []
43
+ },
44
+ customWordListFile: undefined,
45
+ debugMode: false
46
+ };
47
+
23
48
  export const baseSharedConfig = {
24
49
  languageOptions: {
25
50
  ecmaVersion,
@@ -185,7 +210,23 @@ export const baseSharedConfig = {
185
210
  'no-warning-comments': [
186
211
  'error',
187
212
  {
188
- terms: [ 'todo', 'fixme', 'wtf', 'falls through', 'istanbul', 'c8' ],
213
+ terms: [
214
+ 'todo',
215
+ 'fixme',
216
+ 'wtf',
217
+ 'falls through',
218
+ 'istanbul',
219
+ 'c8',
220
+ 'v8 ignore',
221
+ 'node:coverage',
222
+ 'prettier-ignore',
223
+ 'dprint-ignore',
224
+ 'cspell:disable',
225
+ 'cspell:ignore',
226
+ 'cspell:words',
227
+ 'Stryker disable',
228
+ 'Stryker restore'
229
+ ],
189
230
  location: 'anywhere'
190
231
  }
191
232
  ],
@@ -425,32 +466,6 @@ export const baseSharedConfig = {
425
466
  'import/no-rename-default': 'off',
426
467
  'import/prefer-namespace-import': 'off',
427
468
 
428
- '@cspell/spellchecker': [
429
- 'warn',
430
- {
431
- autoFix: false,
432
- numSuggestions: 3,
433
- generateSuggestions: true,
434
- ignoreImports: true,
435
- ignoreImportProperties: true,
436
- checkIdentifiers: true,
437
- checkStrings: true,
438
- checkStringTemplates: true,
439
- checkJSXText: true,
440
- checkComments: true,
441
- cspell: {
442
- words: [],
443
- ignoreWords: [],
444
- flagWords: [],
445
- ignoreRegExpList: [],
446
- includeRegExpList: [],
447
- allowCompoundWords: true,
448
- import: [],
449
- dictionaries: []
450
- },
451
- customWordListFile: undefined,
452
- debugMode: false
453
- }
454
- ]
469
+ '@cspell/spellchecker': [ 'error', cspellSpellcheckerOptions ]
455
470
  }
456
471
  };
@@ -1,13 +1,9 @@
1
1
  import dprintPlugin from '@ben_12/eslint-plugin-dprint';
2
2
  import simpleParser from '@ben_12/eslint-simple-parser';
3
3
  import { baseSharedConfig } from './base-shared.js';
4
- import {
5
- jsonDprintConfig,
6
- markdownDprintConfig,
7
- tomlDprintConfig,
8
- typescriptDprintConfig,
9
- yamlDprintConfig
10
- } from './dprint-config.js';
4
+ import { jsonDprintConfig, tomlDprintConfig, typescriptDprintConfig, yamlDprintConfig } from './dprint-config.js';
5
+ import { dprintSettings } from './dprint-formatters.js';
6
+ import { markdownConfig } from './markdown.js';
11
7
 
12
8
  const baseJsConfig = {
13
9
  files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
@@ -16,6 +12,7 @@ const baseJsConfig = {
16
12
  ...baseSharedConfig.plugins,
17
13
  dprint: dprintPlugin
18
14
  },
15
+ settings: { ...baseSharedConfig.settings, ...dprintSettings },
19
16
  rules: {
20
17
  ...baseSharedConfig.rules,
21
18
 
@@ -37,20 +34,15 @@ const dprintJsonConfig = {
37
34
  files: [ '**/*.json' ],
38
35
  languageOptions: { parser: simpleParser },
39
36
  plugins: { dprint: dprintPlugin },
37
+ settings: dprintSettings,
40
38
  rules: { 'dprint/json': [ 'error', { config: jsonDprintConfig } ] }
41
39
  };
42
40
 
43
- const dprintMarkdownConfig = {
44
- files: [ '**/*.md' ],
45
- languageOptions: { parser: simpleParser },
46
- plugins: { dprint: dprintPlugin },
47
- rules: { 'dprint/markdown': [ 'error', { config: markdownDprintConfig } ] }
48
- };
49
-
50
41
  const dprintYamlConfig = {
51
42
  files: [ '**/*.{yml,yaml}' ],
52
43
  languageOptions: { parser: simpleParser },
53
44
  plugins: { dprint: dprintPlugin },
45
+ settings: dprintSettings,
54
46
  rules: { 'dprint/yaml': [ 'error', { config: yamlDprintConfig } ] }
55
47
  };
56
48
 
@@ -58,18 +50,19 @@ const dprintTomlConfig = {
58
50
  files: [ '**/*.toml' ],
59
51
  languageOptions: { parser: simpleParser },
60
52
  plugins: { dprint: dprintPlugin },
53
+ settings: dprintSettings,
61
54
  rules: { 'dprint/toml': [ 'error', { config: tomlDprintConfig } ] }
62
55
  };
63
56
 
64
57
  export const baseConfig = [
65
58
  baseJsConfig,
66
59
  dprintJsonConfig,
67
- dprintMarkdownConfig,
60
+ markdownConfig,
68
61
  dprintYamlConfig,
69
62
  dprintTomlConfig
70
63
  ];
71
64
 
72
- /* eslint-disable no-barrel-files/no-barrel-files -- expose dprint configs as public API so consumers can spread them when overriding individual options */
65
+ /* eslint-disable no-barrel-files/no-barrel-files -- expose dprint configs and cspell helper as public API so consumers can spread or call them when customizing */
73
66
  export {
74
67
  jsonDprintConfig,
75
68
  markdownDprintConfig,
@@ -77,4 +70,5 @@ export {
77
70
  typescriptDprintConfig,
78
71
  yamlDprintConfig
79
72
  } from './dprint-config.js';
73
+ export { withCspellWords } from './cspell-config.js';
80
74
  /* eslint-enable no-barrel-files/no-barrel-files -- end of public re-exports */
@@ -0,0 +1 @@
1
+ import { cspellSpellcheckerOptions } from './base-shared.js';
@@ -73,7 +73,10 @@ export const jsonDprintConfig = {
73
73
 
74
74
  export const markdownDprintConfig = {
75
75
  lineWidth,
76
- newLineKind: 'lf'
76
+ newLineKind: 'lf',
77
+ textWrap: 'maintain',
78
+ emphasisKind: 'underscores',
79
+ strongKind: 'asterisks'
77
80
  };
78
81
 
79
82
  export const yamlDprintConfig = {
@@ -0,0 +1,30 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import dprintJsonFormatter from '@dprint/json';
3
+ import dprintMarkdownFormatter from '@dprint/markdown';
4
+ import dprintTomlFormatter from '@dprint/toml';
5
+ import dprintTypescriptFormatter from '@dprint/typescript';
6
+
7
+ // `dprint-plugin-yaml` ships only `plugin.wasm` and `package.json` — there is no JS entry to import
8
+ // from. Packtory's dependency scanner records `import.meta.resolve('<pkg>/plugin.wasm')` call sites
9
+ // (since `@packtory/cli@0.0.31`), so this call is what makes the package land in the published
10
+ // `dependencies`. The dprint plugin reads the bytes itself when it resolves a `getPath`-shaped
11
+ // formatter, so we just hand it the path.
12
+ const dprintYamlWasmPath = fileURLToPath(import.meta.resolve('dprint-plugin-yaml/plugin.wasm'));
13
+
14
+ const dprintYamlFormatter = {
15
+ getPath() {
16
+ return dprintYamlWasmPath;
17
+ }
18
+ };
19
+
20
+ export const dprintSettings = {
21
+ '@ben_12/dprint': {
22
+ formatters: {
23
+ typescript: dprintTypescriptFormatter,
24
+ json: dprintJsonFormatter,
25
+ markdown: dprintMarkdownFormatter,
26
+ toml: dprintTomlFormatter,
27
+ yaml: dprintYamlFormatter
28
+ }
29
+ }
30
+ };
@@ -0,0 +1,147 @@
1
+ import dprintPlugin from '@ben_12/eslint-plugin-dprint';
2
+ import markdownPlugin from '@eslint/markdown';
3
+ import markdownLinksPlugin from 'eslint-plugin-markdown-links';
4
+ import markdownPreferencesPlugin from 'eslint-plugin-markdown-preferences';
5
+ import {
6
+ jsonDprintConfig,
7
+ markdownDprintConfig,
8
+ tomlDprintConfig,
9
+ typescriptDprintConfig,
10
+ yamlDprintConfig
11
+ } from './dprint-config.js';
12
+ import { dprintSettings } from './dprint-formatters.js';
13
+
14
+ // `@eslint/markdown` declares `language: 'markdown/commonmark'` for .md files, which makes ESLint
15
+ // parse them into an mdast tree (root node `type: 'root'`). The stock `dprint/markdown` rule listens
16
+ // on the ESTree selector `Program` and therefore never fires under that language, silently turning
17
+ // dprint formatting off. The adapter below wraps the original `dprint/markdown` rule and re-keys its
18
+ // visitor under the mdast `root` selector so the formatter runs in the same pass as the linters.
19
+ const originalDprintMarkdownRule = dprintPlugin.rules.markdown;
20
+ const dprintMarkdownLanguageAdapter = {
21
+ rules: {
22
+ markdown: {
23
+ meta: originalDprintMarkdownRule.meta,
24
+ create(context) {
25
+ const inner = originalDprintMarkdownRule.create(context);
26
+ return { root: inner.Program };
27
+ }
28
+ }
29
+ }
30
+ };
31
+
32
+ export const markdownConfig = {
33
+ files: [ '**/*.md' ],
34
+ plugins: {
35
+ markdown: markdownPlugin,
36
+ 'markdown-links': markdownLinksPlugin,
37
+ 'markdown-preferences': markdownPreferencesPlugin,
38
+ 'dprint-markdown': dprintMarkdownLanguageAdapter
39
+ },
40
+ // Pinned to commonmark because @eslint/markdown@8.0.2's MarkdownSourceCode does not implement
41
+ // getLoc() for GFM-specific nodes (autolinks, tableCell, etc.). Rules such as
42
+ // markdown/no-bare-urls and markdown/table-column-count fire under gfm but then crash ESLint
43
+ // 10's reporter ("Custom getLoc() method must be implemented in the subclass"). Revisit once
44
+ // @eslint/markdown ships a fix.
45
+ language: 'markdown/commonmark',
46
+ settings: dprintSettings,
47
+ rules: {
48
+ 'dprint-markdown/markdown': [
49
+ 'error',
50
+ {
51
+ config: markdownDprintConfig,
52
+ hostConfigs: {
53
+ typescript: typescriptDprintConfig,
54
+ json: jsonDprintConfig,
55
+ toml: tomlDprintConfig,
56
+ yaml: yamlDprintConfig
57
+ }
58
+ }
59
+ ],
60
+
61
+ 'markdown/fenced-code-language': 'error',
62
+ 'markdown/fenced-code-meta': 'off',
63
+ 'markdown/heading-increment': 'error',
64
+ 'markdown/no-bare-urls': 'error',
65
+ 'markdown/no-duplicate-definitions': 'error',
66
+ 'markdown/no-duplicate-headings': 'error',
67
+ 'markdown/no-empty-definitions': 'error',
68
+ 'markdown/no-empty-images': 'error',
69
+ 'markdown/no-empty-links': 'error',
70
+ 'markdown/no-html': 'error',
71
+ 'markdown/no-invalid-label-refs': 'error',
72
+ 'markdown/no-missing-atx-heading-space': 'error',
73
+ 'markdown/no-missing-label-refs': 'error',
74
+ 'markdown/no-missing-link-fragments': 'error',
75
+ 'markdown/no-multiple-h1': 'error',
76
+ 'markdown/no-reference-like-urls': 'error',
77
+ 'markdown/no-reversed-media-syntax': 'error',
78
+ 'markdown/no-space-in-emphasis': 'error',
79
+ 'markdown/no-unused-definitions': 'error',
80
+ 'markdown/require-alt-text': 'error',
81
+ 'markdown/table-column-count': 'error',
82
+
83
+ // markdown-links: external network check is opt-in to keep CI deterministic;
84
+ // local-path and fragment checks are pure wins.
85
+ 'markdown-links/no-dead-urls': 'off',
86
+ 'markdown-links/no-missing-fragments': 'error',
87
+ 'markdown-links/no-missing-path': 'error',
88
+ 'markdown-links/no-self-destination': 'error',
89
+
90
+ // markdown-preferences: many rules overlap with dprint/markdown formatting. We enable only
91
+ // the 8 rules from this plugin's `recommended` config (none of which fight dprint) and
92
+ // explicitly turn the other 45 off. Override individually if a stricter style is desired.
93
+ 'markdown-preferences/atx-heading-closing-sequence': 'off',
94
+ 'markdown-preferences/atx-heading-closing-sequence-length': 'off',
95
+ 'markdown-preferences/blockquote-marker-alignment': 'error',
96
+ 'markdown-preferences/bullet-list-marker-style': 'off',
97
+ 'markdown-preferences/canonical-code-block-language': 'off',
98
+ 'markdown-preferences/code-fence-length': 'off',
99
+ 'markdown-preferences/code-fence-spacing': 'off',
100
+ 'markdown-preferences/code-fence-style': 'off',
101
+ 'markdown-preferences/custom-container-marker-spacing': 'off',
102
+ 'markdown-preferences/definitions-last': 'off',
103
+ 'markdown-preferences/emoji-notation': 'off',
104
+ 'markdown-preferences/emphasis-delimiters-style': 'off',
105
+ 'markdown-preferences/hard-linebreak-style': 'error',
106
+ 'markdown-preferences/heading-casing': 'off',
107
+ 'markdown-preferences/indent': 'off',
108
+ 'markdown-preferences/level1-heading-style': 'off',
109
+ 'markdown-preferences/level2-heading-style': 'off',
110
+ 'markdown-preferences/link-bracket-newline': 'off',
111
+ 'markdown-preferences/link-bracket-spacing': 'off',
112
+ 'markdown-preferences/link-destination-style': 'off',
113
+ 'markdown-preferences/link-paren-newline': 'off',
114
+ 'markdown-preferences/link-paren-spacing': 'off',
115
+ 'markdown-preferences/link-title-style': 'off',
116
+ 'markdown-preferences/list-marker-alignment': 'error',
117
+ 'markdown-preferences/max-len': 'off',
118
+ 'markdown-preferences/no-heading-trailing-punctuation': 'off',
119
+ 'markdown-preferences/no-implicit-block-closing': 'error',
120
+ 'markdown-preferences/no-laziness-blockquotes': 'error',
121
+ 'markdown-preferences/no-multi-spaces': 'off',
122
+ 'markdown-preferences/no-multiple-empty-lines': 'off',
123
+ 'markdown-preferences/no-tabs': 'off',
124
+ 'markdown-preferences/no-text-backslash-linebreak': 'error',
125
+ 'markdown-preferences/no-trailing-spaces': 'off',
126
+ 'markdown-preferences/ordered-list-marker-sequence': 'off',
127
+ 'markdown-preferences/ordered-list-marker-start': 'off',
128
+ 'markdown-preferences/ordered-list-marker-style': 'off',
129
+ 'markdown-preferences/padded-custom-containers': 'off',
130
+ 'markdown-preferences/padding-line-between-blocks': 'off',
131
+ 'markdown-preferences/prefer-autolinks': 'error',
132
+ 'markdown-preferences/prefer-fenced-code-blocks': 'error',
133
+ 'markdown-preferences/prefer-inline-code-words': 'off',
134
+ 'markdown-preferences/prefer-link-reference-definitions': 'off',
135
+ 'markdown-preferences/prefer-linked-words': 'off',
136
+ 'markdown-preferences/setext-heading-underline-length': 'off',
137
+ 'markdown-preferences/sort-definitions': 'off',
138
+ 'markdown-preferences/strikethrough-delimiters-style': 'off',
139
+ 'markdown-preferences/table-header-casing': 'off',
140
+ 'markdown-preferences/table-leading-trailing-pipes': 'off',
141
+ 'markdown-preferences/table-pipe-alignment': 'off',
142
+ 'markdown-preferences/table-pipe-spacing': 'off',
143
+ 'markdown-preferences/thematic-break-character-style': 'off',
144
+ 'markdown-preferences/thematic-break-length': 'off',
145
+ 'markdown-preferences/thematic-break-sequence-pattern': 'off'
146
+ }
147
+ };
package/readme.md CHANGED
@@ -12,6 +12,44 @@ formatter step. The dprint configuration ships inline with this preset, so no `d
12
12
  project root. If you'd rather use prettier, use [`@enormora/eslint-config-base-with-prettier`](../base-with-prettier/base-with-prettier.md)
13
13
  instead — it is an alternative base preset and is not meant to be combined with this one.
14
14
 
15
+ Markdown files additionally get semantic linting through three language-aware plugins, all riding on
16
+ [`@eslint/markdown`](https://github.com/eslint/markdown)'s `language: "markdown/commonmark"`:
17
+
18
+ - **`@eslint/markdown`** (`markdown/*`) — heading order, missing alt text, broken link fragments, fenced-code
19
+ language, duplicate definitions, etc. (the official ESLint markdown plugin).
20
+ - **[`eslint-plugin-markdown-links`](https://github.com/ota-meshi/eslint-plugin-markdown-links)** (`markdown-links/*`)
21
+ — checks local file paths in markdown links/images exist on disk, that same-file `#fragment` targets exist, and
22
+ flags self-destination links. The network-based `no-dead-urls` is off by default to keep CI deterministic; flip it
23
+ on locally if you want it.
24
+ - **[`eslint-plugin-markdown-preferences`](https://github.com/ota-meshi/eslint-plugin-markdown-preferences)**
25
+ (`markdown-preferences/*`) — only the 8 rules from this plugin's `recommended` config are on (blockquote alignment,
26
+ hard-linebreak style, no-laziness blockquotes, prefer-autolinks, prefer-fenced-code-blocks, etc.). The other 45 are
27
+ off because they overlap with dprint formatting; flip on individually if a stricter style fits your project.
28
+
29
+ `@eslint/markdown` declares `language: "markdown/commonmark"` for `.md` files, so the AST root becomes an mdast
30
+ `root` node rather than an ESTree `Program`; a small in-repo adapter wraps `dprint/markdown` so it fires on the mdast
31
+ `root` selector and runs in the same pass as the linters. The published rule is `dprint-markdown/markdown` — same
32
+ behavior, same config, just adapted to the markdown language.
33
+
34
+ (Why commonmark and not gfm? `@eslint/markdown@8.0.2`'s `MarkdownSourceCode` does not implement `getLoc()` for
35
+ GFM-specific nodes such as autolinks and table cells; under `language: "markdown/gfm"`, rules like `markdown/no-bare-urls`
36
+ and `markdown/table-column-count` crash ESLint 10's reporter. This is pinned to `commonmark` until upstream ships a
37
+ fix.)
38
+
39
+ Because `language: "markdown/commonmark"` overrides parsing for `.md` files, any later config block that targets all
40
+ files with JS-only rules (e.g. `eslint-plugin-n`) will try to run on `.md` and crash. When layering additional presets,
41
+ scope them to JS/TS files explicitly:
42
+
43
+ ```javascript
44
+ import { baseConfig } from '@enormora/eslint-config-base';
45
+ import { nodeConfig } from '@enormora/eslint-config-node';
46
+
47
+ export default [
48
+ ...baseConfig,
49
+ { ...nodeConfig, files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}' ] }
50
+ ];
51
+ ```
52
+
15
53
  ## Install & Setup
16
54
 
17
55
  Install the `@enormora/eslint-config-base` package via npm:
@@ -24,26 +62,41 @@ Create an ESLint configuration file (e.g., `eslint.config.js`) in your project a
24
62
  configuration array:
25
63
 
26
64
  ```javascript
27
- import { baseConfig } from "@enormora/eslint-config-base";
65
+ import { baseConfig } from '@enormora/eslint-config-base';
28
66
 
29
67
  export default [
30
- {
31
- ignores: ["dist/**/*"],
32
- },
33
- ...baseConfig,
68
+ {
69
+ ignores: [ 'dist/**/*' ]
70
+ },
71
+ ...baseConfig
34
72
  ];
35
73
  ```
36
74
 
37
75
  `baseConfig` is an array of flat config blocks. The first block targets `**/*.{js,mjs,cjs}` and carries the lint rules.
38
- The remaining blocks each enable one dprint formatter scoped to a default file glob:
39
-
40
- | Block | Files | Rule |
41
- | :------------ | :----------------------------------------- | :------------------ |
42
- | JavaScript/TS | `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}` | `dprint/typescript` |
43
- | JSON | `**/*.json` | `dprint/json` |
44
- | Markdown | `**/*.md` | `dprint/markdown` |
45
- | YAML | `**/*.{yml,yaml}` | `dprint/yaml` |
46
- | TOML | `**/*.toml` | `dprint/toml` |
76
+ The remaining blocks each enable one formatter or linter scoped to a default file glob:
77
+
78
+ | Block | Files | Rule(s) |
79
+ | :------------ | :----------------------------------------- | :------------------------------------------------------------------------------------- |
80
+ | JavaScript/TS | `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}` | `dprint/typescript` |
81
+ | JSON | `**/*.json` | `dprint/json` |
82
+ | Markdown | `**/*.md` | `dprint-markdown/markdown`, `markdown/*`, `markdown-links/*`, `markdown-preferences/*` |
83
+ | YAML | `**/*.{yml,yaml}` | `dprint/yaml` |
84
+ | TOML | `**/*.toml` | `dprint/toml` |
85
+
86
+ ### Linting hidden directories
87
+
88
+ ESLint's CLI walker skips dot-directories such as `.github/` when you run `eslint .`. Because the dprint formatter
89
+ blocks above match against file paths, they will silently _not_ run on files inside `.github/` (CI workflows, issue
90
+ templates, dependabot/renovate configs) unless you pass that path to ESLint explicitly. The recommended lint script is
91
+ therefore:
92
+
93
+ ```json
94
+ {
95
+ "scripts": {
96
+ "lint": "eslint . .github"
97
+ }
98
+ }
99
+ ```
47
100
 
48
101
  ### Customizing or disabling a formatter
49
102
 
@@ -54,8 +107,8 @@ Disable a formatter entirely:
54
107
 
55
108
  ```javascript
56
109
  export default [
57
- ...baseConfig,
58
- { files: ["**/*.json"], rules: { "dprint/json": "off" } },
110
+ ...baseConfig,
111
+ { files: [ '**/*.json' ], rules: { 'dprint/json': 'off' } }
59
112
  ];
60
113
  ```
61
114
 
@@ -63,9 +116,9 @@ Scope a formatter to a different path (turn the default off, then re-enable on y
63
116
 
64
117
  ```javascript
65
118
  export default [
66
- ...baseConfig,
67
- { files: ["**/*.json"], rules: { "dprint/json": "off" } },
68
- { files: ["src/**/*.json"], rules: { "dprint/json": "error" } },
119
+ ...baseConfig,
120
+ { files: [ '**/*.json' ], rules: { 'dprint/json': 'off' } },
121
+ { files: [ 'src/**/*.json' ], rules: { 'dprint/json': 'error' } }
69
122
  ];
70
123
  ```
71
124
 
@@ -73,8 +126,30 @@ Ignore specific paths from formatting:
73
126
 
74
127
  ```javascript
75
128
  export default [
76
- ...baseConfig,
77
- { ignores: ["vendor/**/*.json", "fixtures/**/*.md"] },
129
+ ...baseConfig,
130
+ { ignores: [ 'vendor/**/*.json', 'fixtures/**/*.md' ] }
131
+ ];
132
+ ```
133
+
134
+ ### Tweaking markdown lint rules
135
+
136
+ To override any markdown rule (from `@eslint/markdown`, `markdown-links`, or `markdown-preferences`), add a later
137
+ block — the same pattern as for any other ESLint rule:
138
+
139
+ ```javascript
140
+ export default [
141
+ ...baseConfig,
142
+ {
143
+ files: [ '**/*.md' ],
144
+ rules: {
145
+ 'markdown/no-html': 'off',
146
+ 'markdown/fenced-code-language': [ 'error', { required: [ 'js', 'ts' ] } ],
147
+ // Turn the opt-in network-based dead-link check on locally:
148
+ 'markdown-links/no-dead-urls': 'error',
149
+ // Opt into a stricter formatting rule from markdown-preferences:
150
+ 'markdown-preferences/heading-casing': [ 'error', { style: 'Sentence case' } ]
151
+ }
152
+ }
78
153
  ];
79
154
  ```
80
155
 
@@ -84,15 +159,15 @@ To override an individual dprint option (e.g. line width, quote style), add a la
84
159
  with your own `config`:
85
160
 
86
161
  ```javascript
87
- import { baseConfig, typescriptDprintConfig } from "@enormora/eslint-config-base";
162
+ import { baseConfig, typescriptDprintConfig } from '@enormora/eslint-config-base';
88
163
 
89
164
  export default [
90
- ...baseConfig,
91
- {
92
- files: ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}"],
93
- rules: {
94
- "dprint/typescript": ["error", { config: { ...typescriptDprintConfig, lineWidth: 100 } }],
95
- },
96
- },
165
+ ...baseConfig,
166
+ {
167
+ files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
168
+ rules: {
169
+ 'dprint/typescript': [ 'error', { config: { ...typescriptDprintConfig, lineWidth: 100 } } ]
170
+ }
171
+ }
97
172
  ];
98
173
  ```
package/sbom.cdx.json CHANGED
@@ -9,31 +9,31 @@
9
9
  {
10
10
  "type": "application",
11
11
  "name": "packtory",
12
- "version": "0.0.15"
12
+ "version": "0.0.32"
13
13
  }
14
14
  ]
15
15
  },
16
16
  "component": {
17
17
  "type": "library",
18
18
  "name": "@enormora/eslint-config-base",
19
- "version": "0.0.33",
20
- "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.33",
21
- "purl": "pkg:npm/@enormora/eslint-config-base@0.0.33"
19
+ "version": "0.0.35",
20
+ "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.35",
21
+ "purl": "pkg:npm/@enormora/eslint-config-base@0.0.35"
22
22
  }
23
23
  },
24
24
  "components": [
25
25
  {
26
26
  "type": "library",
27
27
  "name": "@ben_12/eslint-plugin-dprint",
28
- "version": "1.19.0",
29
- "bom-ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0",
28
+ "version": "1.21.0",
29
+ "bom-ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0",
30
30
  "scope": "required",
31
31
  "licenses": [
32
32
  {
33
33
  "expression": "MIT"
34
34
  }
35
35
  ],
36
- "purl": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0"
36
+ "purl": "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0"
37
37
  },
38
38
  {
39
39
  "type": "library",
@@ -51,28 +51,93 @@
51
51
  {
52
52
  "type": "library",
53
53
  "name": "@cspell/eslint-plugin",
54
- "version": "10.0.0",
55
- "bom-ref": "pkg:npm/@cspell/eslint-plugin@10.0.0",
54
+ "version": "10.0.1",
55
+ "bom-ref": "pkg:npm/@cspell/eslint-plugin@10.0.1",
56
56
  "scope": "required",
57
57
  "licenses": [
58
58
  {
59
59
  "expression": "MIT"
60
60
  }
61
61
  ],
62
- "purl": "pkg:npm/@cspell/eslint-plugin@10.0.0"
62
+ "purl": "pkg:npm/@cspell/eslint-plugin@10.0.1"
63
+ },
64
+ {
65
+ "type": "library",
66
+ "name": "@dprint/json",
67
+ "version": "0.21.3",
68
+ "bom-ref": "pkg:npm/@dprint/json@0.21.3",
69
+ "scope": "required",
70
+ "licenses": [
71
+ {
72
+ "expression": "MIT"
73
+ }
74
+ ],
75
+ "purl": "pkg:npm/@dprint/json@0.21.3"
76
+ },
77
+ {
78
+ "type": "library",
79
+ "name": "@dprint/markdown",
80
+ "version": "0.22.1",
81
+ "bom-ref": "pkg:npm/@dprint/markdown@0.22.1",
82
+ "scope": "required",
83
+ "licenses": [
84
+ {
85
+ "expression": "MIT"
86
+ }
87
+ ],
88
+ "purl": "pkg:npm/@dprint/markdown@0.22.1"
89
+ },
90
+ {
91
+ "type": "library",
92
+ "name": "@dprint/toml",
93
+ "version": "0.7.0",
94
+ "bom-ref": "pkg:npm/@dprint/toml@0.7.0",
95
+ "scope": "required",
96
+ "licenses": [
97
+ {
98
+ "expression": "MIT"
99
+ }
100
+ ],
101
+ "purl": "pkg:npm/@dprint/toml@0.7.0"
102
+ },
103
+ {
104
+ "type": "library",
105
+ "name": "@dprint/typescript",
106
+ "version": "0.96.1",
107
+ "bom-ref": "pkg:npm/@dprint/typescript@0.96.1",
108
+ "scope": "required",
109
+ "licenses": [
110
+ {
111
+ "expression": "MIT"
112
+ }
113
+ ],
114
+ "purl": "pkg:npm/@dprint/typescript@0.96.1"
63
115
  },
64
116
  {
65
117
  "type": "library",
66
118
  "name": "@eslint-community/eslint-plugin-eslint-comments",
67
- "version": "4.7.1",
68
- "bom-ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1",
119
+ "version": "4.7.2",
120
+ "bom-ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2",
121
+ "scope": "required",
122
+ "licenses": [
123
+ {
124
+ "expression": "MIT"
125
+ }
126
+ ],
127
+ "purl": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2"
128
+ },
129
+ {
130
+ "type": "library",
131
+ "name": "@eslint/markdown",
132
+ "version": "8.0.2",
133
+ "bom-ref": "pkg:npm/@eslint/markdown@8.0.2",
69
134
  "scope": "required",
70
135
  "licenses": [
71
136
  {
72
137
  "expression": "MIT"
73
138
  }
74
139
  ],
75
- "purl": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1"
140
+ "purl": "pkg:npm/@eslint/markdown@8.0.2"
76
141
  },
77
142
  {
78
143
  "type": "library",
@@ -87,6 +152,19 @@
87
152
  ],
88
153
  "purl": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
89
154
  },
155
+ {
156
+ "type": "library",
157
+ "name": "dprint-plugin-yaml",
158
+ "version": "0.6.0",
159
+ "bom-ref": "pkg:npm/dprint-plugin-yaml@0.6.0",
160
+ "scope": "required",
161
+ "licenses": [
162
+ {
163
+ "expression": "MIT"
164
+ }
165
+ ],
166
+ "purl": "pkg:npm/dprint-plugin-yaml@0.6.0"
167
+ },
90
168
  {
91
169
  "type": "library",
92
170
  "name": "eslint-plugin-array-func",
@@ -126,6 +204,32 @@
126
204
  ],
127
205
  "purl": "pkg:npm/eslint-plugin-import-x@4.16.2"
128
206
  },
207
+ {
208
+ "type": "library",
209
+ "name": "eslint-plugin-markdown-links",
210
+ "version": "0.9.0",
211
+ "bom-ref": "pkg:npm/eslint-plugin-markdown-links@0.9.0",
212
+ "scope": "required",
213
+ "licenses": [
214
+ {
215
+ "expression": "MIT"
216
+ }
217
+ ],
218
+ "purl": "pkg:npm/eslint-plugin-markdown-links@0.9.0"
219
+ },
220
+ {
221
+ "type": "library",
222
+ "name": "eslint-plugin-markdown-preferences",
223
+ "version": "0.41.1",
224
+ "bom-ref": "pkg:npm/eslint-plugin-markdown-preferences@0.41.1",
225
+ "scope": "required",
226
+ "licenses": [
227
+ {
228
+ "expression": "MIT"
229
+ }
230
+ ],
231
+ "purl": "pkg:npm/eslint-plugin-markdown-preferences@0.41.1"
232
+ },
129
233
  {
130
234
  "type": "library",
131
235
  "name": "eslint-plugin-no-barrel-files",
@@ -207,25 +311,45 @@
207
311
  ],
208
312
  "dependencies": [
209
313
  {
210
- "ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0"
314
+ "ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0"
211
315
  },
212
316
  {
213
317
  "ref": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0"
214
318
  },
215
319
  {
216
- "ref": "pkg:npm/@cspell/eslint-plugin@10.0.0"
320
+ "ref": "pkg:npm/@cspell/eslint-plugin@10.0.1"
321
+ },
322
+ {
323
+ "ref": "pkg:npm/@dprint/json@0.21.3"
324
+ },
325
+ {
326
+ "ref": "pkg:npm/@dprint/markdown@0.22.1"
327
+ },
328
+ {
329
+ "ref": "pkg:npm/@dprint/toml@0.7.0"
330
+ },
331
+ {
332
+ "ref": "pkg:npm/@dprint/typescript@0.96.1"
217
333
  },
218
334
  {
219
- "ref": "pkg:npm/@enormora/eslint-config-base@0.0.33",
335
+ "ref": "pkg:npm/@enormora/eslint-config-base@0.0.35",
220
336
  "dependsOn": [
221
- "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0",
337
+ "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0",
222
338
  "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
223
- "pkg:npm/@cspell/eslint-plugin@10.0.0",
224
- "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1",
339
+ "pkg:npm/@cspell/eslint-plugin@10.0.1",
340
+ "pkg:npm/@dprint/json@0.21.3",
341
+ "pkg:npm/@dprint/markdown@0.22.1",
342
+ "pkg:npm/@dprint/toml@0.7.0",
343
+ "pkg:npm/@dprint/typescript@0.96.1",
344
+ "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2",
345
+ "pkg:npm/@eslint/markdown@8.0.2",
225
346
  "pkg:npm/@stylistic/eslint-plugin@5.10.0",
347
+ "pkg:npm/dprint-plugin-yaml@0.6.0",
226
348
  "pkg:npm/eslint-plugin-array-func@5.1.1",
227
349
  "pkg:npm/eslint-plugin-destructuring@2.2.1",
228
350
  "pkg:npm/eslint-plugin-import-x@4.16.2",
351
+ "pkg:npm/eslint-plugin-markdown-links@0.9.0",
352
+ "pkg:npm/eslint-plugin-markdown-preferences@0.41.1",
229
353
  "pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
230
354
  "pkg:npm/eslint-plugin-no-secrets@2.3.3",
231
355
  "pkg:npm/eslint-plugin-promise@7.3.0",
@@ -235,11 +359,17 @@
235
359
  ]
236
360
  },
237
361
  {
238
- "ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1"
362
+ "ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2"
363
+ },
364
+ {
365
+ "ref": "pkg:npm/@eslint/markdown@8.0.2"
239
366
  },
240
367
  {
241
368
  "ref": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
242
369
  },
370
+ {
371
+ "ref": "pkg:npm/dprint-plugin-yaml@0.6.0"
372
+ },
243
373
  {
244
374
  "ref": "pkg:npm/eslint-plugin-array-func@5.1.1"
245
375
  },
@@ -249,6 +379,12 @@
249
379
  {
250
380
  "ref": "pkg:npm/eslint-plugin-import-x@4.16.2"
251
381
  },
382
+ {
383
+ "ref": "pkg:npm/eslint-plugin-markdown-links@0.9.0"
384
+ },
385
+ {
386
+ "ref": "pkg:npm/eslint-plugin-markdown-preferences@0.41.1"
387
+ },
252
388
  {
253
389
  "ref": "pkg:npm/eslint-plugin-no-barrel-files@1.3.1"
254
390
  },