@lqbach/eslint-config 0.2.2 โ†’ 0.3.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/CHANGELOG.md CHANGED
@@ -1,40 +1,67 @@
1
1
  # Changelog
2
2
 
3
- ## [0.2.2](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.2.1...eslint-config-v0.2.2) (2023-11-14)
3
+ ## [0.3.1](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.3.0...eslint-config-v0.3.1) (2023-11-22)
4
+
5
+
6
+ ### Bug Fixes ๐Ÿ›
7
+
8
+ * added main export to package ([5fa1fcc](https://github.com/lqbach/eslint-prettier-config/commit/5fa1fccf954a61ae353ac74f66925f18fcb744ec))
9
+
10
+ ## [0.3.0](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.2.2...eslint-config-v0.3.0) (2023-11-21)
11
+
12
+
13
+ ### Features ๐Ÿš€
14
+
15
+ * add jsonc eslint config ([f07b3c3](https://github.com/lqbach/eslint-prettier-config/commit/f07b3c359d12e2e5564aa388750e4d738c6afab3))
16
+ * add perfectionist sorting for eslint ([b2d8205](https://github.com/lqbach/eslint-prettier-config/commit/b2d8205314b5fe72675afd87a960864018e10782))
17
+ * add yaml config ([f02ae29](https://github.com/lqbach/eslint-prettier-config/commit/f02ae29b2c4ed47d9cb50c81e860ce87bb6d7897))
18
+ * prettier sorted imports ([c12ede2](https://github.com/lqbach/eslint-prettier-config/commit/c12ede2941863b767810495ee8b5c3cc6691e430))
19
+
20
+
21
+ ### Chores ๐Ÿงน
22
+
23
+ * add husky pre-commit ([db5cdfa](https://github.com/lqbach/eslint-prettier-config/commit/db5cdfa5ce036cebbdbf1edd23885aa1719c27cd))
24
+ * add licensing to package ([e18f4f3](https://github.com/lqbach/eslint-prettier-config/commit/e18f4f36cf44fac1da5906094f2dc9ca2ea2f2d9))
25
+
26
+
27
+ ### Miscellaneous
28
+
29
+ * update the configuration architecture of configs ([8e77c83](https://github.com/lqbach/eslint-prettier-config/commit/8e77c838251dd60d9d682d0cb8208dae4679c6f3))
4
30
 
5
31
 
6
32
  ### Documentation ๐Ÿ“
7
33
 
8
- * add badges to eslint config readme ([afc422e](https://github.com/lqbach/eslint-prettier-config/commit/afc422eeeec6e7fe4b95b7f9c315b90a76a32ad5))
9
- * add new readme docs ([b2b0044](https://github.com/lqbach/eslint-prettier-config/commit/b2b004442723e81299e10a2945e9f616324ac06a))
34
+ * align badges ([8e7c4e1](https://github.com/lqbach/eslint-prettier-config/commit/8e7c4e1bcbd7ac7321ae02b21ce0ccf19e70a471))
10
35
 
11
- ## [0.2.1](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.2.0...eslint-config-v0.2.1) (2023-11-14)
36
+ ## [0.2.2](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.2.1...eslint-config-v0.2.2) (2023-11-14)
37
+
38
+ ### Documentation ๐Ÿ“
12
39
 
40
+ - add badges to eslint config readme ([afc422e](https://github.com/lqbach/eslint-prettier-config/commit/afc422eeeec6e7fe4b95b7f9c315b90a76a32ad5))
41
+ - add new readme docs ([b2b0044](https://github.com/lqbach/eslint-prettier-config/commit/b2b004442723e81299e10a2945e9f616324ac06a))
42
+
43
+ ## [0.2.1](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.2.0...eslint-config-v0.2.1) (2023-11-14)
13
44
 
14
45
  ### Bug Fixes
15
46
 
16
- * update package visiblity ([2c332e1](https://github.com/lqbach/eslint-prettier-config/commit/2c332e19165da93881d6ee61b75560041f9a5397))
47
+ - update package visiblity ([2c332e1](https://github.com/lqbach/eslint-prettier-config/commit/2c332e19165da93881d6ee61b75560041f9a5397))
17
48
 
18
49
  ## [0.2.0](https://github.com/lqbach/eslint-prettier-config/compare/eslint-config-v0.1.0...eslint-config-v0.2.0) (2023-11-14)
19
50
 
20
-
21
51
  ### Features
22
52
 
23
- * add new repository key to package ([d63ceb7](https://github.com/lqbach/eslint-prettier-config/commit/d63ceb7e9a348efc322ecdcb5d462cee6a2b05b8))
53
+ - add new repository key to package ([d63ceb7](https://github.com/lqbach/eslint-prettier-config/commit/d63ceb7e9a348efc322ecdcb5d462cee6a2b05b8))
24
54
 
25
55
  ## 0.1.0 (2023-11-14)
26
56
 
27
-
28
57
  ### Features
29
58
 
30
- * add release-please configuration ([6e7bd49](https://github.com/lqbach/eslint-prettier-config/commit/6e7bd492c16b998b28600204214732078f1c034f))
31
-
59
+ - add release-please configuration ([6e7bd49](https://github.com/lqbach/eslint-prettier-config/commit/6e7bd492c16b998b28600204214732078f1c034f))
32
60
 
33
61
  ### Bug Fixes
34
62
 
35
- * update name in package descriptions ([103aeb8](https://github.com/lqbach/eslint-prettier-config/commit/103aeb876f9ef22177e66a6946f8a257dc7479cd))
36
-
63
+ - update name in package descriptions ([103aeb8](https://github.com/lqbach/eslint-prettier-config/commit/103aeb876f9ef22177e66a6946f8a257dc7479cd))
37
64
 
38
65
  ### Miscellaneous Chores
39
66
 
40
- * release 0.1.0 ([7cb7162](https://github.com/lqbach/eslint-prettier-config/commit/7cb7162ec233343991bdcfeaadb1caff612c5c9f))
67
+ - release 0.1.0 ([7cb7162](https://github.com/lqbach/eslint-prettier-config/commit/7cb7162ec233343991bdcfeaadb1caff612c5c9f))
package/README.md CHANGED
@@ -1,3 +1,12 @@
1
- # @lqbach/eslint-config
1
+ <h1 align="center">@lqbach/eslint-config</h1>
2
2
 
3
- ![LICENSE](https://img.shields.io/github/license/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F) ![RELEASE_DATE](https://img.shields.io/github/release-date/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F) ![npm](https://img.shields.io/npm/v/@lqbach/eslint-config?color=444E5F&label=version&labelColor=BDD4E7)
3
+ <div align="center">
4
+ <a href="https://www.npmjs.com/package/@lqbach/eslint-config">
5
+ <img src="https://img.shields.io/npm/v/@lqbach/eslint-config?color=444E5F&label=version&labelColor=BDD4E7" alt="npm-package"/>
6
+ </a>
7
+ <a href="https://www.npmjs.com/package/@lqbach/eslint-config">
8
+ <img src="https://img.shields.io/github/license/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F" alt="license"/>
9
+ </a>
10
+ <img src="https://img.shields.io/github/release-date/lqbach/eslint-prettier-config?labelColor=BDD4E7&color=444E5F" alt="release-date"/>
11
+
12
+ </div>
package/dist/index.cjs CHANGED
@@ -331,20 +331,81 @@ __export(src_exports, {
331
331
  default: () => config
332
332
  });
333
333
  module.exports = __toCommonJS(src_exports);
334
+ var import_globals = __toESM(require("globals"), 1);
334
335
 
335
336
  // src/libs.ts
336
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
337
+ var import_js = __toESM(require_src(), 1);
337
338
  var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
339
+ var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
340
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
341
+ var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
342
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
338
343
  var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
344
+ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
339
345
  var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
340
- var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
346
+ var import_eslint_plugin_yml = __toESM(require("eslint-plugin-yml"), 1);
347
+ var import_jsonc_eslint_parser = __toESM(require("jsonc-eslint-parser"), 1);
341
348
  var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
342
- var import_js = __toESM(require_src(), 1);
343
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
349
+ var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
344
350
 
345
351
  // src/index.ts
346
- var import_globals = __toESM(require("globals"), 1);
347
- function config(params) {
352
+ function config(params = {}) {
353
+ const ignoresConfig = {
354
+ ignores: [
355
+ "**/node_modules",
356
+ "**/dist",
357
+ "**/package-lock.json",
358
+ "**/yarn.lock",
359
+ "**/pnpm-lock.yaml",
360
+ "**/bun.lockb",
361
+ "**/output",
362
+ "**/coverage",
363
+ "**/temp",
364
+ "**/.nuxt",
365
+ "**/.next",
366
+ "**/.vercel",
367
+ "**/.changeset",
368
+ "**/.idea",
369
+ "**/.cache",
370
+ "**/.output",
371
+ "**/*.min.*",
372
+ "**/LICENSE*"
373
+ ]
374
+ };
375
+ const javascriptConfig = [
376
+ // Default
377
+ import_js.default.configs.recommended,
378
+ {
379
+ files: ["**/*.js", "**/*.mjs"],
380
+ languageOptions: {
381
+ ecmaVersion: 2022,
382
+ globals: {
383
+ ...import_globals.default.browser,
384
+ ...import_globals.default.node,
385
+ ...import_globals.default.es6,
386
+ ...import_globals.default.commonjs
387
+ },
388
+ parserOptions: {
389
+ sourceType: "module"
390
+ }
391
+ },
392
+ plugins: {
393
+ "unused-imports": import_eslint_plugin_unused_imports.default
394
+ },
395
+ rules: {
396
+ "unused-imports/no-unused-imports": "error",
397
+ "unused-imports/no-unused-vars": [
398
+ "warn",
399
+ {
400
+ args: "after-used",
401
+ argsIgnorePattern: "^_",
402
+ vars: "all",
403
+ varsIgnorePattern: "^_"
404
+ }
405
+ ]
406
+ }
407
+ }
408
+ ];
348
409
  const typescriptConfig = params.typescript ?? true ? {
349
410
  files: ["**/*.{ts,tsx}"],
350
411
  languageOptions: {
@@ -384,67 +445,57 @@ function config(params) {
384
445
  ...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules
385
446
  }
386
447
  } : {};
387
- return [
388
- // Files to ignore
448
+ const yamlConfig = params.yaml ?? true ? {
449
+ files: ["**/*.{yaml, yml}"],
450
+ languageOptions: {
451
+ parser: import_yaml_eslint_parser.default
452
+ },
453
+ plugins: {
454
+ yml: import_eslint_plugin_yml.default
455
+ },
456
+ rules: {
457
+ ...import_eslint_plugin_yml.default.configs["standard"].rules,
458
+ ...import_eslint_plugin_yml.default.configs["prettier"].rules
459
+ }
460
+ } : {};
461
+ const jsoncConfig = params.json ?? true ? [
389
462
  {
390
- ignores: [
391
- "**/node_modules",
392
- "**/dist",
393
- "**/package-lock.json",
394
- "**/yarn.lock",
395
- "**/pnpm-lock.yaml",
396
- "**/bun.lockb",
397
- "**/output",
398
- "**/coverage",
399
- "**/temp",
400
- "**/.nuxt",
401
- "**/.next",
402
- "**/.vercel",
403
- "**/.changeset",
404
- "**/.idea",
405
- "**/.cache",
406
- "**/.output",
407
- "**/*.min.*",
408
- "**/LICENSE*"
409
- ]
463
+ plugins: {
464
+ jsonc: import_eslint_plugin_jsonc.default
465
+ }
410
466
  },
411
- // Default
412
- import_js.default.configs.recommended,
413
467
  {
414
- files: ["**/*.js", "**/*.mjs"],
468
+ files: ["**/*.{json, json5, jsonc}"],
415
469
  languageOptions: {
416
- ecmaVersion: 2022,
417
- parserOptions: {
418
- sourceType: "module"
419
- },
420
- globals: {
421
- ...import_globals.default.browser,
422
- ...import_globals.default.node,
423
- ...import_globals.default.es6,
424
- ...import_globals.default.commonjs
425
- }
426
- },
427
- plugins: {
428
- "unused-imports": import_eslint_plugin_unused_imports.default
470
+ parser: import_jsonc_eslint_parser.default
429
471
  },
430
472
  rules: {
431
- "unused-imports/no-unused-imports": "error",
432
- "unused-imports/no-unused-vars": [
433
- "warn",
434
- {
435
- vars: "all",
436
- varsIgnorePattern: "^_",
437
- args: "after-used",
438
- argsIgnorePattern: "^_"
439
- }
440
- ]
473
+ ...import_eslint_plugin_jsonc.default.configs["recommended-with-json"].rules,
474
+ ...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
475
+ ...import_eslint_plugin_jsonc.default.configs["recommended-with-json5"].rules,
476
+ ...import_eslint_plugin_jsonc.default.configs["prettier"].rules,
477
+ "jsonc/no-comments": "off"
441
478
  }
479
+ }
480
+ ] : [];
481
+ const perfectionistConfig = params.perfectionist ?? true ? {
482
+ plugins: {
483
+ perfectionist: import_eslint_plugin_perfectionist.default
442
484
  },
443
- {
444
- ...typescriptConfig,
445
- ...reactConfig,
446
- ...vueConfig
447
- },
448
- import_eslint_config_prettier.default
449
- ];
485
+ rules: {
486
+ ...import_eslint_plugin_perfectionist.default.configs["recommended-natural"].rules
487
+ }
488
+ } : {};
489
+ const prettierConfig = import_eslint_config_prettier.default;
490
+ let config2 = [];
491
+ config2.push(ignoresConfig);
492
+ config2.push(...javascriptConfig);
493
+ config2.push(typescriptConfig);
494
+ config2.push(reactConfig);
495
+ config2.push(vueConfig);
496
+ config2.push(yamlConfig);
497
+ config2.push(...jsoncConfig);
498
+ config2.push(perfectionistConfig);
499
+ config2.push(prettierConfig);
500
+ return config2;
450
501
  }
package/dist/index.js CHANGED
@@ -319,23 +319,86 @@ var require_src = __commonJS({
319
319
  }
320
320
  });
321
321
 
322
+ // src/index.ts
323
+ import globals from "globals";
324
+
322
325
  // src/libs.ts
323
326
  var import_js = __toESM(require_src(), 1);
324
- import { default as default2 } from "eslint-plugin-unused-imports";
325
327
  import { default as default3 } from "@typescript-eslint/eslint-plugin";
326
- import { default as default4 } from "eslint-plugin-react";
327
- import { default as default5 } from "eslint-plugin-vue";
328
- import { default as default6 } from "@typescript-eslint/parser";
329
- import { default as default7 } from "vue-eslint-parser";
330
- import { default as default9 } from "eslint-config-prettier";
328
+ import { default as default4 } from "@typescript-eslint/parser";
329
+ import { default as default5 } from "eslint-config-prettier";
330
+ import { default as default6 } from "eslint-plugin-jsonc";
331
+ import { default as default7 } from "eslint-plugin-perfectionist";
332
+ import { default as default8 } from "eslint-plugin-react";
333
+ import { default as default9 } from "eslint-plugin-unused-imports";
334
+ import { default as default10 } from "eslint-plugin-vue";
335
+ import { default as default11 } from "eslint-plugin-yml";
336
+ import { default as default12 } from "jsonc-eslint-parser";
337
+ import { default as default13 } from "vue-eslint-parser";
338
+ import { default as default14 } from "yaml-eslint-parser";
331
339
 
332
340
  // src/index.ts
333
- import globals from "globals";
334
- function config(params) {
341
+ function config(params = {}) {
342
+ const ignoresConfig = {
343
+ ignores: [
344
+ "**/node_modules",
345
+ "**/dist",
346
+ "**/package-lock.json",
347
+ "**/yarn.lock",
348
+ "**/pnpm-lock.yaml",
349
+ "**/bun.lockb",
350
+ "**/output",
351
+ "**/coverage",
352
+ "**/temp",
353
+ "**/.nuxt",
354
+ "**/.next",
355
+ "**/.vercel",
356
+ "**/.changeset",
357
+ "**/.idea",
358
+ "**/.cache",
359
+ "**/.output",
360
+ "**/*.min.*",
361
+ "**/LICENSE*"
362
+ ]
363
+ };
364
+ const javascriptConfig = [
365
+ // Default
366
+ import_js.default.configs.recommended,
367
+ {
368
+ files: ["**/*.js", "**/*.mjs"],
369
+ languageOptions: {
370
+ ecmaVersion: 2022,
371
+ globals: {
372
+ ...globals.browser,
373
+ ...globals.node,
374
+ ...globals.es6,
375
+ ...globals.commonjs
376
+ },
377
+ parserOptions: {
378
+ sourceType: "module"
379
+ }
380
+ },
381
+ plugins: {
382
+ "unused-imports": default9
383
+ },
384
+ rules: {
385
+ "unused-imports/no-unused-imports": "error",
386
+ "unused-imports/no-unused-vars": [
387
+ "warn",
388
+ {
389
+ args: "after-used",
390
+ argsIgnorePattern: "^_",
391
+ vars: "all",
392
+ varsIgnorePattern: "^_"
393
+ }
394
+ ]
395
+ }
396
+ }
397
+ ];
335
398
  const typescriptConfig = params.typescript ?? true ? {
336
399
  files: ["**/*.{ts,tsx}"],
337
400
  languageOptions: {
338
- parser: default6,
401
+ parser: default4,
339
402
  parserOptions: {
340
403
  sourceType: "module"
341
404
  }
@@ -350,90 +413,80 @@ function config(params) {
350
413
  const reactConfig = params.react ?? false ? {
351
414
  files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
352
415
  plugins: {
353
- react: default4
416
+ react: default8
354
417
  },
355
418
  rules: {
356
- ...default4.configs.recommended.rules
419
+ ...default8.configs.recommended.rules
357
420
  }
358
421
  } : {};
359
422
  const vueConfig = params.vue ?? false ? {
360
423
  files: ["**/*.vue"],
361
424
  languageOptions: {
362
- parser: default7,
425
+ parser: default13,
363
426
  parserOptions: {
364
- parser: params.typescript ? default6 : null,
427
+ parser: params.typescript ? default4 : null,
365
428
  sourceType: "module"
366
429
  }
367
430
  },
368
431
  rules: {
369
- ...default5.configs["base"].rules,
370
- ...default5.configs["vue3-essential"].rules,
371
- ...default5.configs["vue3-strongly-recommended"].rules
432
+ ...default10.configs["base"].rules,
433
+ ...default10.configs["vue3-essential"].rules,
434
+ ...default10.configs["vue3-strongly-recommended"].rules
435
+ }
436
+ } : {};
437
+ const yamlConfig = params.yaml ?? true ? {
438
+ files: ["**/*.{yaml, yml}"],
439
+ languageOptions: {
440
+ parser: default14
441
+ },
442
+ plugins: {
443
+ yml: default11
444
+ },
445
+ rules: {
446
+ ...default11.configs["standard"].rules,
447
+ ...default11.configs["prettier"].rules
372
448
  }
373
449
  } : {};
374
- return [
375
- // Files to ignore
450
+ const jsoncConfig = params.json ?? true ? [
376
451
  {
377
- ignores: [
378
- "**/node_modules",
379
- "**/dist",
380
- "**/package-lock.json",
381
- "**/yarn.lock",
382
- "**/pnpm-lock.yaml",
383
- "**/bun.lockb",
384
- "**/output",
385
- "**/coverage",
386
- "**/temp",
387
- "**/.nuxt",
388
- "**/.next",
389
- "**/.vercel",
390
- "**/.changeset",
391
- "**/.idea",
392
- "**/.cache",
393
- "**/.output",
394
- "**/*.min.*",
395
- "**/LICENSE*"
396
- ]
452
+ plugins: {
453
+ jsonc: default6
454
+ }
397
455
  },
398
- // Default
399
- import_js.default.configs.recommended,
400
456
  {
401
- files: ["**/*.js", "**/*.mjs"],
457
+ files: ["**/*.{json, json5, jsonc}"],
402
458
  languageOptions: {
403
- ecmaVersion: 2022,
404
- parserOptions: {
405
- sourceType: "module"
406
- },
407
- globals: {
408
- ...globals.browser,
409
- ...globals.node,
410
- ...globals.es6,
411
- ...globals.commonjs
412
- }
413
- },
414
- plugins: {
415
- "unused-imports": default2
459
+ parser: default12
416
460
  },
417
461
  rules: {
418
- "unused-imports/no-unused-imports": "error",
419
- "unused-imports/no-unused-vars": [
420
- "warn",
421
- {
422
- vars: "all",
423
- varsIgnorePattern: "^_",
424
- args: "after-used",
425
- argsIgnorePattern: "^_"
426
- }
427
- ]
462
+ ...default6.configs["recommended-with-json"].rules,
463
+ ...default6.configs["recommended-with-jsonc"].rules,
464
+ ...default6.configs["recommended-with-json5"].rules,
465
+ ...default6.configs["prettier"].rules,
466
+ "jsonc/no-comments": "off"
428
467
  }
468
+ }
469
+ ] : [];
470
+ const perfectionistConfig = params.perfectionist ?? true ? {
471
+ plugins: {
472
+ perfectionist: default7
429
473
  },
430
- {
431
- ...typescriptConfig,
432
- ...reactConfig,
433
- ...vueConfig
434
- },
435
- default9
436
- ];
474
+ rules: {
475
+ ...default7.configs["recommended-natural"].rules
476
+ }
477
+ } : {};
478
+ const prettierConfig = default5;
479
+ let config2 = [];
480
+ config2.push(ignoresConfig);
481
+ config2.push(...javascriptConfig);
482
+ config2.push(typescriptConfig);
483
+ config2.push(reactConfig);
484
+ config2.push(vueConfig);
485
+ config2.push(yamlConfig);
486
+ config2.push(...jsoncConfig);
487
+ config2.push(perfectionistConfig);
488
+ config2.push(prettierConfig);
489
+ return config2;
437
490
  }
438
491
  export {
439
492
  config as default
package/package.json CHANGED
@@ -1,28 +1,37 @@
1
1
  {
2
2
  "name": "@lqbach/eslint-config",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.3.1",
5
5
  "description": "lqbach's Personal Eslint Config",
6
6
  "private": false,
7
+ "license": "MIT",
7
8
  "repository": {
8
9
  "type": "git",
9
10
  "url": "git+https://github.com/lqbach/eslint-prettier-config.git",
10
11
  "directory": "packages/eslint-config"
11
12
  },
12
13
  "exports": {
13
- "./index": "./dist/index.js"
14
+ ".": {
15
+ "import": "./dist/index.js"
16
+ }
14
17
  },
18
+ "main": "./dist/index.js",
15
19
  "dependencies": {
16
20
  "@typescript-eslint/eslint-plugin": "^6.10.0",
17
21
  "@typescript-eslint/parser": "^6.10.0",
18
22
  "eslint-config-prettier": "^9.0.0",
23
+ "eslint-plugin-jsonc": "^2.10.0",
24
+ "eslint-plugin-perfectionist": "^2.4.0",
19
25
  "eslint-plugin-react": "^7.33.2",
20
26
  "eslint-plugin-unused-imports": "^3.0.0",
21
27
  "eslint-plugin-vue": "^9.18.1",
28
+ "eslint-plugin-yml": "^1.10.0",
22
29
  "globals": "^13.23.0",
30
+ "jsonc-eslint-parser": "^2.4.0",
23
31
  "remove": "^0.1.5",
24
32
  "typescript": "^5.2.2",
25
- "vue-eslint-parser": "^9.3.2"
33
+ "vue-eslint-parser": "^9.3.2",
34
+ "yaml-eslint-parser": "^1.2.2"
26
35
  },
27
36
  "devDependencies": {
28
37
  "eslint": "^8.53.0"
package/src/index.ts CHANGED
@@ -1,19 +1,85 @@
1
+ import globals from "globals"
2
+
1
3
  import {
2
- pluginUnusedImports,
3
- pluginTypeScript,
4
- pluginReact,
5
- pluginVue,
4
+ configPrettier,
5
+ jsConfig,
6
+ parserJsonc,
6
7
  parserTypeScript,
7
8
  parserVue,
8
- jsConfig,
9
- configPrettier,
9
+ parserYaml,
10
+ pluginJsonc,
11
+ pluginPerfectionist,
12
+ pluginReact,
13
+ pluginTypeScript,
14
+ pluginUnusedImports,
15
+ pluginVue,
16
+ pluginYaml,
10
17
  } from "./libs"
18
+ import { ConfigObject, ConfigParams } from "./types"
11
19
 
12
- import { ConfigParams, ConfigObject } from "./types"
20
+ export default function config(params: ConfigParams = {}): Array<ConfigObject> {
21
+ // Ignores Config
22
+ const ignoresConfig: ConfigObject = {
23
+ ignores: [
24
+ "**/node_modules",
25
+ "**/dist",
26
+ "**/package-lock.json",
27
+ "**/yarn.lock",
28
+ "**/pnpm-lock.yaml",
29
+ "**/bun.lockb",
13
30
 
14
- import globals from "globals"
31
+ "**/output",
32
+ "**/coverage",
33
+ "**/temp",
34
+ "**/.nuxt",
35
+ "**/.next",
36
+ "**/.vercel",
37
+ "**/.changeset",
38
+ "**/.idea",
39
+ "**/.cache",
40
+ "**/.output",
41
+
42
+ "**/*.min.*",
43
+ "**/LICENSE*",
44
+ ],
45
+ }
46
+
47
+ //JavaScript Config
48
+ const javascriptConfig: Array<ConfigObject> = [
49
+ // Default
50
+ jsConfig.configs.recommended,
51
+ {
52
+ files: ["**/*.js", "**/*.mjs"],
53
+ languageOptions: {
54
+ ecmaVersion: 2022,
55
+ globals: {
56
+ ...globals.browser,
57
+ ...globals.node,
58
+ ...globals.es6,
59
+ ...globals.commonjs,
60
+ },
61
+ parserOptions: {
62
+ sourceType: "module",
63
+ },
64
+ },
65
+ plugins: {
66
+ "unused-imports": pluginUnusedImports,
67
+ },
68
+ rules: {
69
+ "unused-imports/no-unused-imports": "error",
70
+ "unused-imports/no-unused-vars": [
71
+ "warn",
72
+ {
73
+ args: "after-used",
74
+ argsIgnorePattern: "^_",
75
+ vars: "all",
76
+ varsIgnorePattern: "^_",
77
+ },
78
+ ],
79
+ },
80
+ },
81
+ ]
15
82
 
16
- export default function config(params: ConfigParams) {
17
83
  // TypeScript Config
18
84
  const typescriptConfig: ConfigObject =
19
85
  params.typescript ?? true
@@ -68,72 +134,74 @@ export default function config(params: ConfigParams) {
68
134
  }
69
135
  : {}
70
136
 
71
- return [
72
- // Files to ignore
73
- {
74
- ignores: [
75
- "**/node_modules",
76
- "**/dist",
77
- "**/package-lock.json",
78
- "**/yarn.lock",
79
- "**/pnpm-lock.yaml",
80
- "**/bun.lockb",
81
-
82
- "**/output",
83
- "**/coverage",
84
- "**/temp",
85
- "**/.nuxt",
86
- "**/.next",
87
- "**/.vercel",
88
- "**/.changeset",
89
- "**/.idea",
90
- "**/.cache",
91
- "**/.output",
92
-
93
- "**/*.min.*",
94
- "**/LICENSE*",
95
- ],
96
- },
137
+ // YAML Config
138
+ const yamlConfig: ConfigObject =
139
+ params.yaml ?? true
140
+ ? {
141
+ files: ["**/*.{yaml, yml}"],
142
+ languageOptions: {
143
+ parser: parserYaml,
144
+ },
145
+ plugins: {
146
+ yml: pluginYaml,
147
+ },
148
+ rules: {
149
+ ...pluginYaml.configs["standard"].rules,
150
+ ...pluginYaml.configs["prettier"].rules,
151
+ },
152
+ }
153
+ : {}
97
154
 
98
- // Default
99
- jsConfig.configs.recommended,
100
- {
101
- files: ["**/*.js", "**/*.mjs"],
102
- languageOptions: {
103
- ecmaVersion: 2022,
104
- parserOptions: {
105
- sourceType: "module",
106
- },
107
- globals: {
108
- ...globals.browser,
109
- ...globals.node,
110
- ...globals.es6,
111
- ...globals.commonjs,
112
- },
113
- },
114
- plugins: {
115
- "unused-imports": pluginUnusedImports,
116
- },
117
- rules: {
118
- "unused-imports/no-unused-imports": "error",
119
- "unused-imports/no-unused-vars": [
120
- "warn",
155
+ // JSONC Config
156
+ const jsoncConfig: Array<ConfigObject> =
157
+ params.json ?? true
158
+ ? [
121
159
  {
122
- vars: "all",
123
- varsIgnorePattern: "^_",
124
- args: "after-used",
125
- argsIgnorePattern: "^_",
160
+ plugins: {
161
+ jsonc: pluginJsonc,
162
+ },
126
163
  },
127
- ],
128
- },
129
- },
164
+ {
165
+ files: ["**/*.{json, json5, jsonc}"],
166
+ languageOptions: {
167
+ parser: parserJsonc,
168
+ },
169
+ rules: {
170
+ ...pluginJsonc.configs["recommended-with-json"].rules,
171
+ ...pluginJsonc.configs["recommended-with-jsonc"].rules,
172
+ ...pluginJsonc.configs["recommended-with-json5"].rules,
173
+ ...pluginJsonc.configs["prettier"].rules,
174
+ "jsonc/no-comments": "off",
175
+ },
176
+ },
177
+ ]
178
+ : []
130
179
 
131
- {
132
- ...typescriptConfig,
133
- ...reactConfig,
134
- ...vueConfig,
135
- },
180
+ // Perfectionist Config
181
+ const perfectionistConfig: ConfigObject =
182
+ params.perfectionist ?? true
183
+ ? {
184
+ plugins: {
185
+ perfectionist: pluginPerfectionist,
186
+ },
187
+ rules: {
188
+ ...pluginPerfectionist.configs["recommended-natural"].rules,
189
+ },
190
+ }
191
+ : {}
136
192
 
137
- configPrettier,
138
- ]
193
+ const prettierConfig: ConfigObject = configPrettier
194
+
195
+ let config: Array<ConfigObject> = []
196
+ config.push(ignoresConfig)
197
+ config.push(...javascriptConfig)
198
+ config.push(typescriptConfig)
199
+ config.push(reactConfig)
200
+ config.push(vueConfig)
201
+ config.push(yamlConfig)
202
+ config.push(...jsoncConfig)
203
+ config.push(perfectionistConfig)
204
+ config.push(prettierConfig)
205
+
206
+ return config
139
207
  }
package/src/libs.ts CHANGED
@@ -2,14 +2,19 @@
2
2
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
3
  // @ts-nocheck
4
4
 
5
- export { default as pluginUnusedImports } from "eslint-plugin-unused-imports"
5
+ export { default as jsConfig } from "@eslint/js"
6
6
  export { default as pluginTypeScript } from "@typescript-eslint/eslint-plugin"
7
+ export { default as parserTypeScript } from "@typescript-eslint/parser"
8
+ export { default as configPrettier } from "eslint-config-prettier"
9
+ export { default as pluginJsonc } from "eslint-plugin-jsonc"
10
+ export { default as pluginPerfectionist } from "eslint-plugin-perfectionist"
7
11
  export { default as pluginReact } from "eslint-plugin-react"
12
+
13
+ export { default as pluginUnusedImports } from "eslint-plugin-unused-imports"
8
14
  export { default as pluginVue } from "eslint-plugin-vue"
15
+ export { default as pluginYaml } from "eslint-plugin-yml"
16
+ export { default as parserJsonc } from "jsonc-eslint-parser"
9
17
 
10
- export { default as parserTypeScript } from "@typescript-eslint/parser"
11
18
  export { default as parserVue } from "vue-eslint-parser"
12
19
 
13
- export { default as jsConfig } from "@eslint/js"
14
-
15
- export { default as configPrettier } from "eslint-config-prettier"
20
+ export { default as parserYaml } from "yaml-eslint-parser"
package/src/types.ts CHANGED
@@ -1,34 +1,33 @@
1
- import globals from "globals"
2
-
3
1
  export interface ConfigParams {
4
- typescript?: boolean
5
- vue?: boolean
6
- react?: boolean
7
- json?: boolean
8
- yaml?: boolean
9
- markdown?: boolean
2
+ json?: boolean
3
+ markdown?: boolean
4
+ perfectionist?: boolean
5
+ react?: boolean
6
+ typescript?: boolean
7
+ vue?: boolean
8
+ yaml?: boolean
10
9
  }
11
10
 
12
11
  export interface LanguageOptions {
13
- ecmaVersion?: string,
14
- sourceType?: string,
15
- globals?: object,
16
- parser?: object,
17
- parserOptions?: object,
12
+ ecmaVersion?: string
13
+ globals?: object
14
+ parser?: object
15
+ parserOptions?: object
16
+ sourceType?: string
18
17
  }
19
18
 
20
19
  export interface LinterOptions {
21
- noInlineConfig?: boolean,
22
- reportUnusedDisableDirectives?: boolean
20
+ noInlineConfig?: boolean
21
+ reportUnusedDisableDirectives?: boolean
23
22
  }
24
23
 
25
24
  export interface ConfigObject {
26
- files?: Array<string>,
27
- ignores?: Array<string>,
28
- languageOptions?: LanguageOptions,
29
- linterOptions?: LinterOptions,
30
- processor?: object,
31
- plugins?: object,
32
- rules?: object,
33
- settings?: object
34
- }
25
+ files?: Array<string>
26
+ ignores?: Array<string>
27
+ languageOptions?: LanguageOptions
28
+ linterOptions?: LinterOptions
29
+ plugins?: object
30
+ processor?: object
31
+ rules?: object
32
+ settings?: object
33
+ }
package/tsconfig.json CHANGED
@@ -9,7 +9,6 @@
9
9
  "esModuleInterop": true,
10
10
  "skipLibCheck": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
- "rootDir": "./src",
13
12
  "outDir": "./dist",
14
13
  "composite": true
15
14
  }