@kazupon/eslint-config 0.27.0 → 0.29.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/dist/index.js CHANGED
@@ -7,6 +7,10 @@ import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
7
7
  //#region src/config.ts
8
8
  function defineConfig(...configs) {
9
9
  const baseConfigs = [];
10
+ /**
11
+ * built-in configurations
12
+ * baseConfigs.push(javascript().then(c => c))
13
+ */
10
14
  return new FlatConfigComposer().append(...baseConfigs, ...configs);
11
15
  }
12
16
 
@@ -64,17 +68,26 @@ function getGlobSourceFiles(useTypeScript = false) {
64
68
  //#endregion
65
69
  //#region src/configs/comments.ts
66
70
  async function comments(options = {}) {
67
- const { rules: overrideRules = {} } = options;
68
71
  const comments$1 = await loadPlugin("@eslint-community/eslint-plugin-eslint-comments");
72
+ const kazupon = await loadPlugin("@kazupon/eslint-plugin");
73
+ const directives = options.directives ?? {};
74
+ const kazuponOptions = options.kazupon ?? {};
69
75
  return [{
70
- name: "@eslint-community/eslint-comments/recommended",
71
- ignores: [GLOB_MARKDOWN],
76
+ name: "@eslint-community/eslint-comments",
77
+ ignores: directives.ignores ? [GLOB_MARKDOWN, ...directives.ignores] : [GLOB_MARKDOWN],
72
78
  plugins: { "@eslint-community/eslint-comments": comments$1 },
73
- rules: { ...comments$1.configs.recommended.rules }
74
- }, {
75
- name: "@kazupon/eslint-comments",
76
- rules: { ...overrideRules }
77
- }];
79
+ rules: {
80
+ ...comments$1.configs.recommended.rules,
81
+ ...directives.rules
82
+ }
83
+ }, ...kazupon.configs.comment.map((config) => ({
84
+ ...config,
85
+ ignores: [...config.ignores, ...kazuponOptions.ignores || []],
86
+ rules: {
87
+ ...config.rules,
88
+ ...kazuponOptions.rules
89
+ }
90
+ }))];
78
91
  }
79
92
 
80
93
  //#endregion
@@ -345,6 +358,11 @@ function jsoncSort() {
345
358
  async function markdown(options = {}) {
346
359
  const { rules: overrideRules = {}, files = [GLOB_MARKDOWN], blockExtensions = [] } = options;
347
360
  const language = options.language || "gfm";
361
+ /**
362
+ * TODO: remove this option
363
+ * const fencedCodeBlocks =
364
+ * typeof options.fencedCodeBlocks === 'boolean' ? options.fencedCodeBlocks : true
365
+ */
348
366
  const markdown$1 = await loadPlugin("@eslint/markdown");
349
367
  const recommended = { ...markdown$1.configs["recommended"][0] };
350
368
  const codeblocks = markdown$1.configs.processor[2];
@@ -436,6 +454,14 @@ async function react(options = {}) {
436
454
  files: getGlobSourceFiles(useTypeScript),
437
455
  ...reactRefresh?.configs.recommended
438
456
  });
457
+ /**
458
+ * if (enableA11y) {
459
+ * configs.push({
460
+ * files: getFiles(),
461
+ * ...reactA11y.flatConfigs.recommended
462
+ * })
463
+ * }
464
+ */
439
465
  return [...configs, customConfig];
440
466
  }
441
467
 
@@ -454,6 +480,44 @@ async function regexp(options = {}) {
454
480
  }];
455
481
  }
456
482
 
483
+ //#endregion
484
+ //#region src/configs/stylistic.ts
485
+ async function stylistic(options = {}) {
486
+ const { rules: overrideRules = {}, customize = {
487
+ commaDangle: "never",
488
+ blockSpacing: true,
489
+ quoteProps: "as-needed",
490
+ pluginName: "@stylistic"
491
+ } } = options;
492
+ const stylistic$1 = await loadPlugin("@stylistic/eslint-plugin");
493
+ const config = stylistic$1.configs.customize(customize);
494
+ return [{
495
+ name: "@stylistic/eslint-plugin",
496
+ files: [GLOB_SRC, `${GLOB_MARKDOWN}/${GLOB_SRC}`],
497
+ plugins: { [customize.pluginName]: stylistic$1 },
498
+ rules: {
499
+ ...config.rules,
500
+ "@stylistic/brace-style": "off",
501
+ "@stylistic/arrow-parens": ["error", "as-needed"],
502
+ "@stylistic/lines-around-comment": ["error", {
503
+ beforeBlockComment: true,
504
+ beforeLineComment: true,
505
+ allowBlockStart: true,
506
+ allowObjectStart: true,
507
+ allowArrayStart: true,
508
+ allowClassStart: true,
509
+ allowEnumStart: true,
510
+ allowInterfaceStart: true,
511
+ allowModuleStart: true,
512
+ allowTypeStart: true
513
+ }],
514
+ "@stylistic/spaced-comment": ["error"],
515
+ "@stylistic/multiline-comment-style": ["error", "separate-lines"],
516
+ ...overrideRules
517
+ }
518
+ }];
519
+ }
520
+
457
521
  //#endregion
458
522
  //#region src/configs/svelte.ts
459
523
  async function svelte(options = {}) {
@@ -716,4 +780,4 @@ async function yml(options = {}) {
716
780
  const yaml = yml;
717
781
 
718
782
  //#endregion
719
- export { comments, css, defineConfig, imports, javascript, jsdoc, jsonc, markdown, md, prettier, promise, react, regexp, svelte, toml, typescript, unicorn, vitest, vue, yaml, yml };
783
+ export { comments, css, defineConfig, imports, javascript, jsdoc, jsonc, markdown, md, prettier, promise, react, regexp, stylistic, svelte, toml, typescript, unicorn, vitest, vue, yaml, yml };
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.27.0",
4
+ "version": "0.29.0",
5
5
  "author": {
6
6
  "email": "kawakazu80@gmail.com",
7
7
  "name": "kazuya kawaguchi"
@@ -51,7 +51,9 @@
51
51
  "dependencies": {
52
52
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
53
53
  "@eslint/js": "^9.22.0",
54
+ "@kazupon/eslint-plugin": "^0.2.2",
54
55
  "@kazupon/jts-utils": "^0.6.0",
56
+ "@stylistic/eslint-plugin": "^4.2.0",
55
57
  "eslint-flat-config-utils": "^2.0.1",
56
58
  "eslint-merge-processors": "^2.0.0",
57
59
  "globals": "^16.0.0"