@enormora/eslint-config-base-with-prettier 0.0.3 → 0.0.4

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,12 +4,16 @@
4
4
  "Christian Rackerseder <github@echooff.de>"
5
5
  ],
6
6
  "dependencies": {
7
+ "@ben_12/eslint-simple-parser": "0.1.0",
7
8
  "@cspell/eslint-plugin": "10.0.1",
8
9
  "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
10
+ "@eslint/markdown": "8.0.2",
9
11
  "@stylistic/eslint-plugin": "5.10.0",
10
12
  "eslint-plugin-array-func": "5.1.1",
11
13
  "eslint-plugin-destructuring": "2.2.1",
12
14
  "eslint-plugin-import-x": "4.16.2",
15
+ "eslint-plugin-markdown-links": "0.9.0",
16
+ "eslint-plugin-markdown-preferences": "0.41.1",
13
17
  "eslint-plugin-no-barrel-files": "1.3.1",
14
18
  "eslint-plugin-no-secrets": "2.3.3",
15
19
  "eslint-plugin-prettier": "5.5.6",
@@ -39,5 +43,5 @@
39
43
  "./rule-sets/restricted-syntax.js"
40
44
  ],
41
45
  "type": "module",
42
- "version": "0.0.3"
46
+ "version": "0.0.4"
43
47
  }
@@ -0,0 +1 @@
1
+ import { cspellSpellcheckerOptions } from './base-shared.js';
@@ -0,0 +1,98 @@
1
+ import markdownPlugin from '@eslint/markdown';
2
+ import markdownLinksPlugin from 'eslint-plugin-markdown-links';
3
+ import markdownPreferencesPlugin from 'eslint-plugin-markdown-preferences';
4
+
5
+ export const markdownLintPlugins = {
6
+ markdown: markdownPlugin,
7
+ 'markdown-links': markdownLinksPlugin,
8
+ 'markdown-preferences': markdownPreferencesPlugin
9
+ };
10
+
11
+ export const markdownLintRules = {
12
+ 'markdown/fenced-code-language': 'error',
13
+ 'markdown/fenced-code-meta': 'off',
14
+ 'markdown/heading-increment': 'error',
15
+ 'markdown/no-bare-urls': 'error',
16
+ 'markdown/no-duplicate-definitions': 'error',
17
+ 'markdown/no-duplicate-headings': 'error',
18
+ 'markdown/no-empty-definitions': 'error',
19
+ 'markdown/no-empty-images': 'error',
20
+ 'markdown/no-empty-links': 'error',
21
+ 'markdown/no-html': 'error',
22
+ 'markdown/no-invalid-label-refs': 'error',
23
+ 'markdown/no-missing-atx-heading-space': 'error',
24
+ 'markdown/no-missing-label-refs': 'error',
25
+ 'markdown/no-missing-link-fragments': 'error',
26
+ 'markdown/no-multiple-h1': 'error',
27
+ 'markdown/no-reference-like-urls': 'error',
28
+ 'markdown/no-reversed-media-syntax': 'error',
29
+ 'markdown/no-space-in-emphasis': 'error',
30
+ 'markdown/no-unused-definitions': 'error',
31
+ 'markdown/require-alt-text': 'error',
32
+ 'markdown/table-column-count': 'error',
33
+
34
+ // markdown-links: external network check is opt-in to keep CI deterministic;
35
+ // local-path and fragment checks are pure wins.
36
+ 'markdown-links/no-dead-urls': 'off',
37
+ 'markdown-links/no-missing-fragments': 'error',
38
+ 'markdown-links/no-missing-path': 'error',
39
+ 'markdown-links/no-self-destination': 'error',
40
+
41
+ // markdown-preferences: many rules overlap with the active markdown formatter (dprint or
42
+ // prettier, depending on which base preset is used). We enable only the 8 rules from this
43
+ // plugin's `recommended` config (none of which fight either formatter) and explicitly turn
44
+ // the other 45 off. Override individually if a stricter style is desired.
45
+ 'markdown-preferences/atx-heading-closing-sequence': 'off',
46
+ 'markdown-preferences/atx-heading-closing-sequence-length': 'off',
47
+ 'markdown-preferences/blockquote-marker-alignment': 'error',
48
+ 'markdown-preferences/bullet-list-marker-style': 'off',
49
+ 'markdown-preferences/canonical-code-block-language': 'off',
50
+ 'markdown-preferences/code-fence-length': 'off',
51
+ 'markdown-preferences/code-fence-spacing': 'off',
52
+ 'markdown-preferences/code-fence-style': 'off',
53
+ 'markdown-preferences/custom-container-marker-spacing': 'off',
54
+ 'markdown-preferences/definitions-last': 'off',
55
+ 'markdown-preferences/emoji-notation': 'off',
56
+ 'markdown-preferences/emphasis-delimiters-style': 'off',
57
+ 'markdown-preferences/hard-linebreak-style': 'error',
58
+ 'markdown-preferences/heading-casing': 'off',
59
+ 'markdown-preferences/indent': 'off',
60
+ 'markdown-preferences/level1-heading-style': 'off',
61
+ 'markdown-preferences/level2-heading-style': 'off',
62
+ 'markdown-preferences/link-bracket-newline': 'off',
63
+ 'markdown-preferences/link-bracket-spacing': 'off',
64
+ 'markdown-preferences/link-destination-style': 'off',
65
+ 'markdown-preferences/link-paren-newline': 'off',
66
+ 'markdown-preferences/link-paren-spacing': 'off',
67
+ 'markdown-preferences/link-title-style': 'off',
68
+ 'markdown-preferences/list-marker-alignment': 'error',
69
+ 'markdown-preferences/max-len': 'off',
70
+ 'markdown-preferences/no-heading-trailing-punctuation': 'off',
71
+ 'markdown-preferences/no-implicit-block-closing': 'error',
72
+ 'markdown-preferences/no-laziness-blockquotes': 'error',
73
+ 'markdown-preferences/no-multi-spaces': 'off',
74
+ 'markdown-preferences/no-multiple-empty-lines': 'off',
75
+ 'markdown-preferences/no-tabs': 'off',
76
+ 'markdown-preferences/no-text-backslash-linebreak': 'error',
77
+ 'markdown-preferences/no-trailing-spaces': 'off',
78
+ 'markdown-preferences/ordered-list-marker-sequence': 'off',
79
+ 'markdown-preferences/ordered-list-marker-start': 'off',
80
+ 'markdown-preferences/ordered-list-marker-style': 'off',
81
+ 'markdown-preferences/padded-custom-containers': 'off',
82
+ 'markdown-preferences/padding-line-between-blocks': 'off',
83
+ 'markdown-preferences/prefer-autolinks': 'error',
84
+ 'markdown-preferences/prefer-fenced-code-blocks': 'error',
85
+ 'markdown-preferences/prefer-inline-code-words': 'off',
86
+ 'markdown-preferences/prefer-link-reference-definitions': 'off',
87
+ 'markdown-preferences/prefer-linked-words': 'off',
88
+ 'markdown-preferences/setext-heading-underline-length': 'off',
89
+ 'markdown-preferences/sort-definitions': 'off',
90
+ 'markdown-preferences/strikethrough-delimiters-style': 'off',
91
+ 'markdown-preferences/table-header-casing': 'off',
92
+ 'markdown-preferences/table-leading-trailing-pipes': 'off',
93
+ 'markdown-preferences/table-pipe-alignment': 'off',
94
+ 'markdown-preferences/table-pipe-spacing': 'off',
95
+ 'markdown-preferences/thematic-break-character-style': 'off',
96
+ 'markdown-preferences/thematic-break-length': 'off',
97
+ 'markdown-preferences/thematic-break-sequence-pattern': 'off'
98
+ };
@@ -1,7 +1,10 @@
1
+ import simpleParser from '@ben_12/eslint-simple-parser';
1
2
  import prettierPlugin from 'eslint-plugin-prettier';
2
3
  import { baseSharedConfig } from '../base/base-shared.js';
4
+ import { markdownLintPlugins, markdownLintRules } from '../base/markdown-lint-rules.js';
3
5
 
4
- export const baseWithPrettierConfig = {
6
+ const baseJsConfig = {
7
+ files: [ '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}' ],
5
8
  ...baseSharedConfig,
6
9
  plugins: {
7
10
  ...baseSharedConfig.plugins,
@@ -10,6 +13,49 @@ export const baseWithPrettierConfig = {
10
13
  rules: {
11
14
  ...baseSharedConfig.rules,
12
15
 
13
- 'prettier/prettier': 'error'
16
+ 'prettier/prettier': 'error',
17
+
18
+ // Prettier owns TypeScript member delimiter formatting; the stylistic rule would only fight it.
19
+ '@stylistic/member-delimiter-style': 'off'
14
20
  }
15
21
  };
22
+
23
+ const prettierJsonConfig = {
24
+ files: [ '**/*.json' ],
25
+ languageOptions: { parser: simpleParser },
26
+ plugins: { prettier: prettierPlugin },
27
+ rules: { 'prettier/prettier': 'error' }
28
+ };
29
+
30
+ const prettierYamlConfig = {
31
+ files: [ '**/*.{yml,yaml}' ],
32
+ languageOptions: { parser: simpleParser },
33
+ plugins: { prettier: prettierPlugin },
34
+ rules: { 'prettier/prettier': 'error' }
35
+ };
36
+
37
+ const markdownConfig = {
38
+ files: [ '**/*.md' ],
39
+ plugins: {
40
+ ...markdownLintPlugins,
41
+ prettier: prettierPlugin
42
+ },
43
+ // See ../base/markdown.js for why this is pinned to commonmark instead of gfm.
44
+ language: 'markdown/commonmark',
45
+ rules: {
46
+ 'prettier/prettier': 'error',
47
+
48
+ ...markdownLintRules
49
+ }
50
+ };
51
+
52
+ export const baseWithPrettierConfig = [
53
+ baseJsConfig,
54
+ prettierJsonConfig,
55
+ markdownConfig,
56
+ prettierYamlConfig
57
+ ];
58
+
59
+ /* eslint-disable no-barrel-files/no-barrel-files -- expose cspell helper as public API so consumers can spread or call it when customizing */
60
+ export { withCspellWords } from '../base/cspell-config.js';
61
+ /* eslint-enable no-barrel-files/no-barrel-files -- end of public re-exports */
package/readme.md CHANGED
@@ -6,7 +6,10 @@ Drop-in alternative to [`@enormora/eslint-config-base`](../base/base.md) that fo
6
6
  [prettier](https://prettier.io/) instead of dprint.
7
7
 
8
8
  This preset is itself a base preset — pick this one **or** `@enormora/eslint-config-base`, never both. It contains the
9
- same set of lint rules as the regular base preset; the only difference is the formatter integration.
9
+ same set of lint rules as the regular base preset, including the semantic markdown linting stack
10
+ (`@eslint/markdown`, `eslint-plugin-markdown-links`, `eslint-plugin-markdown-preferences`). The only differences are
11
+ the formatter integration and that TOML is not covered (prettier has no native TOML support; see
12
+ [Limitations](#limitations) below).
10
13
 
11
14
  ## Install & Setup
12
15
 
@@ -29,8 +32,8 @@ export default {
29
32
  };
30
33
  ```
31
34
 
32
- Create an ESLint configuration file (e.g., `eslint.config.js`) in your project and add the preset to the configuration
33
- array:
35
+ Create an ESLint configuration file (e.g., `eslint.config.js`) in your project and spread the preset into the
36
+ configuration array:
34
37
 
35
38
  ```javascript
36
39
  import { baseWithPrettierConfig } from '@enormora/eslint-config-base-with-prettier';
@@ -39,6 +42,80 @@ export default [
39
42
  {
40
43
  ignores: [ 'dist/**/*' ]
41
44
  },
42
- baseWithPrettierConfig
45
+ ...baseWithPrettierConfig
43
46
  ];
44
47
  ```
48
+
49
+ `baseWithPrettierConfig` is an array of flat config blocks. The first block targets the JS/TS/Vue file set and carries
50
+ the lint rules; the remaining blocks each scope `prettier/prettier` to one file family, with the markdown block
51
+ additionally enabling the semantic markdown linters.
52
+
53
+ | Block | Files | Rule(s) |
54
+ | :------------ | :----------------------------------------- | :------------------------------------------------------------------------------ |
55
+ | JavaScript/TS | `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}` | base lint rules + `prettier/prettier` |
56
+ | JSON | `**/*.json` | `prettier/prettier` |
57
+ | Markdown | `**/*.md` | `prettier/prettier`, `markdown/*`, `markdown-links/*`, `markdown-preferences/*` |
58
+ | YAML | `**/*.{yml,yaml}` | `prettier/prettier` |
59
+
60
+ ### Linting hidden directories
61
+
62
+ ESLint's CLI walker skips dot-directories such as `.github/` when you run `eslint .`. Because the formatter blocks
63
+ above match against file paths, they will silently _not_ run on files inside `.github/` unless you pass that path to
64
+ ESLint explicitly. The recommended lint script is therefore:
65
+
66
+ ```json
67
+ {
68
+ "scripts": {
69
+ "lint": "eslint . .github"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ### Customizing or disabling the formatter on a file family
75
+
76
+ Because the blocks are plain flat config, override them the same way as any other ESLint config — add a later block
77
+ whose `files` glob overlaps the one you want to change. Later blocks win.
78
+
79
+ Disable prettier formatting for JSON entirely:
80
+
81
+ ```javascript
82
+ export default [
83
+ ...baseWithPrettierConfig,
84
+ { files: [ '**/*.json' ], rules: { 'prettier/prettier': 'off' } }
85
+ ];
86
+ ```
87
+
88
+ Ignore specific paths from formatting:
89
+
90
+ ```javascript
91
+ export default [
92
+ ...baseWithPrettierConfig,
93
+ { ignores: [ 'vendor/**/*.json', 'fixtures/**/*.md' ] }
94
+ ];
95
+ ```
96
+
97
+ ### Tweaking markdown lint rules
98
+
99
+ To override any markdown rule (from `@eslint/markdown`, `markdown-links`, or `markdown-preferences`), add a later
100
+ block — the same pattern as for any other ESLint rule:
101
+
102
+ ```javascript
103
+ export default [
104
+ ...baseWithPrettierConfig,
105
+ {
106
+ files: [ '**/*.md' ],
107
+ rules: {
108
+ 'markdown/no-html': 'off',
109
+ 'markdown/fenced-code-language': [ 'error', { required: [ 'js', 'ts' ] } ],
110
+ 'markdown-links/no-dead-urls': 'error',
111
+ 'markdown-preferences/heading-casing': [ 'error', { style: 'Sentence case' } ]
112
+ }
113
+ }
114
+ ];
115
+ ```
116
+
117
+ ## Limitations
118
+
119
+ - **No TOML coverage.** Prettier does not natively format `.toml` files. If you need TOML formatting, either use
120
+ [`@enormora/eslint-config-base`](../base/base.md) (which formats TOML via dprint) or wire your own prettier plugin
121
+ for TOML.
package/sbom.cdx.json CHANGED
@@ -16,12 +16,25 @@
16
16
  "component": {
17
17
  "type": "library",
18
18
  "name": "@enormora/eslint-config-base-with-prettier",
19
- "version": "0.0.3",
20
- "bom-ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.3",
21
- "purl": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.3"
19
+ "version": "0.0.4",
20
+ "bom-ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.4",
21
+ "purl": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.4"
22
22
  }
23
23
  },
24
24
  "components": [
25
+ {
26
+ "type": "library",
27
+ "name": "@ben_12/eslint-simple-parser",
28
+ "version": "0.1.0",
29
+ "bom-ref": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
30
+ "scope": "required",
31
+ "licenses": [
32
+ {
33
+ "expression": "MIT"
34
+ }
35
+ ],
36
+ "purl": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0"
37
+ },
25
38
  {
26
39
  "type": "library",
27
40
  "name": "@cspell/eslint-plugin",
@@ -48,6 +61,19 @@
48
61
  ],
49
62
  "purl": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2"
50
63
  },
64
+ {
65
+ "type": "library",
66
+ "name": "@eslint/markdown",
67
+ "version": "8.0.2",
68
+ "bom-ref": "pkg:npm/@eslint/markdown@8.0.2",
69
+ "scope": "required",
70
+ "licenses": [
71
+ {
72
+ "expression": "MIT"
73
+ }
74
+ ],
75
+ "purl": "pkg:npm/@eslint/markdown@8.0.2"
76
+ },
51
77
  {
52
78
  "type": "library",
53
79
  "name": "@stylistic/eslint-plugin",
@@ -100,6 +126,32 @@
100
126
  ],
101
127
  "purl": "pkg:npm/eslint-plugin-import-x@4.16.2"
102
128
  },
129
+ {
130
+ "type": "library",
131
+ "name": "eslint-plugin-markdown-links",
132
+ "version": "0.9.0",
133
+ "bom-ref": "pkg:npm/eslint-plugin-markdown-links@0.9.0",
134
+ "scope": "required",
135
+ "licenses": [
136
+ {
137
+ "expression": "MIT"
138
+ }
139
+ ],
140
+ "purl": "pkg:npm/eslint-plugin-markdown-links@0.9.0"
141
+ },
142
+ {
143
+ "type": "library",
144
+ "name": "eslint-plugin-markdown-preferences",
145
+ "version": "0.41.1",
146
+ "bom-ref": "pkg:npm/eslint-plugin-markdown-preferences@0.41.1",
147
+ "scope": "required",
148
+ "licenses": [
149
+ {
150
+ "expression": "MIT"
151
+ }
152
+ ],
153
+ "purl": "pkg:npm/eslint-plugin-markdown-preferences@0.41.1"
154
+ },
103
155
  {
104
156
  "type": "library",
105
157
  "name": "eslint-plugin-no-barrel-files",
@@ -193,18 +245,25 @@
193
245
  }
194
246
  ],
195
247
  "dependencies": [
248
+ {
249
+ "ref": "pkg:npm/@ben_12/eslint-simple-parser@0.1.0"
250
+ },
196
251
  {
197
252
  "ref": "pkg:npm/@cspell/eslint-plugin@10.0.1"
198
253
  },
199
254
  {
200
- "ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.3",
255
+ "ref": "pkg:npm/@enormora/eslint-config-base-with-prettier@0.0.4",
201
256
  "dependsOn": [
257
+ "pkg:npm/@ben_12/eslint-simple-parser@0.1.0",
202
258
  "pkg:npm/@cspell/eslint-plugin@10.0.1",
203
259
  "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2",
260
+ "pkg:npm/@eslint/markdown@8.0.2",
204
261
  "pkg:npm/@stylistic/eslint-plugin@5.10.0",
205
262
  "pkg:npm/eslint-plugin-array-func@5.1.1",
206
263
  "pkg:npm/eslint-plugin-destructuring@2.2.1",
207
264
  "pkg:npm/eslint-plugin-import-x@4.16.2",
265
+ "pkg:npm/eslint-plugin-markdown-links@0.9.0",
266
+ "pkg:npm/eslint-plugin-markdown-preferences@0.41.1",
208
267
  "pkg:npm/eslint-plugin-no-barrel-files@1.3.1",
209
268
  "pkg:npm/eslint-plugin-no-secrets@2.3.3",
210
269
  "pkg:npm/eslint-plugin-prettier@5.5.6",
@@ -217,6 +276,9 @@
217
276
  {
218
277
  "ref": "pkg:npm/@eslint-community/eslint-plugin-eslint-comments@4.7.2"
219
278
  },
279
+ {
280
+ "ref": "pkg:npm/@eslint/markdown@8.0.2"
281
+ },
220
282
  {
221
283
  "ref": "pkg:npm/@stylistic/eslint-plugin@5.10.0"
222
284
  },
@@ -229,6 +291,12 @@
229
291
  {
230
292
  "ref": "pkg:npm/eslint-plugin-import-x@4.16.2"
231
293
  },
294
+ {
295
+ "ref": "pkg:npm/eslint-plugin-markdown-links@0.9.0"
296
+ },
297
+ {
298
+ "ref": "pkg:npm/eslint-plugin-markdown-preferences@0.41.1"
299
+ },
232
300
  {
233
301
  "ref": "pkg:npm/eslint-plugin-no-barrel-files@1.3.1"
234
302
  },