@kazupon/eslint-config 0.33.3 → 0.34.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/README.md +1 -1
- package/dist/index.d.ts +69 -0
- package/dist/index.js +27 -13
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ The following built-in preset configurations are supported:
|
|
|
140
140
|
| `jsonc` | [`eslint-plugin-jsonc`](https://www.npmjs.com/package/eslint-plugin-jsonc) | yes |
|
|
141
141
|
| `yml` | [`eslint-plugin-yml`](https://www.npmjs.com/package/eslint-plugin-yml) | yes |
|
|
142
142
|
| `toml` | [`eslint-plugin-toml`](https://www.npmjs.com/package/eslint-plugin-toml) | yes |
|
|
143
|
-
| `markdown` | [`@eslint/markdown`](https://www.npmjs.com/package/@eslint/markdown)
|
|
143
|
+
| `markdown` | [`@eslint/markdown`](https://www.npmjs.com/package/@eslint/markdown), [`eslint-plugin-markdown-preferences`](https://github.com/ota-meshi/eslint-plugin-markdown-preferences) | yes |
|
|
144
144
|
| `css` | [`@eslint/css`](https://www.npmjs.com/package/@eslint/css) | yes |
|
|
145
145
|
| `html` | [`@html-eslint/eslint-plugin`](https://www.npmjs.com/package/@html-eslint/eslint-plugin) | yes |
|
|
146
146
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5341,6 +5341,31 @@ type JsoncSpaceUnaryOps = [] | [{
|
|
|
5341
5341
|
//#endregion
|
|
5342
5342
|
//#region src/types/gens/markdown.d.ts
|
|
5343
5343
|
interface MarkdownRules {
|
|
5344
|
+
/**
|
|
5345
|
+
* enforce consistent hard linebreak style.
|
|
5346
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/hard-linebreak-style.html
|
|
5347
|
+
*/
|
|
5348
|
+
"markdown-preferences/hard-linebreak-style"?: Linter.RuleEntry<MarkdownPreferencesHardLinebreakStyle>;
|
|
5349
|
+
/**
|
|
5350
|
+
* disallow text backslash at the end of a line.
|
|
5351
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-text-backslash-linebreak.html
|
|
5352
|
+
*/
|
|
5353
|
+
"markdown-preferences/no-text-backslash-linebreak"?: Linter.RuleEntry<[]>;
|
|
5354
|
+
/**
|
|
5355
|
+
* trailing whitespace at the end of lines in Markdown files.
|
|
5356
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-trailing-spaces.html
|
|
5357
|
+
*/
|
|
5358
|
+
"markdown-preferences/no-trailing-spaces"?: Linter.RuleEntry<MarkdownPreferencesNoTrailingSpaces>;
|
|
5359
|
+
/**
|
|
5360
|
+
* enforce the use of inline code for specific words.
|
|
5361
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-inline-code-words.html
|
|
5362
|
+
*/
|
|
5363
|
+
"markdown-preferences/prefer-inline-code-words"?: Linter.RuleEntry<MarkdownPreferencesPreferInlineCodeWords>;
|
|
5364
|
+
/**
|
|
5365
|
+
* enforce the specified word to be a link.
|
|
5366
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-linked-words.html
|
|
5367
|
+
*/
|
|
5368
|
+
"markdown-preferences/prefer-linked-words"?: Linter.RuleEntry<MarkdownPreferencesPreferLinkedWords>;
|
|
5344
5369
|
/**
|
|
5345
5370
|
* Require languages for fenced code blocks
|
|
5346
5371
|
* @see https://github.com/eslint/markdown/blob/main/docs/rules/fenced-code-language.md
|
|
@@ -5433,6 +5458,27 @@ interface MarkdownRules {
|
|
|
5433
5458
|
"markdown/table-column-count"?: Linter.RuleEntry<MarkdownTableColumnCount>;
|
|
5434
5459
|
}
|
|
5435
5460
|
/* ======= Declarations ======= */
|
|
5461
|
+
// ----- markdown-preferences/hard-linebreak-style -----
|
|
5462
|
+
type MarkdownPreferencesHardLinebreakStyle = [] | [{
|
|
5463
|
+
style?: ("backslash" | "spaces");
|
|
5464
|
+
}];
|
|
5465
|
+
// ----- markdown-preferences/no-trailing-spaces -----
|
|
5466
|
+
type MarkdownPreferencesNoTrailingSpaces = [] | [{
|
|
5467
|
+
skipBlankLines?: boolean;
|
|
5468
|
+
ignoreComments?: boolean;
|
|
5469
|
+
}];
|
|
5470
|
+
// ----- markdown-preferences/prefer-inline-code-words -----
|
|
5471
|
+
type MarkdownPreferencesPreferInlineCodeWords = [] | [{
|
|
5472
|
+
words: string[];
|
|
5473
|
+
[k: string]: unknown | undefined;
|
|
5474
|
+
}];
|
|
5475
|
+
// ----- markdown-preferences/prefer-linked-words -----
|
|
5476
|
+
type MarkdownPreferencesPreferLinkedWords = [] | [{
|
|
5477
|
+
words: ({
|
|
5478
|
+
[k: string]: (string | null);
|
|
5479
|
+
} | string[]);
|
|
5480
|
+
[k: string]: unknown | undefined;
|
|
5481
|
+
}];
|
|
5436
5482
|
// ----- markdown/fenced-code-language -----
|
|
5437
5483
|
type MarkdownFencedCodeLanguage = [] | [{
|
|
5438
5484
|
required?: string[];
|
|
@@ -15903,6 +15949,29 @@ interface MarkdownOptions {
|
|
|
15903
15949
|
* enable block extensions
|
|
15904
15950
|
*/
|
|
15905
15951
|
blockExtensions?: string[];
|
|
15952
|
+
/**
|
|
15953
|
+
* enable preferences
|
|
15954
|
+
*
|
|
15955
|
+
* @see https://github.com/ota-meshi/eslint-plugin-markdown-preferences
|
|
15956
|
+
* @default true
|
|
15957
|
+
*/
|
|
15958
|
+
preferences?: boolean;
|
|
15959
|
+
/**
|
|
15960
|
+
* detect inline code words for back-quoted in markdown (`words` option of `markdown-preferences/prefer-inline-code-words`)
|
|
15961
|
+
*
|
|
15962
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-inline-code-words.html#%F0%9F%94%A7-options
|
|
15963
|
+
* @default []
|
|
15964
|
+
*/
|
|
15965
|
+
inlineCodeWords?: string[];
|
|
15966
|
+
/**
|
|
15967
|
+
* detect linked words for linked in markdown (`words` option of `markdown-preferences/prefer-linked-words`)
|
|
15968
|
+
*
|
|
15969
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-linked-words.html#%F0%9F%94%A7-options
|
|
15970
|
+
* @default []
|
|
15971
|
+
*/
|
|
15972
|
+
linkedWords?: {
|
|
15973
|
+
[k: string]: string | null;
|
|
15974
|
+
} | string[];
|
|
15906
15975
|
}
|
|
15907
15976
|
// export const parserPlain: Linter.Parser = {
|
|
15908
15977
|
// meta: {
|
package/dist/index.js
CHANGED
|
@@ -555,7 +555,7 @@ function jsoncSort() {
|
|
|
555
555
|
* @returns {Promise<Linter.Config[]>} eslint flat configurations with `@eslint/markdown` and overrides
|
|
556
556
|
*/
|
|
557
557
|
async function markdown(options = {}) {
|
|
558
|
-
const { rules: overrideRules = {}, files = [GLOB_MARKDOWN], blockExtensions = [] } = options;
|
|
558
|
+
const { rules: overrideRules = {}, files = [GLOB_MARKDOWN], blockExtensions = [], preferences = true, inlineCodeWords = [], linkedWords = [] } = options;
|
|
559
559
|
const language = options.language || "gfm";
|
|
560
560
|
/**
|
|
561
561
|
* TODO: remove this option
|
|
@@ -566,7 +566,7 @@ async function markdown(options = {}) {
|
|
|
566
566
|
const recommended = { ...markdown$1.configs["recommended"][0] };
|
|
567
567
|
const codeblocks = markdown$1.configs.processor[2];
|
|
568
568
|
recommended.language = `markdown/${language}`;
|
|
569
|
-
|
|
569
|
+
const configs = [
|
|
570
570
|
recommended,
|
|
571
571
|
{
|
|
572
572
|
name: "markdown/makedown-in-markdown",
|
|
@@ -578,20 +578,34 @@ async function markdown(options = {}) {
|
|
|
578
578
|
name: "makrdown/ignore-lint-blocks-in-typescript",
|
|
579
579
|
files: ["**/*.md/**"],
|
|
580
580
|
languageOptions: { parserOptions: { project: null } }
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
581
|
+
}
|
|
582
|
+
];
|
|
583
|
+
if (preferences) {
|
|
584
|
+
const preferencesPlugin = await loadPlugin("eslint-plugin-markdown-preferences");
|
|
585
|
+
configs.push({
|
|
586
|
+
...preferencesPlugin.configs.recommended,
|
|
586
587
|
rules: {
|
|
587
|
-
...
|
|
588
|
-
"
|
|
589
|
-
"
|
|
590
|
-
"
|
|
591
|
-
...overrideRules
|
|
588
|
+
...preferencesPlugin.configs.recommended.rules,
|
|
589
|
+
"markdown-preferences/no-trailing-spaces": "error",
|
|
590
|
+
"markdown-preferences/prefer-linked-words": ["error", { words: linkedWords }],
|
|
591
|
+
"markdown-preferences/prefer-inline-code-words": ["error", { words: inlineCodeWords }]
|
|
592
592
|
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
const custom = {
|
|
596
|
+
name: "@kazupon/markdown",
|
|
597
|
+
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, ...blockExtensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)],
|
|
598
|
+
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
599
|
+
rules: {
|
|
600
|
+
...codeblocks.rules,
|
|
601
|
+
"import/no-unresolved": "off",
|
|
602
|
+
"unused-imports/no-unused-vars": "off",
|
|
603
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
604
|
+
...overrideRules
|
|
593
605
|
}
|
|
594
|
-
|
|
606
|
+
};
|
|
607
|
+
configs.push(custom);
|
|
608
|
+
return configs;
|
|
595
609
|
}
|
|
596
610
|
const md = markdown;
|
|
597
611
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kazupon/eslint-config",
|
|
3
3
|
"description": "ESLint config for @kazupon",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.34.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "kawakazu80@gmail.com",
|
|
7
7
|
"name": "kazuya kawaguchi"
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"eslint-plugin-import": ">=2.31.0",
|
|
71
71
|
"eslint-plugin-jsdoc": ">=51.0.0",
|
|
72
72
|
"eslint-plugin-jsonc": ">=2.16.0",
|
|
73
|
+
"eslint-plugin-markdown-preferences": ">=0.4.0",
|
|
73
74
|
"eslint-plugin-module-interop": ">=0.3.0",
|
|
74
75
|
"eslint-plugin-promise": ">=6.4.0",
|
|
75
76
|
"eslint-plugin-react": ">=7.35.0",
|
|
@@ -119,6 +120,9 @@
|
|
|
119
120
|
"eslint-plugin-jsonc": {
|
|
120
121
|
"optional": true
|
|
121
122
|
},
|
|
123
|
+
"eslint-plugin-markdown-preferences": {
|
|
124
|
+
"optional": true
|
|
125
|
+
},
|
|
122
126
|
"eslint-plugin-module-interop": {
|
|
123
127
|
"optional": true
|
|
124
128
|
},
|
|
@@ -188,6 +192,7 @@
|
|
|
188
192
|
"eslint-plugin-import": "^2.32.0",
|
|
189
193
|
"eslint-plugin-jsdoc": "^52.0.0",
|
|
190
194
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
195
|
+
"eslint-plugin-markdown-preferences": "^0.4.0",
|
|
191
196
|
"eslint-plugin-module-interop": "^0.3.1",
|
|
192
197
|
"eslint-plugin-promise": "^7.2.1",
|
|
193
198
|
"eslint-plugin-react": "^7.37.5",
|