@kurateh/eslint-plugin 1.2.0 → 2.0.0-beta.1

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
@@ -1,31 +1,29 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('eslint-plugin-react');
4
- var reactHook = require('eslint-plugin-react-hooks');
4
+ var reactHooks = require('eslint-plugin-react-hooks');
5
5
  var globals = require('globals');
6
+ var js = require('@eslint/js');
6
7
  var importPlugin = require('eslint-plugin-import');
8
+ var eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
9
+ var unusedImportsPlugin = require('eslint-plugin-unused-imports');
7
10
  var tseslint = require('typescript-eslint');
8
11
  var fs = require('fs');
9
12
  var path = require('path');
10
13
  var utils = require('@typescript-eslint/utils');
11
- var js = require('@eslint/js');
12
- var eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
13
- var unusedImportsPlugin = require('eslint-plugin-unused-imports');
14
14
 
15
15
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
16
 
17
17
  var react__default = /*#__PURE__*/_interopDefault(react);
18
- var reactHook__default = /*#__PURE__*/_interopDefault(reactHook);
18
+ var reactHooks__default = /*#__PURE__*/_interopDefault(reactHooks);
19
19
  var globals__default = /*#__PURE__*/_interopDefault(globals);
20
- var importPlugin__default = /*#__PURE__*/_interopDefault(importPlugin);
21
- var tseslint__default = /*#__PURE__*/_interopDefault(tseslint);
22
20
  var js__default = /*#__PURE__*/_interopDefault(js);
21
+ var importPlugin__default = /*#__PURE__*/_interopDefault(importPlugin);
23
22
  var eslintPluginPrettierRecommended__default = /*#__PURE__*/_interopDefault(eslintPluginPrettierRecommended);
24
23
  var unusedImportsPlugin__default = /*#__PURE__*/_interopDefault(unusedImportsPlugin);
24
+ var tseslint__default = /*#__PURE__*/_interopDefault(tseslint);
25
25
 
26
26
  var __defProp = Object.defineProperty;
27
- var __defProps = Object.defineProperties;
28
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
29
27
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
30
28
  var __hasOwnProp = Object.prototype.hasOwnProperty;
31
29
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -41,7 +39,6 @@ var __spreadValues = (a, b) => {
41
39
  }
42
40
  return a;
43
41
  };
44
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
45
42
  var createRule = utils.ESLintUtils.RuleCreator.withoutDocs;
46
43
 
47
44
  // src/rules/import-path.ts
@@ -193,22 +190,59 @@ var import_path_default = createRule({
193
190
  var rules_default = {
194
191
  "import-path": import_path_default
195
192
  };
196
- var recommended_default = [
193
+
194
+ // src/configs/recommended.ts
195
+ var config = [
197
196
  js__default.default.configs.recommended,
198
197
  importPlugin__default.default.flatConfigs.recommended,
199
198
  eslintPluginPrettierRecommended__default.default,
199
+ ...tseslint__default.default.configs.recommended,
200
+ importPlugin__default.default.flatConfigs.typescript,
200
201
  {
201
- languageOptions: {
202
- ecmaVersion: 2020,
203
- sourceType: "module",
204
- globals: __spreadValues(__spreadValues(__spreadValues({}, globals__default.default.es2017), globals__default.default.browser), globals__default.default.node)
202
+ // ESLint config block에 file이 있으면 해당 파일을 검사할 차례가 와서야 plugin이 적용됨
203
+ // 따라서 이 Plugin을 끄려면 Config File에서 file: "~~"을 넣어야 됨
204
+ // 이 과정을 없애기 위해 plugin 적용을 앞서 진행
205
+ plugins: {
206
+ "@kurateh": { rules: rules_default, meta: { name: "@kurateh" } }
207
+ }
208
+ },
209
+ {
210
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
211
+ ignores: ["node_modules/", "dist/", "build/", "coverage/"],
212
+ settings: {
213
+ "import/resolver": {
214
+ typescript: {
215
+ alwaysTryTypes: true,
216
+ // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
217
+ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
218
+ // use <root>/path/to/folder/tsconfig.json
219
+ project: "tsconfig.json"
220
+ // Multiple tsconfigs (Useful for monorepos)
221
+ // use a glob pattern
222
+ // project: "packages/*/tsconfig.json",
223
+ // use an array
224
+ // project: [
225
+ // "packages/module-a/tsconfig.json",
226
+ // "packages/module-b/tsconfig.json"
227
+ // ],
228
+ // use an array of glob patterns
229
+ // project: [
230
+ // "packages/*/tsconfig.json",
231
+ // "other-packages/*/
232
+ }
233
+ }
205
234
  },
206
235
  plugins: {
207
236
  "unused-imports": unusedImportsPlugin__default.default
208
237
  },
209
- ignores: ["node_modules/", "dist/", "build/", "coverage/"],
238
+ languageOptions: {
239
+ ecmaVersion: "latest",
240
+ sourceType: "module",
241
+ globals: __spreadValues(__spreadValues(__spreadValues({}, globals__default.default.es2017), globals__default.default.browser), globals__default.default.node)
242
+ },
210
243
  rules: {
211
244
  // eslint
245
+ "no-console": 1,
212
246
  "object-shorthand": 1,
213
247
  "no-unused-vars": [
214
248
  1,
@@ -230,21 +264,9 @@ var recommended_default = [
230
264
  camelcase: [1, { allow: ["^\\w*_[A-Z]*$"] }],
231
265
  "no-var": 2,
232
266
  // prettier
233
- "prettier/prettier": [
234
- 1,
235
- {
236
- trailingComma: "all",
237
- tabWidth: 2,
238
- semi: true,
239
- singleQuote: false,
240
- endOfLine: "auto"
241
- },
242
- {
243
- usePrettierrc: false
244
- }
245
- ],
267
+ "prettier/prettier": 1,
246
268
  // import
247
- "import/no-unresolved": 0,
269
+ "import/no-named-as-default-member": 0,
248
270
  "import/no-extraneous-dependencies": [
249
271
  2,
250
272
  {
@@ -283,55 +305,10 @@ var recommended_default = [
283
305
  }
284
306
  ],
285
307
  // unused-imports
286
- "unused-imports/no-unused-imports": 2
287
- }
288
- }
289
- ];
290
-
291
- // src/configs/typescript.ts
292
- var typescript_default = [
293
- ...recommended_default,
294
- // eslint-disable-next-line import/no-named-as-default-member
295
- ...tseslint__default.default.configs.recommended,
296
- importPlugin__default.default.flatConfigs.typescript,
297
- {
298
- // ESLint config block에 file이 있으면 해당 파일을 검사할 차례가 와서야 plugin이 적용됨
299
- // 따라서 이 Plugin을 끄려면 Config File에서 file: "~~"을 넣어야 됨
300
- // 이 과정을 없애기 위해 plugin 적용을 앞서 진행
301
- plugins: {
302
- "@kurateh": { rules: rules_default, meta: { name: "@kurateh" } }
303
- }
304
- },
305
- {
306
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
307
- settings: {
308
- "import/resolver": {
309
- typescript: {
310
- alwaysTryTypes: true,
311
- // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
312
- // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
313
- // use <root>/path/to/folder/tsconfig.json
314
- project: "tsconfig.json"
315
- // Multiple tsconfigs (Useful for monorepos)
316
- // use a glob pattern
317
- // project: "packages/*/tsconfig.json",
318
- // use an array
319
- // project: [
320
- // "packages/module-a/tsconfig.json",
321
- // "packages/module-b/tsconfig.json"
322
- // ],
323
- // use an array of glob patterns
324
- // project: [
325
- // "packages/*/tsconfig.json",
326
- // "other-packages/*/
327
- }
328
- }
329
- },
330
- rules: {
331
- // eslint
308
+ "unused-imports/no-unused-imports": 2,
309
+ // kurateh
332
310
  "@kurateh/import-path": 1,
333
- "object-shorthand": 1,
334
- "no-unused-vars": 0,
311
+ // typescript
335
312
  "@typescript-eslint/no-unused-vars": [
336
313
  1,
337
314
  {
@@ -348,27 +325,18 @@ var typescript_default = [
348
325
  fixStyle: "inline-type-imports"
349
326
  }
350
327
  ],
351
- "no-param-reassign": [
352
- 2,
353
- {
354
- props: true,
355
- ignorePropertyModificationsForRegex: ["^draft$", "Draft$"]
356
- }
357
- ],
358
- camelcase: [1, { allow: ["^\\w*_[A-Z]*$"] }],
359
- "no-var": 2,
360
328
  "import-plugin/no-unresolved": 0
361
329
  }
362
330
  }
363
331
  ];
332
+ var recommended_default = config;
364
333
 
365
334
  // src/configs/react.ts
366
- var _a, _b;
367
- var react_default = [
368
- ...typescript_default,
369
- (_b = (_a = react__default.default.configs.flat) == null ? void 0 : _a.recommended) != null ? _b : {},
335
+ var config2 = [
336
+ ...recommended_default,
337
+ react__default.default.configs.flat.recommended,
338
+ reactHooks__default.default.configs.flat.recommended,
370
339
  {
371
- plugins: { "react-hooks": reactHook__default.default },
372
340
  files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
373
341
  languageOptions: {
374
342
  parserOptions: {
@@ -378,7 +346,7 @@ var react_default = [
378
346
  },
379
347
  globals: __spreadValues({}, globals__default.default.browser)
380
348
  },
381
- rules: __spreadProps(__spreadValues({}, reactHook__default.default.configs.recommended.rules), {
349
+ rules: {
382
350
  "react/react-in-jsx-scope": 0,
383
351
  "react/function-component-definition": [
384
352
  2,
@@ -396,19 +364,21 @@ var react_default = [
396
364
  ],
397
365
  "react/prop-types": 0,
398
366
  "react/require-default-props": 0,
399
- "react/display-name": 0
400
- })
367
+ "react/display-name": 0,
368
+ "react/no-children-prop": [2, { allowFunctions: true }]
369
+ }
401
370
  }
402
371
  ];
372
+ var react_default = config2;
403
373
 
404
374
  // src/index.ts
405
- var index_default = {
375
+ var plugin = {
406
376
  configs: {
407
377
  recommended: recommended_default,
408
- typescript: typescript_default,
409
378
  react: react_default
410
379
  },
411
380
  rules: rules_default
412
381
  };
382
+ var index_default = plugin;
413
383
 
414
384
  module.exports = index_default;
package/dist/index.mjs CHANGED
@@ -1,20 +1,18 @@
1
1
  import { createRequire } from 'module';
2
2
  import react from 'eslint-plugin-react';
3
- import reactHook from 'eslint-plugin-react-hooks';
3
+ import reactHooks from 'eslint-plugin-react-hooks';
4
4
  import globals from 'globals';
5
- import importPlugin from 'eslint-plugin-import';
6
- import tseslint from 'typescript-eslint';
7
- import { readFileSync, existsSync } from 'node:fs';
8
- import { join, dirname, relative } from 'node:path';
9
- import { ESLintUtils } from '@typescript-eslint/utils';
10
5
  import js from '@eslint/js';
6
+ import importPlugin from 'eslint-plugin-import';
11
7
  import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
12
8
  import unusedImportsPlugin from 'eslint-plugin-unused-imports';
9
+ import tseslint from 'typescript-eslint';
10
+ import { readFileSync, existsSync } from 'fs';
11
+ import { join, dirname, relative } from 'path';
12
+ import { ESLintUtils } from '@typescript-eslint/utils';
13
13
 
14
14
  createRequire(import.meta.url);
15
15
  var __defProp = Object.defineProperty;
16
- var __defProps = Object.defineProperties;
17
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
18
16
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
19
17
  var __hasOwnProp = Object.prototype.hasOwnProperty;
20
18
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -30,7 +28,6 @@ var __spreadValues = (a, b) => {
30
28
  }
31
29
  return a;
32
30
  };
33
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
34
31
  var createRule = ESLintUtils.RuleCreator.withoutDocs;
35
32
 
36
33
  // src/rules/import-path.ts
@@ -182,22 +179,59 @@ var import_path_default = createRule({
182
179
  var rules_default = {
183
180
  "import-path": import_path_default
184
181
  };
185
- var recommended_default = [
182
+
183
+ // src/configs/recommended.ts
184
+ var config = [
186
185
  js.configs.recommended,
187
186
  importPlugin.flatConfigs.recommended,
188
187
  eslintPluginPrettierRecommended,
188
+ ...tseslint.configs.recommended,
189
+ importPlugin.flatConfigs.typescript,
189
190
  {
190
- languageOptions: {
191
- ecmaVersion: 2020,
192
- sourceType: "module",
193
- globals: __spreadValues(__spreadValues(__spreadValues({}, globals.es2017), globals.browser), globals.node)
191
+ // ESLint config block에 file이 있으면 해당 파일을 검사할 차례가 와서야 plugin이 적용됨
192
+ // 따라서 이 Plugin을 끄려면 Config File에서 file: "~~"을 넣어야 됨
193
+ // 이 과정을 없애기 위해 plugin 적용을 앞서 진행
194
+ plugins: {
195
+ "@kurateh": { rules: rules_default, meta: { name: "@kurateh" } }
196
+ }
197
+ },
198
+ {
199
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
200
+ ignores: ["node_modules/", "dist/", "build/", "coverage/"],
201
+ settings: {
202
+ "import/resolver": {
203
+ typescript: {
204
+ alwaysTryTypes: true,
205
+ // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
206
+ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
207
+ // use <root>/path/to/folder/tsconfig.json
208
+ project: "tsconfig.json"
209
+ // Multiple tsconfigs (Useful for monorepos)
210
+ // use a glob pattern
211
+ // project: "packages/*/tsconfig.json",
212
+ // use an array
213
+ // project: [
214
+ // "packages/module-a/tsconfig.json",
215
+ // "packages/module-b/tsconfig.json"
216
+ // ],
217
+ // use an array of glob patterns
218
+ // project: [
219
+ // "packages/*/tsconfig.json",
220
+ // "other-packages/*/
221
+ }
222
+ }
194
223
  },
195
224
  plugins: {
196
225
  "unused-imports": unusedImportsPlugin
197
226
  },
198
- ignores: ["node_modules/", "dist/", "build/", "coverage/"],
227
+ languageOptions: {
228
+ ecmaVersion: "latest",
229
+ sourceType: "module",
230
+ globals: __spreadValues(__spreadValues(__spreadValues({}, globals.es2017), globals.browser), globals.node)
231
+ },
199
232
  rules: {
200
233
  // eslint
234
+ "no-console": 1,
201
235
  "object-shorthand": 1,
202
236
  "no-unused-vars": [
203
237
  1,
@@ -219,21 +253,9 @@ var recommended_default = [
219
253
  camelcase: [1, { allow: ["^\\w*_[A-Z]*$"] }],
220
254
  "no-var": 2,
221
255
  // prettier
222
- "prettier/prettier": [
223
- 1,
224
- {
225
- trailingComma: "all",
226
- tabWidth: 2,
227
- semi: true,
228
- singleQuote: false,
229
- endOfLine: "auto"
230
- },
231
- {
232
- usePrettierrc: false
233
- }
234
- ],
256
+ "prettier/prettier": 1,
235
257
  // import
236
- "import/no-unresolved": 0,
258
+ "import/no-named-as-default-member": 0,
237
259
  "import/no-extraneous-dependencies": [
238
260
  2,
239
261
  {
@@ -272,55 +294,10 @@ var recommended_default = [
272
294
  }
273
295
  ],
274
296
  // unused-imports
275
- "unused-imports/no-unused-imports": 2
276
- }
277
- }
278
- ];
279
-
280
- // src/configs/typescript.ts
281
- var typescript_default = [
282
- ...recommended_default,
283
- // eslint-disable-next-line import/no-named-as-default-member
284
- ...tseslint.configs.recommended,
285
- importPlugin.flatConfigs.typescript,
286
- {
287
- // ESLint config block에 file이 있으면 해당 파일을 검사할 차례가 와서야 plugin이 적용됨
288
- // 따라서 이 Plugin을 끄려면 Config File에서 file: "~~"을 넣어야 됨
289
- // 이 과정을 없애기 위해 plugin 적용을 앞서 진행
290
- plugins: {
291
- "@kurateh": { rules: rules_default, meta: { name: "@kurateh" } }
292
- }
293
- },
294
- {
295
- files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
296
- settings: {
297
- "import/resolver": {
298
- typescript: {
299
- alwaysTryTypes: true,
300
- // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
301
- // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
302
- // use <root>/path/to/folder/tsconfig.json
303
- project: "tsconfig.json"
304
- // Multiple tsconfigs (Useful for monorepos)
305
- // use a glob pattern
306
- // project: "packages/*/tsconfig.json",
307
- // use an array
308
- // project: [
309
- // "packages/module-a/tsconfig.json",
310
- // "packages/module-b/tsconfig.json"
311
- // ],
312
- // use an array of glob patterns
313
- // project: [
314
- // "packages/*/tsconfig.json",
315
- // "other-packages/*/
316
- }
317
- }
318
- },
319
- rules: {
320
- // eslint
297
+ "unused-imports/no-unused-imports": 2,
298
+ // kurateh
321
299
  "@kurateh/import-path": 1,
322
- "object-shorthand": 1,
323
- "no-unused-vars": 0,
300
+ // typescript
324
301
  "@typescript-eslint/no-unused-vars": [
325
302
  1,
326
303
  {
@@ -337,27 +314,18 @@ var typescript_default = [
337
314
  fixStyle: "inline-type-imports"
338
315
  }
339
316
  ],
340
- "no-param-reassign": [
341
- 2,
342
- {
343
- props: true,
344
- ignorePropertyModificationsForRegex: ["^draft$", "Draft$"]
345
- }
346
- ],
347
- camelcase: [1, { allow: ["^\\w*_[A-Z]*$"] }],
348
- "no-var": 2,
349
317
  "import-plugin/no-unresolved": 0
350
318
  }
351
319
  }
352
320
  ];
321
+ var recommended_default = config;
353
322
 
354
323
  // src/configs/react.ts
355
- var _a, _b;
356
- var react_default = [
357
- ...typescript_default,
358
- (_b = (_a = react.configs.flat) == null ? void 0 : _a.recommended) != null ? _b : {},
324
+ var config2 = [
325
+ ...recommended_default,
326
+ react.configs.flat.recommended,
327
+ reactHooks.configs.flat.recommended,
359
328
  {
360
- plugins: { "react-hooks": reactHook },
361
329
  files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
362
330
  languageOptions: {
363
331
  parserOptions: {
@@ -367,7 +335,7 @@ var react_default = [
367
335
  },
368
336
  globals: __spreadValues({}, globals.browser)
369
337
  },
370
- rules: __spreadProps(__spreadValues({}, reactHook.configs.recommended.rules), {
338
+ rules: {
371
339
  "react/react-in-jsx-scope": 0,
372
340
  "react/function-component-definition": [
373
341
  2,
@@ -385,19 +353,21 @@ var react_default = [
385
353
  ],
386
354
  "react/prop-types": 0,
387
355
  "react/require-default-props": 0,
388
- "react/display-name": 0
389
- })
356
+ "react/display-name": 0,
357
+ "react/no-children-prop": [2, { allowFunctions: true }]
358
+ }
390
359
  }
391
360
  ];
361
+ var react_default = config2;
392
362
 
393
363
  // src/index.ts
394
- var index_default = {
364
+ var plugin = {
395
365
  configs: {
396
366
  recommended: recommended_default,
397
- typescript: typescript_default,
398
367
  react: react_default
399
368
  },
400
369
  rules: rules_default
401
370
  };
371
+ var index_default = plugin;
402
372
 
403
373
  export { index_default as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurateh/eslint-plugin",
3
- "version": "1.2.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "import": "./dist/index.mjs",
@@ -21,27 +21,27 @@
21
21
  "devDependencies": {
22
22
  "@kurateh/eslint-plugin": "file:",
23
23
  "@types/node": "^22.10.2",
24
- "@types/react": "^19.0.2",
25
- "eslint": "^9.17.0",
26
- "prettier": "^3.4.2",
27
- "react": "^19.0.0",
28
- "tsup": "^8.3.5",
29
- "typescript": "^5.7.2"
24
+ "@types/react": "^19.2.7",
25
+ "eslint": "~9.17.0",
26
+ "prettier": "^3.7.4",
27
+ "react": "^19.2.3",
28
+ "tsup": "^8.5.1",
29
+ "typescript": "^5.9.3"
30
30
  },
31
31
  "dependencies": {
32
- "@eslint/js": "^9.17.0",
33
- "@typescript-eslint/eslint-plugin": "^8.18.1",
34
- "@typescript-eslint/parser": "^8.18.1",
35
- "@typescript-eslint/utils": "^8.18.1",
36
- "eslint-config-prettier": "^9.1.0",
37
- "eslint-import-resolver-typescript": "^3.7.0",
38
- "eslint-plugin-import": "^2.31.0",
39
- "eslint-plugin-prettier": "^5.2.1",
40
- "eslint-plugin-react": "^7.37.2",
41
- "eslint-plugin-react-hooks": "^5.1.0",
42
- "eslint-plugin-unused-imports": "^4.1.4",
43
- "globals": "^15.14.0",
44
- "typescript-eslint": "^8.18.1"
32
+ "@eslint/js": "^9.39.2",
33
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
34
+ "@typescript-eslint/parser": "^8.50.0",
35
+ "@typescript-eslint/utils": "^8.50.0",
36
+ "eslint-config-prettier": "^10.1.8",
37
+ "eslint-import-resolver-typescript": "^4.4.4",
38
+ "eslint-plugin-import": "^2.32.0",
39
+ "eslint-plugin-prettier": "^5.5.4",
40
+ "eslint-plugin-react": "^7.37.5",
41
+ "eslint-plugin-react-hooks": "^7.0.1",
42
+ "eslint-plugin-unused-imports": "^4.3.0",
43
+ "globals": "^16.5.0",
44
+ "typescript-eslint": "^8.50.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "eslint": ">=9"