@enormora/eslint-config-base 0.0.34 → 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,18 +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",
9
+ "@cspell/eslint-plugin": "10.0.1",
10
10
  "@dprint/json": "0.21.3",
11
- "@dprint/markdown": "0.22.0",
11
+ "@dprint/markdown": "0.22.1",
12
12
  "@dprint/toml": "0.7.0",
13
- "@dprint/typescript": "0.96.0",
14
- "@eslint-community/eslint-plugin-eslint-comments": "4.7.1",
13
+ "@dprint/typescript": "0.96.1",
14
+ "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
15
+ "@eslint/markdown": "8.0.2",
15
16
  "@stylistic/eslint-plugin": "5.10.0",
17
+ "dprint-plugin-yaml": "0.6.0",
16
18
  "eslint-plugin-array-func": "5.1.1",
17
19
  "eslint-plugin-destructuring": "2.2.1",
18
20
  "eslint-plugin-import-x": "4.16.2",
21
+ "eslint-plugin-markdown-links": "0.9.0",
22
+ "eslint-plugin-markdown-preferences": "0.41.1",
19
23
  "eslint-plugin-no-barrel-files": "1.3.1",
20
24
  "eslint-plugin-no-secrets": "2.3.3",
21
25
  "eslint-plugin-promise": "7.3.0",
@@ -52,9 +56,11 @@
52
56
  "sideEffects": [
53
57
  "./presets/base/base-shared.js",
54
58
  "./presets/base/base.js",
59
+ "./presets/base/dprint-formatters.js",
60
+ "./presets/base/markdown.js",
55
61
  "./rule-sets/best-practices.js",
56
62
  "./rule-sets/restricted-syntax.js"
57
63
  ],
58
64
  "type": "module",
59
- "version": "0.0.34"
65
+ "version": "0.0.35"
60
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,19 +1,9 @@
1
- /* eslint-disable import/no-unassigned-import -- side-effect imports surface the dprint formatter packages to Packtory's static dependency scanner so they end up as runtime dependencies of the published package */
2
- import '@dprint/json';
3
- import '@dprint/markdown';
4
- import '@dprint/toml';
5
- import '@dprint/typescript';
6
- /* eslint-enable import/no-unassigned-import -- end of Packtory-visibility imports */
7
1
  import dprintPlugin from '@ben_12/eslint-plugin-dprint';
8
2
  import simpleParser from '@ben_12/eslint-simple-parser';
9
3
  import { baseSharedConfig } from './base-shared.js';
10
- import {
11
- jsonDprintConfig,
12
- markdownDprintConfig,
13
- tomlDprintConfig,
14
- typescriptDprintConfig,
15
- yamlDprintConfig
16
- } 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';
17
7
 
18
8
  const baseJsConfig = {
19
9
  files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
@@ -22,6 +12,7 @@ const baseJsConfig = {
22
12
  ...baseSharedConfig.plugins,
23
13
  dprint: dprintPlugin
24
14
  },
15
+ settings: { ...baseSharedConfig.settings, ...dprintSettings },
25
16
  rules: {
26
17
  ...baseSharedConfig.rules,
27
18
 
@@ -43,20 +34,15 @@ const dprintJsonConfig = {
43
34
  files: [ '**/*.json' ],
44
35
  languageOptions: { parser: simpleParser },
45
36
  plugins: { dprint: dprintPlugin },
37
+ settings: dprintSettings,
46
38
  rules: { 'dprint/json': [ 'error', { config: jsonDprintConfig } ] }
47
39
  };
48
40
 
49
- const dprintMarkdownConfig = {
50
- files: [ '**/*.md' ],
51
- languageOptions: { parser: simpleParser },
52
- plugins: { dprint: dprintPlugin },
53
- rules: { 'dprint/markdown': [ 'error', { config: markdownDprintConfig } ] }
54
- };
55
-
56
41
  const dprintYamlConfig = {
57
42
  files: [ '**/*.{yml,yaml}' ],
58
43
  languageOptions: { parser: simpleParser },
59
44
  plugins: { dprint: dprintPlugin },
45
+ settings: dprintSettings,
60
46
  rules: { 'dprint/yaml': [ 'error', { config: yamlDprintConfig } ] }
61
47
  };
62
48
 
@@ -64,18 +50,19 @@ const dprintTomlConfig = {
64
50
  files: [ '**/*.toml' ],
65
51
  languageOptions: { parser: simpleParser },
66
52
  plugins: { dprint: dprintPlugin },
53
+ settings: dprintSettings,
67
54
  rules: { 'dprint/toml': [ 'error', { config: tomlDprintConfig } ] }
68
55
  };
69
56
 
70
57
  export const baseConfig = [
71
58
  baseJsConfig,
72
59
  dprintJsonConfig,
73
- dprintMarkdownConfig,
60
+ markdownConfig,
74
61
  dprintYamlConfig,
75
62
  dprintTomlConfig
76
63
  ];
77
64
 
78
- /* 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 */
79
66
  export {
80
67
  jsonDprintConfig,
81
68
  markdownDprintConfig,
@@ -83,4 +70,5 @@ export {
83
70
  typescriptDprintConfig,
84
71
  yamlDprintConfig
85
72
  } from './dprint-config.js';
73
+ export { withCspellWords } from './cspell-config.js';
86
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.34",
20
- "bom-ref": "pkg:npm/@enormora/eslint-config-base@0.0.34",
21
- "purl": "pkg:npm/@enormora/eslint-config-base@0.0.34"
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,15 +51,15 @@
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
63
  },
64
64
  {
65
65
  "type": "library",
@@ -77,15 +77,15 @@
77
77
  {
78
78
  "type": "library",
79
79
  "name": "@dprint/markdown",
80
- "version": "0.22.0",
81
- "bom-ref": "pkg:npm/@dprint/markdown@0.22.0",
80
+ "version": "0.22.1",
81
+ "bom-ref": "pkg:npm/@dprint/markdown@0.22.1",
82
82
  "scope": "required",
83
83
  "licenses": [
84
84
  {
85
85
  "expression": "MIT"
86
86
  }
87
87
  ],
88
- "purl": "pkg:npm/@dprint/markdown@0.22.0"
88
+ "purl": "pkg:npm/@dprint/markdown@0.22.1"
89
89
  },
90
90
  {
91
91
  "type": "library",
@@ -103,28 +103,41 @@
103
103
  {
104
104
  "type": "library",
105
105
  "name": "@dprint/typescript",
106
- "version": "0.96.0",
107
- "bom-ref": "pkg:npm/@dprint/typescript@0.96.0",
106
+ "version": "0.96.1",
107
+ "bom-ref": "pkg:npm/@dprint/typescript@0.96.1",
108
108
  "scope": "required",
109
109
  "licenses": [
110
110
  {
111
111
  "expression": "MIT"
112
112
  }
113
113
  ],
114
- "purl": "pkg:npm/@dprint/typescript@0.96.0"
114
+ "purl": "pkg:npm/@dprint/typescript@0.96.1"
115
115
  },
116
116
  {
117
117
  "type": "library",
118
118
  "name": "@eslint-community/eslint-plugin-eslint-comments",
119
- "version": "4.7.1",
120
- "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
121
  "scope": "required",
122
122
  "licenses": [
123
123
  {
124
124
  "expression": "MIT"
125
125
  }
126
126
  ],
127
- "purl": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1"
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",
134
+ "scope": "required",
135
+ "licenses": [
136
+ {
137
+ "expression": "MIT"
138
+ }
139
+ ],
140
+ "purl": "pkg:npm/@eslint/markdown@8.0.2"
128
141
  },
129
142
  {
130
143
  "type": "library",
@@ -139,6 +152,19 @@
139
152
  ],
140
153
  "purl": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
141
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
+ },
142
168
  {
143
169
  "type": "library",
144
170
  "name": "eslint-plugin-array-func",
@@ -178,6 +204,32 @@
178
204
  ],
179
205
  "purl": "pkg:npm/eslint-plugin-import-x@4.16.2"
180
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
+ },
181
233
  {
182
234
  "type": "library",
183
235
  "name": "eslint-plugin-no-barrel-files",
@@ -259,41 +311,45 @@
259
311
  ],
260
312
  "dependencies": [
261
313
  {
262
- "ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0"
314
+ "ref": "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0"
263
315
  },
264
316
  {
265
317
  "ref": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0"
266
318
  },
267
319
  {
268
- "ref": "pkg:npm/@cspell/eslint-plugin@10.0.0"
320
+ "ref": "pkg:npm/@cspell/eslint-plugin@10.0.1"
269
321
  },
270
322
  {
271
323
  "ref": "pkg:npm/@dprint/json@0.21.3"
272
324
  },
273
325
  {
274
- "ref": "pkg:npm/@dprint/markdown@0.22.0"
326
+ "ref": "pkg:npm/@dprint/markdown@0.22.1"
275
327
  },
276
328
  {
277
329
  "ref": "pkg:npm/@dprint/toml@0.7.0"
278
330
  },
279
331
  {
280
- "ref": "pkg:npm/@dprint/typescript@0.96.0"
332
+ "ref": "pkg:npm/@dprint/typescript@0.96.1"
281
333
  },
282
334
  {
283
- "ref": "pkg:npm/@enormora/eslint-config-base@0.0.34",
335
+ "ref": "pkg:npm/@enormora/eslint-config-base@0.0.35",
284
336
  "dependsOn": [
285
- "pkg:npm/@ben_12/eslint-plugin-dprint@1.19.0",
337
+ "pkg:npm/@ben_12/eslint-plugin-dprint@1.21.0",
286
338
  "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
287
- "pkg:npm/@cspell/eslint-plugin@10.0.0",
339
+ "pkg:npm/@cspell/eslint-plugin@10.0.1",
288
340
  "pkg:npm/@dprint/json@0.21.3",
289
- "pkg:npm/@dprint/markdown@0.22.0",
341
+ "pkg:npm/@dprint/markdown@0.22.1",
290
342
  "pkg:npm/@dprint/toml@0.7.0",
291
- "pkg:npm/@dprint/typescript@0.96.0",
292
- "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.1",
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",
293
346
  "pkg:npm/@stylistic/eslint-plugin@5.10.0",
347
+ "pkg:npm/dprint-plugin-yaml@0.6.0",
294
348
  "pkg:npm/eslint-plugin-array-func@5.1.1",
295
349
  "pkg:npm/eslint-plugin-destructuring@2.2.1",
296
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",
297
353
  "pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
298
354
  "pkg:npm/eslint-plugin-no-secrets@2.3.3",
299
355
  "pkg:npm/eslint-plugin-promise@7.3.0",
@@ -303,11 +359,17 @@
303
359
  ]
304
360
  },
305
361
  {
306
- "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"
307
366
  },
308
367
  {
309
368
  "ref": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
310
369
  },
370
+ {
371
+ "ref": "pkg:npm/dprint-plugin-yaml@0.6.0"
372
+ },
311
373
  {
312
374
  "ref": "pkg:npm/eslint-plugin-array-func@5.1.1"
313
375
  },
@@ -317,6 +379,12 @@
317
379
  {
318
380
  "ref": "pkg:npm/eslint-plugin-import-x@4.16.2"
319
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
+ },
320
388
  {
321
389
  "ref": "pkg:npm/eslint-plugin-no-barrel-files@1.3.1"
322
390
  },