@kazupon/eslint-config 0.28.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/README.md CHANGED
@@ -125,7 +125,7 @@ The following built-in preset configurations are supported:
125
125
  | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------- |
126
126
  | `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
127
127
  | `stylistic` | [`@stylistic/eslint-plugin`](https://www.npmjs.com/package/@stylistic/eslint-plugin) | no (built-in) |
128
- | `comments` | [`@eslint-community/eslint-plugin-eslint-comments`](https://www.npmjs.com/package/@eslint-community/eslint-plugin-eslint-comments) | no (built-in) |
128
+ | `comments` | [`@eslint-community/eslint-plugin-eslint-comments`](https://www.npmjs.com/package/@eslint-community/eslint-plugin-eslint-comments), [`@kazupon/eslint-plugin`(comment config)](https://www.npmjs.com/package/@kazupon/eslint-plugin) | no (built-in) |
129
129
  | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
130
130
  | `imports` | [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import), [`eslint-plugin-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports), [`eslint-plugin-module-interop`](https://www.npmjs.com/package/eslint-plugin-module-interop) | yes |
131
131
  | `jsdoc` | [`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc) | yes |
package/dist/index.d.ts CHANGED
@@ -3,6 +3,11 @@ import { Awaitable } from '@kazupon/jts-utils/types';
3
3
  import { Linter, ESLint } from 'eslint';
4
4
  import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
5
5
 
6
+ /**
7
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
8
+ * @license MIT
9
+ */
10
+
6
11
  /**
7
12
  * define eslint configurations
8
13
  * @param {Awaitable<Linter.Config | Linter.Config[]>[]} configs eslint flat configurations
@@ -10,6 +15,11 @@ import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
10
15
  */
11
16
  declare function defineConfig(...configs: Awaitable<Linter.Config | Linter.Config[]>[]): FlatConfigComposer;
12
17
 
18
+ /**
19
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
20
+ * @license MIT
21
+ */
22
+
13
23
  interface OverridesOptions<Rules = Linter.Config['rules']> {
14
24
  files?: Linter.Config['files'];
15
25
  ignores?: Linter.Config['ignores'];
@@ -64,6 +74,11 @@ interface CommentsRules {
64
74
  * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html
65
75
  */
66
76
  '@eslint-community/eslint-comments/require-description'?: Linter.RuleEntry<EslintCommunityEslintCommentsRequireDescription>;
77
+ /**
78
+ * Enforce heading the comment in source code file
79
+ * @see https://eslint-plugin.kazupon.dev/rules/enforce-header-comment
80
+ */
81
+ '@kazupon/enforce-header-comment'?: Linter.RuleEntry<[]>;
67
82
  }
68
83
  type EslintCommunityEslintCommentsDisableEnablePair = [] | [
69
84
  {
@@ -15780,18 +15795,35 @@ declare module 'eslint' {
15780
15795
  }
15781
15796
 
15782
15797
  /**
15783
- * eslint comments configuration options
15798
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15799
+ * @license MIT
15800
+ */
15801
+
15802
+ /**
15803
+ * comments preset options
15784
15804
  */
15785
15805
  interface CommentsOptions {
15806
+ /**
15807
+ * An options for `@eslint-community/eslint-plugin-eslint-comments`
15808
+ */
15809
+ directives?: OverridesOptions<CommentsRules>;
15810
+ /**
15811
+ * An options for `@kazupon/eslint-plugin` comment config
15812
+ */
15813
+ kazupon?: OverridesOptions<CommentsRules>;
15786
15814
  }
15787
15815
  /**
15788
- * `@eslint-community/eslint-plugin-eslint-comments` and overrides configuration options
15789
- * @param {CommentsOptions & OverridesOptions} options
15790
- * eslint comments configuration options for eslint comment directives
15791
- * @returns {Promise<Linter.Config[]>}
15792
- * eslint flat configurations with `@eslint-community/eslint-plugin-eslint-comments` and overrides
15816
+ * configure comments preset for the below plugins
15817
+ * - `@eslint-community/eslint-plugin-eslint-comments`
15818
+ * @param {CommentsOptions} options {@link CommentsOptions | comments preset options}
15819
+ * @returns {Promise<Linter.Config[]>} resolved eslint flat configurations
15820
+ */
15821
+ declare function comments(options?: CommentsOptions): Promise<Linter.Config[]>;
15822
+
15823
+ /**
15824
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15825
+ * @license MIT
15793
15826
  */
15794
- declare function comments(options?: CommentsOptions & OverridesOptions<CommentsRules>): Promise<Linter.Config[]>;
15795
15827
 
15796
15828
  /**
15797
15829
  * eslint css configuration options
@@ -15823,6 +15855,11 @@ interface CssOptions {
15823
15855
  */
15824
15856
  declare function css(options?: CssOptions & OverridesOptions<CssRules>): Promise<Linter.Config[]>;
15825
15857
 
15858
+ /**
15859
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15860
+ * @license MIT
15861
+ */
15862
+
15826
15863
  /**
15827
15864
  * imports configuration options
15828
15865
  */
@@ -15848,6 +15885,11 @@ interface ImportsOptions {
15848
15885
  */
15849
15886
  declare function imports(options?: ImportsOptions & OverridesOptions<ImportsRules>): Promise<Linter.Config[]>;
15850
15887
 
15888
+ /**
15889
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15890
+ * @license MIT
15891
+ */
15892
+
15851
15893
  /**
15852
15894
  * JavaScript configuration options
15853
15895
  */
@@ -15860,6 +15902,11 @@ interface JavaScriptOptions {
15860
15902
  */
15861
15903
  declare function javascript(options?: JavaScriptOptions & OverridesOptions<JavascriptRules>): Promise<Linter.Config[]>;
15862
15904
 
15905
+ /**
15906
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15907
+ * @license MIT
15908
+ */
15909
+
15863
15910
  /**
15864
15911
  * jsdoc configuration options
15865
15912
  */
@@ -15886,6 +15933,11 @@ interface JsDocumentOptions {
15886
15933
  */
15887
15934
  declare function jsdoc(options?: JsDocumentOptions & OverridesOptions<JsdocRules>): Promise<Linter.Config[]>;
15888
15935
 
15936
+ /**
15937
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15938
+ * @license MIT
15939
+ */
15940
+
15889
15941
  /**
15890
15942
  * eslint jsonc configuration options
15891
15943
  */
@@ -15924,6 +15976,11 @@ interface JsoncOptions {
15924
15976
  */
15925
15977
  declare function jsonc(options?: JsoncOptions & OverridesOptions<JsoncRules>): Promise<Linter.Config[]>;
15926
15978
 
15979
+ /**
15980
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
15981
+ * @license MIT
15982
+ */
15983
+
15927
15984
  /**
15928
15985
  * eslint unicorn configuration options
15929
15986
  */
@@ -15955,6 +16012,11 @@ interface MarkdownOptions {
15955
16012
  declare function markdown(options?: MarkdownOptions & OverridesOptions): Promise<Linter.Config[]>;
15956
16013
  declare const md: typeof markdown;
15957
16014
 
16015
+ /**
16016
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16017
+ * @license MIT
16018
+ */
16019
+
15958
16020
  /**
15959
16021
  * Prettier configuration options
15960
16022
  */
@@ -15969,6 +16031,11 @@ interface PrettierOptions {
15969
16031
  */
15970
16032
  declare function prettier(options?: PrettierOptions & OverridesOptions<PrettierRules>): Promise<Linter.Config[]>;
15971
16033
 
16034
+ /**
16035
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16036
+ * @license MIT
16037
+ */
16038
+
15972
16039
  /**
15973
16040
  * eslint promise configuration options
15974
16041
  */
@@ -16041,6 +16108,11 @@ interface TypeScriptProjectServiceOptions {
16041
16108
  */
16042
16109
  declare function typescript(options?: TypeScriptOptions & OverridesOptions<TypescriptRules>): Promise<Linter.Config[]>;
16043
16110
 
16111
+ /**
16112
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16113
+ * @license MIT
16114
+ */
16115
+
16044
16116
  /**
16045
16117
  * eslint react configuration options
16046
16118
  */
@@ -16065,6 +16137,11 @@ interface ReactOptions {
16065
16137
  */
16066
16138
  declare function react(options?: ReactOptions & TypeScriptOptions & OverridesOptions<ReactRules>): Promise<Linter.Config[]>;
16067
16139
 
16140
+ /**
16141
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16142
+ * @license MIT
16143
+ */
16144
+
16068
16145
  /**
16069
16146
  * eslint regexp configuration options
16070
16147
  */
@@ -16079,6 +16156,11 @@ interface RegexpOptions {
16079
16156
  */
16080
16157
  declare function regexp(options?: RegexpOptions & OverridesOptions<RegexpRules>): Promise<Linter.Config[]>;
16081
16158
 
16159
+ /**
16160
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16161
+ * @license MIT
16162
+ */
16163
+
16082
16164
  /**
16083
16165
  * stylistic eslint plugin configuration options
16084
16166
  */
@@ -16098,6 +16180,11 @@ interface StylisticOptions {
16098
16180
  */
16099
16181
  declare function stylistic(options?: StylisticOptions & OverridesOptions<StylisticRules>): Promise<Linter.Config[]>;
16100
16182
 
16183
+ /**
16184
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16185
+ * @license MIT
16186
+ */
16187
+
16101
16188
  /**
16102
16189
  * Svelte configuration options
16103
16190
  */
@@ -16117,6 +16204,11 @@ interface SvelteScriptOptions {
16117
16204
  */
16118
16205
  declare function svelte(options?: SvelteScriptOptions & TypeScriptOptions & OverridesOptions<SvelteRules>): Promise<Linter.Config[]>;
16119
16206
 
16207
+ /**
16208
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16209
+ * @license MIT
16210
+ */
16211
+
16120
16212
  /**
16121
16213
  * eslint toml configuration options
16122
16214
  */
@@ -16131,6 +16223,11 @@ interface TomlOptions {
16131
16223
  */
16132
16224
  declare function toml(options?: TomlOptions & OverridesOptions<TomlRules>): Promise<Linter.Config[]>;
16133
16225
 
16226
+ /**
16227
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16228
+ * @license MIT
16229
+ */
16230
+
16134
16231
  /**
16135
16232
  * eslint unicorn configuration options
16136
16233
  */
@@ -16150,6 +16247,11 @@ interface UnicornOptions {
16150
16247
  */
16151
16248
  declare function unicorn(options?: UnicornOptions & OverridesOptions<UnicornRules>): Promise<Linter.Config[]>;
16152
16249
 
16250
+ /**
16251
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16252
+ * @license MIT
16253
+ */
16254
+
16153
16255
  /**
16154
16256
  * eslint vitest configuration options
16155
16257
  */
@@ -16171,6 +16273,11 @@ interface VitestOptions {
16171
16273
  */
16172
16274
  declare function vitest(options?: VitestOptions & OverridesOptions<VitestRules>): Promise<Linter.Config[]>;
16173
16275
 
16276
+ /**
16277
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16278
+ * @license MIT
16279
+ */
16280
+
16174
16281
  /**
16175
16282
  * Vue configuration options
16176
16283
  */
@@ -16219,6 +16326,11 @@ interface VueI18nOptions {
16219
16326
  */
16220
16327
  declare function vue(options?: VueScriptOptions & TypeScriptOptions & OverridesOptions<VueRules>): Promise<Linter.Config[]>;
16221
16328
 
16329
+ /**
16330
+ * @author kazuya kawaguchi (a.k.a. @kazupon)
16331
+ * @license MIT
16332
+ */
16333
+
16222
16334
  /**
16223
16335
  * eslint yml configuration options
16224
16336
  */
package/dist/index.js CHANGED
@@ -68,17 +68,26 @@ function getGlobSourceFiles(useTypeScript = false) {
68
68
  //#endregion
69
69
  //#region src/configs/comments.ts
70
70
  async function comments(options = {}) {
71
- const { rules: overrideRules = {} } = options;
72
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 ?? {};
73
75
  return [{
74
- name: "@eslint-community/eslint-comments/recommended",
75
- ignores: [GLOB_MARKDOWN],
76
+ name: "@eslint-community/eslint-comments",
77
+ ignores: directives.ignores ? [GLOB_MARKDOWN, ...directives.ignores] : [GLOB_MARKDOWN],
76
78
  plugins: { "@eslint-community/eslint-comments": comments$1 },
77
- rules: { ...comments$1.configs.recommended.rules }
78
- }, {
79
- name: "@kazupon/eslint-comments",
80
- rules: { ...overrideRules }
81
- }];
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
+ }))];
82
91
  }
83
92
 
84
93
  //#endregion
@@ -503,11 +512,9 @@ async function stylistic(options = {}) {
503
512
  allowTypeStart: true
504
513
  }],
505
514
  "@stylistic/spaced-comment": ["error"],
506
- "@stylistic/multiline-comment-style": ["error", "separate-lines"]
515
+ "@stylistic/multiline-comment-style": ["error", "separate-lines"],
516
+ ...overrideRules
507
517
  }
508
- }, {
509
- name: "@kazupon/@stylistic/overrides",
510
- rules: { ...overrideRules }
511
518
  }];
512
519
  }
513
520
 
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.28.0",
4
+ "version": "0.29.0",
5
5
  "author": {
6
6
  "email": "kawakazu80@gmail.com",
7
7
  "name": "kazuya kawaguchi"
@@ -51,6 +51,7 @@
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",
55
56
  "@stylistic/eslint-plugin": "^4.2.0",
56
57
  "eslint-flat-config-utils": "^2.0.1",