@component-hook/eslint-plugin 0.1.2 → 0.1.3
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 +20 -17
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -31
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ A opinionated ESLint config preset for JavaScript, TypeScript, Vue, and Prettier
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
16
16
|
- Support `TypeScript`, `Vue` and `React` out-of-box.
|
|
17
|
-
- Built-in `Markdown`, `Sonarjs`, `Security`, `Playwright` and `Testing-library` configs can be referenced for respective needs.
|
|
17
|
+
- Built-in `Markdown`, `Prettier`, `Sonarjs`, `Security`, `Playwright` and `Testing-library` configs can be referenced for respective needs.
|
|
18
18
|
- Format with Prettier.
|
|
19
19
|
- Ignores common files like `dist`, `node_modules`, `coverage`, and files in `.gitignore`.
|
|
20
20
|
- Reasonable defaults, best practices, and just a few lines of configuration.
|
|
@@ -42,6 +42,7 @@ export default [
|
|
|
42
42
|
...componentHookPlugin.configs.basic,
|
|
43
43
|
...componentHookPlugin.configs.vue,
|
|
44
44
|
...componentHookPlugin.configs.markdown,
|
|
45
|
+
componentHookPlugin.configs.prettier,
|
|
45
46
|
componentHookPlugin.configs.sonarjs,
|
|
46
47
|
componentHookPlugin.configs.security,
|
|
47
48
|
{
|
|
@@ -62,8 +63,8 @@ See [basic](./index.ts) and [ignores](./configs/ignores.ts) for more details.
|
|
|
62
63
|
|
|
63
64
|
```js
|
|
64
65
|
import {
|
|
65
|
-
reactPreset, // Includes basic, react, markdown, sonarjs, security configs
|
|
66
|
-
vuePreset, // Includes basic, vue, markdown, sonarjs, security configs
|
|
66
|
+
reactPreset, // Includes basic, react, markdown, prettier, sonarjs, security configs
|
|
67
|
+
vuePreset, // Includes basic, vue, markdown, prettier, sonarjs, security configs
|
|
67
68
|
} from '@component-hook/eslint-plugin';
|
|
68
69
|
|
|
69
70
|
export default reactPreset;
|
|
@@ -71,20 +72,21 @@ export default reactPreset;
|
|
|
71
72
|
|
|
72
73
|
## Configs
|
|
73
74
|
|
|
74
|
-
| Name | Type | Reference
|
|
75
|
-
| ----------------------- | ----------------- |
|
|
76
|
-
| basic | `Linter.Config[]` | `eslint-recommended`, `typescript-eslint`, `eslint-plugin-import`, `eslint-plugin-regexp`
|
|
77
|
-
| vue | `Linter.Config[]` | `eslint-plugin-vue`, `typescript-eslint`
|
|
78
|
-
| react | `Linter.Config[]` | `eslint-plugin-react/recommended`, `eslint-plugin-react-hooks/recommended`, `eslint-plugin-jsx-a11y/recommended`
|
|
79
|
-
| markdown | `Linter.Config[]` | `eslint-plugin-markdown/recommended`
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
| testing-library/
|
|
85
|
-
| testing-library/
|
|
86
|
-
| testing-library/
|
|
87
|
-
| testing-library/
|
|
75
|
+
| Name | Type | Reference |
|
|
76
|
+
| ----------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| basic | `Linter.Config[]` | `eslint-recommended`, `typescript-eslint`, `eslint-plugin-import`, `eslint-plugin-regexp` |
|
|
78
|
+
| vue | `Linter.Config[]` | `eslint-plugin-vue`, `typescript-eslint` |
|
|
79
|
+
| react | `Linter.Config[]` | `eslint-plugin-react/recommended`, `eslint-plugin-react-hooks/recommended`, `eslint-plugin-jsx-a11y/recommended` |
|
|
80
|
+
| markdown | `Linter.Config[]` | `eslint-plugin-markdown/recommended` |
|
|
81
|
+
| prettier | `Linter.Config` | `eslint-plugin-prettier/recommended`, `eslint-config-prettier` |
|
|
82
|
+
| sonarjs | `Linter.Config` | `eslint-plugin-sonarjs/recommended` |
|
|
83
|
+
| security | `Linter.Config` | `eslint-plugin-security/recommended` |
|
|
84
|
+
| playwright | `Linter.Config` | `eslint-plugin-playwright/flat/recommended` |
|
|
85
|
+
| testing-library/dom | `Linter.Config` | `eslint-plugin-testing-library/dom` |
|
|
86
|
+
| testing-library/vue | `Linter.Config` | `eslint-plugin-testing-library/vue` |
|
|
87
|
+
| testing-library/react | `Linter.Config` | `eslint-plugin-testing-library/react` |
|
|
88
|
+
| testing-library/angular | `Linter.Config` | `eslint-plugin-testing-library/angular` |
|
|
89
|
+
| testing-library/marko | `Linter.Config` | `eslint-plugin-testing-library/marko` |
|
|
88
90
|
|
|
89
91
|
## Reference eslint plugin
|
|
90
92
|
|
|
@@ -93,6 +95,7 @@ export default reactPreset;
|
|
|
93
95
|
- [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)
|
|
94
96
|
- [eslint-plugin-regexp/flat/recommended](https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/flat/recommended.ts)
|
|
95
97
|
- [eslint-plugin-prettier/recommended](https://github.com/prettier/eslint-plugin-prettier/blob/master/recommended.js)
|
|
98
|
+
- [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier/blob/main/index.js)
|
|
96
99
|
- [eslint-plugin-react/recommended](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/configs/recommended.js)
|
|
97
100
|
- [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/index.js)
|
|
98
101
|
- [eslint-plugin-jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/src/index.js)
|
package/dist/index.d.ts
CHANGED
|
@@ -1161,6 +1161,7 @@ declare const _default: {
|
|
|
1161
1161
|
react: eslint.Linter.Config<eslint.Linter.RulesRecord>[];
|
|
1162
1162
|
vue: eslint.Linter.Config<eslint.Linter.RulesRecord>[];
|
|
1163
1163
|
markdown: eslint.Linter.Config<eslint.Linter.RulesRecord>[];
|
|
1164
|
+
prettier: eslint.Linter.Config<eslint.Linter.RulesRecord>;
|
|
1164
1165
|
sonarjs: eslint.Linter.Config<eslint.Linter.RulesRecord>;
|
|
1165
1166
|
security: eslint.Linter.Config<eslint.Linter.RulesRecord>;
|
|
1166
1167
|
playwright: eslint.Linter.Config<eslint.Linter.RulesRecord>;
|
package/dist/index.js
CHANGED
|
@@ -24,9 +24,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
mod
|
|
25
25
|
));
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/.pnpm/@eslint+js@9.
|
|
27
|
+
// ../../node_modules/.pnpm/@eslint+js@9.9.1/node_modules/@eslint/js/src/configs/eslint-all.js
|
|
28
28
|
var require_eslint_all = __commonJS({
|
|
29
|
-
"../../node_modules/.pnpm/@eslint+js@9.
|
|
29
|
+
"../../node_modules/.pnpm/@eslint+js@9.9.1/node_modules/@eslint/js/src/configs/eslint-all.js"(exports, module) {
|
|
30
30
|
"use strict";
|
|
31
31
|
module.exports = Object.freeze({
|
|
32
32
|
"rules": {
|
|
@@ -232,9 +232,9 @@ var require_eslint_all = __commonJS({
|
|
|
232
232
|
}
|
|
233
233
|
});
|
|
234
234
|
|
|
235
|
-
// ../../node_modules/.pnpm/@eslint+js@9.
|
|
235
|
+
// ../../node_modules/.pnpm/@eslint+js@9.9.1/node_modules/@eslint/js/src/configs/eslint-recommended.js
|
|
236
236
|
var require_eslint_recommended = __commonJS({
|
|
237
|
-
"../../node_modules/.pnpm/@eslint+js@9.
|
|
237
|
+
"../../node_modules/.pnpm/@eslint+js@9.9.1/node_modules/@eslint/js/src/configs/eslint-recommended.js"(exports, module) {
|
|
238
238
|
"use strict";
|
|
239
239
|
module.exports = Object.freeze({
|
|
240
240
|
rules: Object.freeze({
|
|
@@ -304,9 +304,9 @@ var require_eslint_recommended = __commonJS({
|
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
|
|
307
|
-
// ../../node_modules/.pnpm/@eslint+js@9.
|
|
307
|
+
// ../../node_modules/.pnpm/@eslint+js@9.9.1/node_modules/@eslint/js/src/index.js
|
|
308
308
|
var require_src = __commonJS({
|
|
309
|
-
"../../node_modules/.pnpm/@eslint+js@9.
|
|
309
|
+
"../../node_modules/.pnpm/@eslint+js@9.9.1/node_modules/@eslint/js/src/index.js"(exports, module) {
|
|
310
310
|
"use strict";
|
|
311
311
|
module.exports = {
|
|
312
312
|
configs: {
|
|
@@ -328,13 +328,14 @@ import { default as default7 } from "eslint-plugin-jsx-a11y";
|
|
|
328
328
|
import { default as default8 } from "eslint-plugin-vue";
|
|
329
329
|
import { default as default9 } from "vue-eslint-parser";
|
|
330
330
|
import { default as default10 } from "eslint-plugin-prettier";
|
|
331
|
-
import { default as default11 } from "eslint-
|
|
332
|
-
import { default as default12 } from "eslint-plugin-
|
|
333
|
-
import { default as default13 } from "eslint-plugin-
|
|
334
|
-
import { default as default14 } from "eslint-plugin-
|
|
335
|
-
import { default as default15 } from "eslint-plugin-
|
|
336
|
-
import { default as default16 } from "eslint-plugin-
|
|
337
|
-
import { default as default17 } from "eslint-plugin-
|
|
331
|
+
import { default as default11 } from "eslint-config-prettier";
|
|
332
|
+
import { default as default12 } from "eslint-plugin-sonarjs";
|
|
333
|
+
import { default as default13 } from "eslint-plugin-security";
|
|
334
|
+
import { default as default14 } from "eslint-plugin-playwright";
|
|
335
|
+
import { default as default15 } from "eslint-plugin-testing-library";
|
|
336
|
+
import { default as default16 } from "eslint-plugin-regexp";
|
|
337
|
+
import { default as default17 } from "eslint-plugin-import";
|
|
338
|
+
import { default as default18 } from "eslint-plugin-markdown";
|
|
338
339
|
|
|
339
340
|
// configs/javascript.ts
|
|
340
341
|
var isProduction = process.env.NODE_ENV === "production";
|
|
@@ -386,7 +387,7 @@ var typescriptConfigs = default4.config({
|
|
|
386
387
|
|
|
387
388
|
// configs/import.ts
|
|
388
389
|
var plugins = {
|
|
389
|
-
import: fixupPluginRules(
|
|
390
|
+
import: fixupPluginRules(default17),
|
|
390
391
|
"@typescript-eslint": default4.plugin
|
|
391
392
|
};
|
|
392
393
|
var languageOptions = {
|
|
@@ -403,7 +404,12 @@ var importConfigs = [
|
|
|
403
404
|
plugins,
|
|
404
405
|
languageOptions,
|
|
405
406
|
rules: {
|
|
406
|
-
"import/order": [
|
|
407
|
+
"import/order": [
|
|
408
|
+
"error",
|
|
409
|
+
{
|
|
410
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"]
|
|
411
|
+
}
|
|
412
|
+
],
|
|
407
413
|
"import/first": "error",
|
|
408
414
|
"import/no-default-export": "error",
|
|
409
415
|
"import/no-duplicates": "error",
|
|
@@ -432,7 +438,7 @@ var importConfigs = [
|
|
|
432
438
|
|
|
433
439
|
// configs/markdown.ts
|
|
434
440
|
var markdownConfigs = [
|
|
435
|
-
...
|
|
441
|
+
...default18.configs.recommended.map((config) => {
|
|
436
442
|
const { name, rules: rules5 } = config;
|
|
437
443
|
const baseConfig = {
|
|
438
444
|
...config,
|
|
@@ -453,6 +459,7 @@ var markdownConfigs = [
|
|
|
453
459
|
"@typescript-eslint/no-namespace": "off",
|
|
454
460
|
"@typescript-eslint/no-redeclare": "off",
|
|
455
461
|
"@typescript-eslint/no-require-imports": "off",
|
|
462
|
+
"@typescript-eslint/no-unused-expressions": "off",
|
|
456
463
|
"@typescript-eslint/no-unused-vars": "off",
|
|
457
464
|
"@typescript-eslint/no-use-before-define": "off",
|
|
458
465
|
"import/no-default-export": "off"
|
|
@@ -464,7 +471,7 @@ var markdownConfigs = [
|
|
|
464
471
|
|
|
465
472
|
// configs/regexp.ts
|
|
466
473
|
var regexpConfig = {
|
|
467
|
-
...
|
|
474
|
+
...default16.configs["flat/recommended"],
|
|
468
475
|
name: "component-hook/regexp"
|
|
469
476
|
};
|
|
470
477
|
|
|
@@ -476,25 +483,26 @@ var prettierConfig = {
|
|
|
476
483
|
prettier: default10
|
|
477
484
|
},
|
|
478
485
|
rules: {
|
|
486
|
+
...default11.rules,
|
|
479
487
|
...recommended.rules,
|
|
480
|
-
"prettier/prettier": "
|
|
488
|
+
"prettier/prettier": "warn"
|
|
481
489
|
}
|
|
482
490
|
};
|
|
483
491
|
|
|
484
492
|
// configs/sonarjs.ts
|
|
485
493
|
var sonarjsConfig = {
|
|
486
|
-
...
|
|
494
|
+
...default12.configs.recommended,
|
|
487
495
|
name: "component-hook/sonarjs"
|
|
488
496
|
};
|
|
489
497
|
|
|
490
498
|
// configs/security.ts
|
|
491
499
|
var securityConfig = {
|
|
492
|
-
...
|
|
500
|
+
...default13.configs.recommended,
|
|
493
501
|
name: "component-hook/security"
|
|
494
502
|
};
|
|
495
503
|
|
|
496
504
|
// configs/react.ts
|
|
497
|
-
var
|
|
505
|
+
var reactConfigs = [
|
|
498
506
|
{
|
|
499
507
|
...default5.configs.flat.recommended,
|
|
500
508
|
name: "component-hook/react",
|
|
@@ -619,14 +627,14 @@ var vueConfigs = [
|
|
|
619
627
|
|
|
620
628
|
// configs/playwright.ts
|
|
621
629
|
var playwrightConfig = {
|
|
622
|
-
...
|
|
630
|
+
...default14.configs["flat/recommended"],
|
|
623
631
|
name: "component-hook/playwright"
|
|
624
632
|
};
|
|
625
633
|
|
|
626
634
|
// configs/testing-library.ts
|
|
627
|
-
var configs =
|
|
635
|
+
var configs = default15.configs;
|
|
628
636
|
var plugins2 = {
|
|
629
|
-
"testing-library": fixupPluginRules({ rules:
|
|
637
|
+
"testing-library": fixupPluginRules({ rules: default15.rules })
|
|
630
638
|
};
|
|
631
639
|
var rules4 = {
|
|
632
640
|
"testing-library/await-async-queries": "error",
|
|
@@ -711,12 +719,11 @@ var ignores = {
|
|
|
711
719
|
};
|
|
712
720
|
|
|
713
721
|
// index.ts
|
|
714
|
-
var
|
|
722
|
+
var basicConfigs = [
|
|
715
723
|
...jsConfigs,
|
|
716
724
|
...typescriptConfigs,
|
|
717
725
|
...importConfigs,
|
|
718
726
|
regexpConfig,
|
|
719
|
-
prettierConfig,
|
|
720
727
|
{
|
|
721
728
|
name: "component-hook/globals",
|
|
722
729
|
languageOptions: {
|
|
@@ -730,10 +737,11 @@ var pluginBasic = [
|
|
|
730
737
|
ignores
|
|
731
738
|
];
|
|
732
739
|
var configs2 = {
|
|
733
|
-
basic:
|
|
734
|
-
react:
|
|
740
|
+
basic: basicConfigs,
|
|
741
|
+
react: reactConfigs,
|
|
735
742
|
vue: vueConfigs,
|
|
736
743
|
markdown: markdownConfigs,
|
|
744
|
+
prettier: prettierConfig,
|
|
737
745
|
sonarjs: sonarjsConfig,
|
|
738
746
|
security: securityConfig,
|
|
739
747
|
playwright: playwrightConfig,
|
|
@@ -744,9 +752,9 @@ var configs2 = {
|
|
|
744
752
|
"testing-library/marko": testingLibraryMarkoConfig
|
|
745
753
|
};
|
|
746
754
|
var eslint_plugin_default = { configs: configs2 };
|
|
747
|
-
var basicPreset = [...markdownConfigs, sonarjsConfig, securityConfig];
|
|
748
|
-
var reactPreset = [...
|
|
749
|
-
var vuePreset = [...
|
|
755
|
+
var basicPreset = [...markdownConfigs, prettierConfig, sonarjsConfig, securityConfig];
|
|
756
|
+
var reactPreset = [...basicConfigs, ...reactConfigs, ...basicPreset];
|
|
757
|
+
var vuePreset = [...basicConfigs, ...vueConfigs, ...basicPreset];
|
|
750
758
|
var vueSkyline = [
|
|
751
759
|
...vuePreset,
|
|
752
760
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@component-hook/eslint-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "ESLint config for component hook",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@eslint/compat": "^1.1.1",
|
|
37
|
+
"eslint-config-prettier": "^9.1.0",
|
|
37
38
|
"eslint-plugin-import": "^2.29.1",
|
|
38
39
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
39
40
|
"eslint-plugin-markdown": "^5.1.0",
|
|
@@ -44,15 +45,15 @@
|
|
|
44
45
|
"eslint-plugin-regexp": "^2.6.0",
|
|
45
46
|
"eslint-plugin-security": "^3.0.1",
|
|
46
47
|
"eslint-plugin-sonarjs": "^1.0.4",
|
|
47
|
-
"eslint-plugin-testing-library": "^6.
|
|
48
|
+
"eslint-plugin-testing-library": "^6.3.0",
|
|
48
49
|
"eslint-plugin-vue": "^9.27.0",
|
|
49
50
|
"globals": "^15.9.0",
|
|
50
|
-
"typescript-eslint": "^8.
|
|
51
|
+
"typescript-eslint": "^8.3.0",
|
|
51
52
|
"vue-eslint-parser": "^9.4.3"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@eslint/config-inspector": "^0.5.
|
|
55
|
-
"@types/eslint": "^9.6.
|
|
55
|
+
"@eslint/config-inspector": "^0.5.4",
|
|
56
|
+
"@types/eslint": "^9.6.1",
|
|
56
57
|
"@types/eslint-plugin-security": "^3.0.0",
|
|
57
58
|
"@types/eslint__js": "^8.42.3",
|
|
58
59
|
"tsup": "^8.2.4"
|