@kazupon/eslint-config 0.4.0 → 0.5.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
@@ -13,6 +13,7 @@ ESLint config for @kazupon
13
13
  - `comments`
14
14
  - `typescript`
15
15
  - `jsdoc`
16
+ - `regexp`
16
17
  - `prettier`
17
18
  - `vue`
18
19
  - Support primitive eslint flat configuration
@@ -98,6 +99,7 @@ The following built-in configurations are supported:
98
99
  | `comments` | [`eslint-plugin-eslint-comments`](https://www.npmjs.com/package/eslint-plugin-eslint-comments) | no (built-in) |
99
100
  | `typescript` | [`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint) | yes |
100
101
  | `jsdoc` | [`eslint-plugin-jsdoc`](https://www.npmjs.com/package/eslint-plugin-jsdoc) | yes |
102
+ | `regexp` | [`eslint-plugin-regexp`](https://www.npmjs.com/package/eslint-plugin-regexp) | yes |
101
103
  | `prettier` | [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier) | yes |
102
104
  | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
103
105
 
@@ -2,5 +2,6 @@ export * from './javascript';
2
2
  export * from './comments';
3
3
  export * from './typescript';
4
4
  export * from './jsdoc';
5
+ export * from './regexp';
5
6
  export * from './prettier';
6
7
  export * from './vue';
@@ -2,5 +2,6 @@ export * from './javascript';
2
2
  export * from './comments';
3
3
  export * from './typescript';
4
4
  export * from './jsdoc';
5
+ export * from './regexp';
5
6
  export * from './prettier';
6
7
  export * from './vue';
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface RegexpOptions {}
4
+ export declare function regexp(options?: ((RegexpOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions } from '../types';
3
+ export interface RegexpOptions {}
4
+ export declare function regexp(options?: ((RegexpOptions) & (OverridesOptions))): Promise<(Linter.FlatConfig)[]>;
package/dist/index.cjs CHANGED
@@ -39,12 +39,11 @@ async function interopDefault(mod) {
39
39
  return (resolved).default || resolved;
40
40
  }
41
41
  async function loadPlugin(name) {
42
- try {
43
- return interopDefault(import(name));
44
- } catch (e) {
45
- console.error(e);
42
+ const mod = await import(name).catch((err) => {
43
+ console.error(err);
46
44
  throw new Error(`Failed to load eslint plugin '${name}'. Please install it!`);
47
- }
45
+ });
46
+ return interopDefault(mod);
48
47
  }
49
48
 
50
49
  //#endregion
@@ -160,6 +159,20 @@ async function jsdoc(options = {}) {
160
159
  }];
161
160
  }
162
161
 
162
+ //#endregion
163
+ //#region src/configs/regexp.ts
164
+ async function regexp(options = {}) {
165
+ const { rules: overrideRules = {} } = options;
166
+ const regexp$1 = await loadPlugin('eslint-plugin-regexp');
167
+ return [{
168
+ name: 'regexp/flat/recommended',
169
+ ...(regexp$1.configs['flat/recommended'])
170
+ }, {
171
+ name: '@kazupon/eslint-regexp',
172
+ rules: {...overrideRules}
173
+ }];
174
+ }
175
+
163
176
  //#endregion
164
177
  //#region src/configs/prettier.ts
165
178
  async function prettier(options = {}) {
@@ -209,5 +222,6 @@ exports.defineConfig = defineConfig;
209
222
  exports.javascript = javascript;
210
223
  exports.jsdoc = jsdoc;
211
224
  exports.prettier = prettier;
225
+ exports.regexp = regexp;
212
226
  exports.typescript = typescript;
213
227
  exports.vue = vue;
package/dist/index.js CHANGED
@@ -14,12 +14,11 @@ async function interopDefault(mod) {
14
14
  return (resolved).default || resolved;
15
15
  }
16
16
  async function loadPlugin(name) {
17
- try {
18
- return interopDefault(import(name));
19
- } catch (e) {
20
- console.error(e);
17
+ const mod = await import(name).catch((err) => {
18
+ console.error(err);
21
19
  throw new Error(`Failed to load eslint plugin '${name}'. Please install it!`);
22
- }
20
+ });
21
+ return interopDefault(mod);
23
22
  }
24
23
 
25
24
  //#endregion
@@ -135,6 +134,20 @@ async function jsdoc(options = {}) {
135
134
  }];
136
135
  }
137
136
 
137
+ //#endregion
138
+ //#region src/configs/regexp.ts
139
+ async function regexp(options = {}) {
140
+ const { rules: overrideRules = {} } = options;
141
+ const regexp$1 = await loadPlugin('eslint-plugin-regexp');
142
+ return [{
143
+ name: 'regexp/flat/recommended',
144
+ ...(regexp$1.configs['flat/recommended'])
145
+ }, {
146
+ name: '@kazupon/eslint-regexp',
147
+ rules: {...overrideRules}
148
+ }];
149
+ }
150
+
138
151
  //#endregion
139
152
  //#region src/configs/prettier.ts
140
153
  async function prettier(options = {}) {
@@ -178,4 +191,4 @@ async function vue(options = {}) {
178
191
  }
179
192
 
180
193
  //#endregion
181
- export { comments, defineConfig, javascript, jsdoc, prettier, typescript, vue };
194
+ export { comments, defineConfig, javascript, jsdoc, prettier, regexp, typescript, vue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-config",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "ESLint config for @kazupon",
5
5
  "keywords": [
6
6
  "config",
@@ -45,6 +45,7 @@
45
45
  "eslint": ">=8.56.0 || >=9.0.0",
46
46
  "eslint-config-prettier": ">=9.1.0",
47
47
  "eslint-plugin-jsdoc": ">=48.5.0",
48
+ "eslint-plugin-regexp": ">=2.6.0",
48
49
  "eslint-plugin-vue": ">=9.24.0",
49
50
  "typescript-eslint": ">=7.0.0"
50
51
  },
@@ -58,6 +59,9 @@
58
59
  "eslint-plugin-jsdoc": {
59
60
  "optional": true
60
61
  },
62
+ "eslint-plugin-regexp": {
63
+ "optional": true
64
+ },
61
65
  "eslint-plugin-vue": {
62
66
  "optional": true
63
67
  }
@@ -70,6 +74,7 @@
70
74
  "eslint": "^9.6.0",
71
75
  "eslint-config-prettier": "^9.1.0",
72
76
  "eslint-plugin-jsdoc": "^48.5.2",
77
+ "eslint-plugin-regexp": "^2.6.0",
73
78
  "eslint-plugin-vue": "^9.27.0",
74
79
  "gh-changelogen": "^0.2.8",
75
80
  "lint-staged": "^15.2.7",
@@ -78,7 +83,8 @@
78
83
  "tsdown": "^0.2.3",
79
84
  "tsx": "^4.16.2",
80
85
  "typescript": "^5.5.3",
81
- "typescript-eslint": "^7.15.0"
86
+ "typescript-eslint": "^7.15.0",
87
+ "vitest": "^2.0.0"
82
88
  },
83
89
  "lint-staged": {
84
90
  "*.{json,md,yml}": [
@@ -104,6 +110,7 @@
104
110
  "fix:prettier": "prettier . --write",
105
111
  "fix:eslint": "eslint . --fix",
106
112
  "dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
113
+ "test": "vitest",
107
114
  "build": "tsdown",
108
115
  "build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
109
116
  "typecheck": "tsc -p ."