@component-hook/eslint-plugin 0.1.2-alpha.4 → 0.1.3-alpha.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 +23 -21
- package/dist/index.d.ts +4 -3
- package/dist/index.js +52 -36
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# @component-hook/eslint-plugin
|
|
2
2
|
|
|
3
|
-
A opinionated ESLint config preset for JavaScript, TypeScript, Vue,
|
|
4
|
-
and Prettier.
|
|
3
|
+
A opinionated ESLint config preset for JavaScript, TypeScript, Vue, and Prettier.
|
|
5
4
|
|
|
6
5
|
<p>
|
|
7
|
-
<a href="https://npm-stat.com/charts.html?package=@component-hook/
|
|
6
|
+
<a href="https://npm-stat.com/charts.html?package=@component-hook/eslint-plugin">
|
|
8
7
|
<img src="https://img.shields.io/npm/dm/@component-hook/eslint-plugin.svg" alt="npm"/>
|
|
9
8
|
</a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/@component-hook/
|
|
9
|
+
<a href="https://www.npmjs.com/package/@component-hook/eslint-plugin">
|
|
11
10
|
<img src="https://img.shields.io/npm/v/@component-hook/eslint-plugin.svg" alt="npm"/>
|
|
12
11
|
</a>
|
|
13
12
|
</p>
|
|
@@ -43,6 +42,7 @@ export default [
|
|
|
43
42
|
...componentHookPlugin.configs.basic,
|
|
44
43
|
...componentHookPlugin.configs.vue,
|
|
45
44
|
...componentHookPlugin.configs.markdown,
|
|
45
|
+
componentHookPlugin.configs.prettier,
|
|
46
46
|
componentHookPlugin.configs.sonarjs,
|
|
47
47
|
componentHookPlugin.configs.security,
|
|
48
48
|
{
|
|
@@ -63,29 +63,30 @@ See [basic](./index.ts) and [ignores](./configs/ignores.ts) for more details.
|
|
|
63
63
|
|
|
64
64
|
```js
|
|
65
65
|
import {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
reactPreset, // Includes basic, react, markdown, prettier, sonarjs, security configs
|
|
67
|
+
vuePreset, // Includes basic, vue, markdown, prettier, sonarjs, security configs
|
|
68
68
|
} from '@component-hook/eslint-plugin';
|
|
69
69
|
|
|
70
|
-
export default
|
|
70
|
+
export default reactPreset;
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
## Configs
|
|
74
74
|
|
|
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`
|
|
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
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
| testing-library/
|
|
86
|
-
| testing-library/
|
|
87
|
-
| testing-library/
|
|
88
|
-
| 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` |
|
|
89
90
|
|
|
90
91
|
## Reference eslint plugin
|
|
91
92
|
|
|
@@ -94,6 +95,7 @@ export default reactRecommended;
|
|
|
94
95
|
- [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)
|
|
95
96
|
- [eslint-plugin-regexp/flat/recommended](https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/lib/configs/flat/recommended.ts)
|
|
96
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)
|
|
97
99
|
- [eslint-plugin-react/recommended](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/configs/recommended.js)
|
|
98
100
|
- [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/blob/main/packages/eslint-plugin-react-hooks/src/index.js)
|
|
99
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>;
|
|
@@ -1172,7 +1173,7 @@ declare const _default: {
|
|
|
1172
1173
|
};
|
|
1173
1174
|
};
|
|
1174
1175
|
|
|
1175
|
-
declare const
|
|
1176
|
+
declare const reactPreset: ({
|
|
1176
1177
|
name: string;
|
|
1177
1178
|
rules: {
|
|
1178
1179
|
'no-var': string;
|
|
@@ -2328,7 +2329,7 @@ declare const reactRecommended: ({
|
|
|
2328
2329
|
};
|
|
2329
2330
|
};
|
|
2330
2331
|
})[];
|
|
2331
|
-
declare const
|
|
2332
|
+
declare const vuePreset: ({
|
|
2332
2333
|
name: string;
|
|
2333
2334
|
rules: {
|
|
2334
2335
|
'no-var': string;
|
|
@@ -4648,4 +4649,4 @@ declare const vueSkyline: ({
|
|
|
4648
4649
|
};
|
|
4649
4650
|
})[];
|
|
4650
4651
|
|
|
4651
|
-
export { _default as default,
|
|
4652
|
+
export { _default as default, reactPreset, vuePreset, vueSkyline };
|
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.0/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.0/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.0/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.0/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.0/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.0/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";
|
|
@@ -363,12 +364,19 @@ var jsConfigs = [
|
|
|
363
364
|
|
|
364
365
|
// configs/typescript.ts
|
|
365
366
|
var rules2 = {
|
|
366
|
-
"@typescript-eslint/no-unused-expressions": "off",
|
|
367
367
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
368
368
|
"@typescript-eslint/no-explicit-any": "off",
|
|
369
369
|
"@typescript-eslint/no-unsafe-function-type": "off",
|
|
370
370
|
"@typescript-eslint/no-shadow": "error",
|
|
371
|
-
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }]
|
|
371
|
+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }],
|
|
372
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
373
|
+
"error",
|
|
374
|
+
{
|
|
375
|
+
allowShortCircuit: true,
|
|
376
|
+
allowTaggedTemplates: true,
|
|
377
|
+
allowTernary: true
|
|
378
|
+
}
|
|
379
|
+
]
|
|
372
380
|
};
|
|
373
381
|
var typescriptConfigs = default4.config({
|
|
374
382
|
extends: [...default4.configs.recommended],
|
|
@@ -379,7 +387,7 @@ var typescriptConfigs = default4.config({
|
|
|
379
387
|
|
|
380
388
|
// configs/import.ts
|
|
381
389
|
var plugins = {
|
|
382
|
-
import: fixupPluginRules(
|
|
390
|
+
import: fixupPluginRules(default17),
|
|
383
391
|
"@typescript-eslint": default4.plugin
|
|
384
392
|
};
|
|
385
393
|
var languageOptions = {
|
|
@@ -396,7 +404,12 @@ var importConfigs = [
|
|
|
396
404
|
plugins,
|
|
397
405
|
languageOptions,
|
|
398
406
|
rules: {
|
|
399
|
-
"import/order": [
|
|
407
|
+
"import/order": [
|
|
408
|
+
"error",
|
|
409
|
+
{
|
|
410
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"]
|
|
411
|
+
}
|
|
412
|
+
],
|
|
400
413
|
"import/first": "error",
|
|
401
414
|
"import/no-default-export": "error",
|
|
402
415
|
"import/no-duplicates": "error",
|
|
@@ -410,6 +423,7 @@ var importConfigs = [
|
|
|
410
423
|
name: "component-hook/allow-default-export",
|
|
411
424
|
files: [
|
|
412
425
|
"**/*.d.ts",
|
|
426
|
+
"**/*.md/**",
|
|
413
427
|
`**/*config*.?([cm])[jt]s?(x)`,
|
|
414
428
|
`**/{views,pages,routes,middleware,plugins,api}/**/*.?([cm])[jt]s?(x)`,
|
|
415
429
|
`**/{index,vite,esbuild,rollup,rolldown,webpack,rspack}.ts`
|
|
@@ -424,7 +438,7 @@ var importConfigs = [
|
|
|
424
438
|
|
|
425
439
|
// configs/markdown.ts
|
|
426
440
|
var markdownConfigs = [
|
|
427
|
-
...
|
|
441
|
+
...default18.configs.recommended.map((config) => {
|
|
428
442
|
const { name, rules: rules5 } = config;
|
|
429
443
|
const baseConfig = {
|
|
430
444
|
...config,
|
|
@@ -445,6 +459,7 @@ var markdownConfigs = [
|
|
|
445
459
|
"@typescript-eslint/no-namespace": "off",
|
|
446
460
|
"@typescript-eslint/no-redeclare": "off",
|
|
447
461
|
"@typescript-eslint/no-require-imports": "off",
|
|
462
|
+
"@typescript-eslint/no-unused-expressions": "off",
|
|
448
463
|
"@typescript-eslint/no-unused-vars": "off",
|
|
449
464
|
"@typescript-eslint/no-use-before-define": "off",
|
|
450
465
|
"import/no-default-export": "off"
|
|
@@ -456,7 +471,7 @@ var markdownConfigs = [
|
|
|
456
471
|
|
|
457
472
|
// configs/regexp.ts
|
|
458
473
|
var regexpConfig = {
|
|
459
|
-
...
|
|
474
|
+
...default16.configs["flat/recommended"],
|
|
460
475
|
name: "component-hook/regexp"
|
|
461
476
|
};
|
|
462
477
|
|
|
@@ -468,25 +483,26 @@ var prettierConfig = {
|
|
|
468
483
|
prettier: default10
|
|
469
484
|
},
|
|
470
485
|
rules: {
|
|
486
|
+
...default11.rules,
|
|
471
487
|
...recommended.rules,
|
|
472
|
-
"prettier/prettier": "
|
|
488
|
+
"prettier/prettier": "warn"
|
|
473
489
|
}
|
|
474
490
|
};
|
|
475
491
|
|
|
476
492
|
// configs/sonarjs.ts
|
|
477
493
|
var sonarjsConfig = {
|
|
478
|
-
...
|
|
494
|
+
...default12.configs.recommended,
|
|
479
495
|
name: "component-hook/sonarjs"
|
|
480
496
|
};
|
|
481
497
|
|
|
482
498
|
// configs/security.ts
|
|
483
499
|
var securityConfig = {
|
|
484
|
-
...
|
|
500
|
+
...default13.configs.recommended,
|
|
485
501
|
name: "component-hook/security"
|
|
486
502
|
};
|
|
487
503
|
|
|
488
504
|
// configs/react.ts
|
|
489
|
-
var
|
|
505
|
+
var reactConfigs = [
|
|
490
506
|
{
|
|
491
507
|
...default5.configs.flat.recommended,
|
|
492
508
|
name: "component-hook/react",
|
|
@@ -611,14 +627,14 @@ var vueConfigs = [
|
|
|
611
627
|
|
|
612
628
|
// configs/playwright.ts
|
|
613
629
|
var playwrightConfig = {
|
|
614
|
-
...
|
|
630
|
+
...default14.configs["flat/recommended"],
|
|
615
631
|
name: "component-hook/playwright"
|
|
616
632
|
};
|
|
617
633
|
|
|
618
634
|
// configs/testing-library.ts
|
|
619
|
-
var configs =
|
|
635
|
+
var configs = default15.configs;
|
|
620
636
|
var plugins2 = {
|
|
621
|
-
"testing-library": fixupPluginRules({ rules:
|
|
637
|
+
"testing-library": fixupPluginRules({ rules: default15.rules })
|
|
622
638
|
};
|
|
623
639
|
var rules4 = {
|
|
624
640
|
"testing-library/await-async-queries": "error",
|
|
@@ -703,12 +719,11 @@ var ignores = {
|
|
|
703
719
|
};
|
|
704
720
|
|
|
705
721
|
// index.ts
|
|
706
|
-
var
|
|
722
|
+
var basicConfigs = [
|
|
707
723
|
...jsConfigs,
|
|
708
724
|
...typescriptConfigs,
|
|
709
725
|
...importConfigs,
|
|
710
726
|
regexpConfig,
|
|
711
|
-
prettierConfig,
|
|
712
727
|
{
|
|
713
728
|
name: "component-hook/globals",
|
|
714
729
|
languageOptions: {
|
|
@@ -722,10 +737,11 @@ var pluginBasic = [
|
|
|
722
737
|
ignores
|
|
723
738
|
];
|
|
724
739
|
var configs2 = {
|
|
725
|
-
basic:
|
|
726
|
-
react:
|
|
740
|
+
basic: basicConfigs,
|
|
741
|
+
react: reactConfigs,
|
|
727
742
|
vue: vueConfigs,
|
|
728
743
|
markdown: markdownConfigs,
|
|
744
|
+
prettier: prettierConfig,
|
|
729
745
|
sonarjs: sonarjsConfig,
|
|
730
746
|
security: securityConfig,
|
|
731
747
|
playwright: playwrightConfig,
|
|
@@ -736,11 +752,11 @@ var configs2 = {
|
|
|
736
752
|
"testing-library/marko": testingLibraryMarkoConfig
|
|
737
753
|
};
|
|
738
754
|
var eslint_plugin_default = { configs: configs2 };
|
|
739
|
-
var
|
|
740
|
-
var
|
|
741
|
-
var
|
|
755
|
+
var basicPreset = [...markdownConfigs, prettierConfig, sonarjsConfig, securityConfig];
|
|
756
|
+
var reactPreset = [...basicConfigs, ...reactConfigs, ...basicPreset];
|
|
757
|
+
var vuePreset = [...basicConfigs, ...vueConfigs, ...basicPreset];
|
|
742
758
|
var vueSkyline = [
|
|
743
|
-
...
|
|
759
|
+
...vuePreset,
|
|
744
760
|
{
|
|
745
761
|
files: ["**/*.vue"],
|
|
746
762
|
rules: {
|
|
@@ -758,7 +774,7 @@ var vueSkyline = [
|
|
|
758
774
|
];
|
|
759
775
|
export {
|
|
760
776
|
eslint_plugin_default as default,
|
|
761
|
-
|
|
762
|
-
|
|
777
|
+
reactPreset,
|
|
778
|
+
vuePreset,
|
|
763
779
|
vueSkyline
|
|
764
780
|
};
|
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-alpha.0",
|
|
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,14 +45,14 @@
|
|
|
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.1.0",
|
|
51
52
|
"vue-eslint-parser": "^9.4.3"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@eslint/config-inspector": "^0.5.
|
|
55
|
+
"@eslint/config-inspector": "^0.5.3",
|
|
55
56
|
"@types/eslint": "^9.6.0",
|
|
56
57
|
"@types/eslint-plugin-security": "^3.0.0",
|
|
57
58
|
"@types/eslint__js": "^8.42.3",
|