@kazupon/eslint-config 0.2.0 → 0.3.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
@@ -8,8 +8,9 @@ ESLint config for @kazupon
8
8
  ## 🌟 Features
9
9
 
10
10
  - Flat configuration via `defineConfig` like [vite](https://vitejs.dev/config/)
11
- - Support built-in configurations
11
+ - Support [built-in configurations](#built-in-configurations)
12
12
  - `javascript`
13
+ - `comments`
13
14
  - `typescript`
14
15
  - `prettier`
15
16
  - `vue`
@@ -82,7 +83,7 @@ Add the following settings to your `.vscode/settings.json`:
82
83
  // Enable eslint for supported languages
83
84
  "eslint.validate": ["javascript", "typescript", "vue"],
84
85
  // Enable flat configuration
85
- "eslint.experimental.useFlatConfig": true
86
+ "eslint.useFlatConfig": true
86
87
  }
87
88
  ```
88
89
 
@@ -90,12 +91,13 @@ Add the following settings to your `.vscode/settings.json`:
90
91
 
91
92
  The following built-in configurations are supported:
92
93
 
93
- | Configuration | Powered by eslint plugin or package | Need to install eslint plugin or package? |
94
- | ------------- | -------------------------------------------------------------------------------- | ----------------------------------------- |
95
- | `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
96
- | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
97
- | `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
98
- | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
94
+ | Configuration | Powered by eslint plugin or package | Need to install eslint plugin or package? |
95
+ | ------------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------- |
96
+ | `javascript` | [`@eslint/js`](https://www.npmjs.com/package/@eslint/js) | no (built-in) |
97
+ | `comments` | [`eslint-plugin-eslint-comments`](https://www.npmjs.com/package/eslint-plugin-eslint-comments) | no (built-in) |
98
+ | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
99
+ | `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
100
+ | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
99
101
 
100
102
  You can use `import` syntax:
101
103
 
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface CommentsOptions {}
4
+ export declare function comments(options?: ((CommentsOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface CommentsOptions {}
4
+ export declare function comments(options?: ((CommentsOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
@@ -1,4 +1,5 @@
1
1
  export * from './javascript';
2
+ export * from './comments';
2
3
  export * from './typescript';
3
4
  export * from './prettier';
4
5
  export * from './vue';
@@ -1,4 +1,5 @@
1
1
  export * from './javascript';
2
+ export * from './comments';
2
3
  export * from './typescript';
3
4
  export * from './prettier';
4
5
  export * from './vue';
package/dist/index.cjs CHANGED
@@ -7,12 +7,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all) __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- };
16
10
  var __copyProps = (to, from, except, desc) => {
17
11
  if (from && typeof from === 'object' || typeof from === 'function') for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
12
  key = keys[i];
@@ -27,7 +21,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
21
  value: mod,
28
22
  enumerable: true
29
23
  }) : target, mod));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, '__esModule', {value: true}), mod);
31
24
 
32
25
  //#endregion
33
26
  const { FlatConfigComposer } = __toESM(require("eslint-flat-config-utils"));
@@ -43,7 +36,7 @@ function defineConfig(...configs) {
43
36
  //#region src/utils.ts
44
37
  async function interopDefault(mod) {
45
38
  const resolved = await mod;
46
- return resolved.default || resolved;
39
+ return (resolved).default || resolved;
47
40
  }
48
41
  async function loadPlugin(name) {
49
42
  try {
@@ -61,7 +54,7 @@ async function javascript(options = {}) {
61
54
  const js = await loadPlugin('@eslint/js');
62
55
  return [{
63
56
  name: 'eslint/defaults/rules',
64
- ...js.configs.recommended
57
+ ...(js.configs.recommended)
65
58
  }, {
66
59
  name: '@kazupon/javascript/@eslint/js',
67
60
  languageOptions: {
@@ -86,6 +79,21 @@ async function javascript(options = {}) {
86
79
  }];
87
80
  }
88
81
 
82
+ //#endregion
83
+ //#region src/configs/comments.ts
84
+ async function comments(options = {}) {
85
+ const { rules: overrideRules = {} } = options;
86
+ const comments$1 = await loadPlugin('eslint-plugin-eslint-comments');
87
+ return [{
88
+ name: 'eslint-comments/recommended',
89
+ plugins: {'eslint-comments': comments$1},
90
+ rules: {...(comments$1.configs.recommended.rules)}
91
+ }, {
92
+ name: '@kazupon/eslint-comments',
93
+ rules: {...overrideRules}
94
+ }];
95
+ }
96
+
89
97
  //#endregion
90
98
  //#region src/globs.ts
91
99
  const GLOB_JS = '**/*.?([cm])js';
@@ -100,9 +108,9 @@ async function typescript(options = {}) {
100
108
  const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = {project: true} } = options;
101
109
  const ts = await loadPlugin('typescript-eslint');
102
110
  const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
103
- return [...ts.configs.recommendedTypeChecked, {
111
+ return [...(ts.configs.recommendedTypeChecked), {
104
112
  files: [GLOB_JS, GLOB_JSX],
105
- ...ts.configs.disableTypeChecked
113
+ ...(ts.configs.disableTypeChecked)
106
114
  }, {
107
115
  name: '@kazupon/typescipt/typescript-eslint',
108
116
  files,
@@ -168,19 +176,14 @@ async function vue(options = {}) {
168
176
  }
169
177
  };
170
178
  }
171
- return [...vue$1.configs['flat/recommended'], customConfig];
179
+ return [...(vue$1.configs['flat/recommended']), customConfig];
172
180
  }
173
181
 
174
182
  //#endregion
175
- //#region src/index.ts
176
- var src_index_ns = {};
177
- __export(src_index_ns, {
178
- defineConfig: () => defineConfig,
179
- javascript: () => javascript,
180
- prettier: () => prettier,
181
- typescript: () => typescript,
182
- vue: () => vue
183
- });
184
-
185
- //#endregion
186
- module.exports = __toCommonJS(src_index_ns)
183
+ Object.defineProperty(exports, '__esModule', { value: true });
184
+ exports.comments = comments;
185
+ exports.defineConfig = defineConfig;
186
+ exports.javascript = javascript;
187
+ exports.prettier = prettier;
188
+ exports.typescript = typescript;
189
+ exports.vue = vue;
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ function defineConfig(...configs) {
11
11
  //#region src/utils.ts
12
12
  async function interopDefault(mod) {
13
13
  const resolved = await mod;
14
- return resolved.default || resolved;
14
+ return (resolved).default || resolved;
15
15
  }
16
16
  async function loadPlugin(name) {
17
17
  try {
@@ -29,7 +29,7 @@ async function javascript(options = {}) {
29
29
  const js = await loadPlugin('@eslint/js');
30
30
  return [{
31
31
  name: 'eslint/defaults/rules',
32
- ...js.configs.recommended
32
+ ...(js.configs.recommended)
33
33
  }, {
34
34
  name: '@kazupon/javascript/@eslint/js',
35
35
  languageOptions: {
@@ -54,6 +54,21 @@ async function javascript(options = {}) {
54
54
  }];
55
55
  }
56
56
 
57
+ //#endregion
58
+ //#region src/configs/comments.ts
59
+ async function comments(options = {}) {
60
+ const { rules: overrideRules = {} } = options;
61
+ const comments$1 = await loadPlugin('eslint-plugin-eslint-comments');
62
+ return [{
63
+ name: 'eslint-comments/recommended',
64
+ plugins: {'eslint-comments': comments$1},
65
+ rules: {...(comments$1.configs.recommended.rules)}
66
+ }, {
67
+ name: '@kazupon/eslint-comments',
68
+ rules: {...overrideRules}
69
+ }];
70
+ }
71
+
57
72
  //#endregion
58
73
  //#region src/globs.ts
59
74
  const GLOB_JS = '**/*.?([cm])js';
@@ -68,9 +83,9 @@ async function typescript(options = {}) {
68
83
  const { rules: overrideRules = {}, extraFileExtensions = [], parserOptions = {project: true} } = options;
69
84
  const ts = await loadPlugin('typescript-eslint');
70
85
  const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
71
- return [...ts.configs.recommendedTypeChecked, {
86
+ return [...(ts.configs.recommendedTypeChecked), {
72
87
  files: [GLOB_JS, GLOB_JSX],
73
- ...ts.configs.disableTypeChecked
88
+ ...(ts.configs.disableTypeChecked)
74
89
  }, {
75
90
  name: '@kazupon/typescipt/typescript-eslint',
76
91
  files,
@@ -136,8 +151,8 @@ async function vue(options = {}) {
136
151
  }
137
152
  };
138
153
  }
139
- return [...vue$1.configs['flat/recommended'], customConfig];
154
+ return [...(vue$1.configs['flat/recommended']), customConfig];
140
155
  }
141
156
 
142
157
  //#endregion
143
- export { defineConfig, javascript, prettier, typescript, vue };
158
+ export { comments, defineConfig, javascript, prettier, typescript, vue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-config",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "ESLint config for @kazupon",
5
5
  "keywords": [
6
6
  "config",
@@ -38,6 +38,7 @@
38
38
  "dependencies": {
39
39
  "@eslint/js": "^9.0.0",
40
40
  "eslint-flat-config-utils": "^0.2.5",
41
+ "eslint-plugin-eslint-comments": "^3.2.0",
41
42
  "globals": "^15.8.0"
42
43
  },
43
44
  "peerDependencies": {