@liwo/eslint-config 0.2.3 → 0.3.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/dist/index.d.ts +3229 -1368
- package/dist/index.js +35 -102
- package/package.json +39 -39
package/dist/index.js
CHANGED
|
@@ -986,33 +986,23 @@ const ReactRouterPackages = [
|
|
|
986
986
|
"@react-router/dev"
|
|
987
987
|
];
|
|
988
988
|
const NextJsPackages = ["next"];
|
|
989
|
+
const TanstackRouterPackages = ["@tanstack/react-router"];
|
|
989
990
|
async function react(options = {}) {
|
|
990
991
|
const { files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`], overrides = {}, tsconfigPath } = options;
|
|
991
|
-
await ensurePackages([
|
|
992
|
-
"@eslint-react/eslint-plugin",
|
|
993
|
-
"eslint-plugin-react-hooks",
|
|
994
|
-
"eslint-plugin-react-refresh"
|
|
995
|
-
]);
|
|
992
|
+
await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-refresh"]);
|
|
996
993
|
const isTypeAware = !!tsconfigPath;
|
|
997
|
-
const typeAwareRules = {
|
|
998
|
-
|
|
999
|
-
"react/no-leaked-conditional-rendering": "warn"
|
|
1000
|
-
};
|
|
1001
|
-
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1002
|
-
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1003
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1004
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1005
|
-
]);
|
|
994
|
+
const typeAwareRules = { "react/no-leaked-conditional-rendering": "warn" };
|
|
995
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
|
|
1006
996
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
|
|
1007
997
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1008
998
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
1009
999
|
const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
|
|
1000
|
+
const isUsingTanstackRouter = TanstackRouterPackages.some((i) => isPackageExists(i));
|
|
1010
1001
|
return [
|
|
1011
1002
|
{
|
|
1012
1003
|
name: "liwo/react/setup",
|
|
1013
1004
|
plugins: {
|
|
1014
1005
|
"react": pluginReact,
|
|
1015
|
-
"react-hooks": pluginReactHooks,
|
|
1016
1006
|
"react-refresh": pluginReactRefresh
|
|
1017
1007
|
}
|
|
1018
1008
|
},
|
|
@@ -1024,95 +1014,38 @@ async function react(options = {}) {
|
|
|
1024
1014
|
},
|
|
1025
1015
|
name: "liwo/react/rules",
|
|
1026
1016
|
rules: {
|
|
1027
|
-
|
|
1028
|
-
"react/no-array-index-key": "warn",
|
|
1029
|
-
"react/no-children-count": "warn",
|
|
1030
|
-
"react/no-children-for-each": "warn",
|
|
1031
|
-
"react/no-children-map": "warn",
|
|
1032
|
-
"react/no-children-only": "warn",
|
|
1033
|
-
"react/no-children-to-array": "warn",
|
|
1034
|
-
"react/no-class-component": "warn",
|
|
1035
|
-
"react/no-clone-element": "warn",
|
|
1036
|
-
"react/no-component-will-mount": "error",
|
|
1037
|
-
"react/no-component-will-receive-props": "error",
|
|
1038
|
-
"react/no-component-will-update": "error",
|
|
1039
|
-
"react/no-context-provider": "warn",
|
|
1040
|
-
"react/no-create-ref": "error",
|
|
1041
|
-
"react/no-direct-mutation-state": "error",
|
|
1042
|
-
"react/no-duplicate-key": "warn",
|
|
1043
|
-
"react/no-forward-ref": "warn",
|
|
1044
|
-
"react/no-missing-component-display-name": "warn",
|
|
1045
|
-
"react/no-missing-key": "error",
|
|
1046
|
-
"react/no-misused-capture-owner-stack": "warn",
|
|
1047
|
-
"react/no-nested-component-definitions": "error",
|
|
1048
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1049
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1050
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1051
|
-
"react/no-unnecessary-use-prefix": "warn",
|
|
1052
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1053
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1054
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1055
|
-
"react/no-unstable-context-value": "warn",
|
|
1056
|
-
"react/no-unstable-default-props": "warn",
|
|
1057
|
-
"react/no-unused-class-component-members": "warn",
|
|
1058
|
-
"react/no-use-context": "warn",
|
|
1059
|
-
"react/jsx-no-comment-textnodes": "warn",
|
|
1060
|
-
"react/jsx-no-children-prop": "warn",
|
|
1061
|
-
"react/jsx-no-useless-fragment": "warn",
|
|
1062
|
-
"react/jsx-no-namespace": "error",
|
|
1063
|
-
"react/dom-no-dangerously-set-innerhtml": "warn",
|
|
1064
|
-
"react/dom-no-dangerously-set-innerhtml-with-children": "error",
|
|
1065
|
-
"react/dom-no-find-dom-node": "error",
|
|
1066
|
-
"react/dom-no-flush-sync": "error",
|
|
1067
|
-
"react/dom-no-hydrate": "error",
|
|
1068
|
-
"react/dom-no-missing-button-type": "warn",
|
|
1069
|
-
"react/dom-no-missing-iframe-sandbox": "warn",
|
|
1070
|
-
"react/dom-no-render": "error",
|
|
1071
|
-
"react/dom-no-render-return-value": "error",
|
|
1072
|
-
"react/dom-no-script-url": "warn",
|
|
1073
|
-
"react/dom-no-string-style-prop": "warn",
|
|
1074
|
-
"react/dom-no-unknown-property": "warn",
|
|
1075
|
-
"react/dom-no-unsafe-iframe-sandbox": "warn",
|
|
1076
|
-
"react/dom-no-unsafe-target-blank": "warn",
|
|
1077
|
-
"react/dom-no-use-form-state": "error",
|
|
1078
|
-
"react/dom-no-void-elements-with-children": "error",
|
|
1079
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
1080
|
-
"react/set-state-in-effect": "warn",
|
|
1081
|
-
"react/web-api-no-leaked-event-listener": "warn",
|
|
1082
|
-
"react/web-api-no-leaked-fetch": "warn",
|
|
1083
|
-
"react/web-api-no-leaked-interval": "warn",
|
|
1084
|
-
"react/web-api-no-leaked-resize-observer": "warn",
|
|
1085
|
-
"react/web-api-no-leaked-timeout": "warn",
|
|
1086
|
-
"react/naming-convention-context-name": "warn",
|
|
1087
|
-
"react/naming-convention-id-name": "warn",
|
|
1088
|
-
"react/naming-convention-ref-name": "warn",
|
|
1017
|
+
...pluginReact.configs.recommended.rules,
|
|
1089
1018
|
"react-refresh/only-export-components": ["warn", {
|
|
1090
1019
|
allowConstantExport: isAllowConstantExport,
|
|
1091
|
-
allowExportNames: [
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1020
|
+
allowExportNames: [
|
|
1021
|
+
...isUsingNext ? [
|
|
1022
|
+
"dynamic",
|
|
1023
|
+
"dynamicParams",
|
|
1024
|
+
"revalidate",
|
|
1025
|
+
"fetchCache",
|
|
1026
|
+
"runtime",
|
|
1027
|
+
"preferredRegion",
|
|
1028
|
+
"maxDuration",
|
|
1029
|
+
"config",
|
|
1030
|
+
"generateStaticParams",
|
|
1031
|
+
"metadata",
|
|
1032
|
+
"generateMetadata",
|
|
1033
|
+
"viewport",
|
|
1034
|
+
"generateViewport"
|
|
1035
|
+
] : [],
|
|
1036
|
+
...isUsingRemix || isUsingReactRouter ? [
|
|
1037
|
+
"meta",
|
|
1038
|
+
"links",
|
|
1039
|
+
"headers",
|
|
1040
|
+
"loader",
|
|
1041
|
+
"action",
|
|
1042
|
+
"clientLoader",
|
|
1043
|
+
"clientAction",
|
|
1044
|
+
"handle",
|
|
1045
|
+
"shouldRevalidate"
|
|
1046
|
+
] : [],
|
|
1047
|
+
...isUsingTanstackRouter ? ["Route"] : []
|
|
1048
|
+
]
|
|
1116
1049
|
}],
|
|
1117
1050
|
...overrides
|
|
1118
1051
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liwo/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"description": "ESLint config by Liwo",
|
|
6
6
|
"author": "Aoang <aoang@x2oe.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,66 +47,66 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@antfu/install-pkg": "1.1.0",
|
|
50
|
-
"@clack/prompts": "1.
|
|
51
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.7.
|
|
52
|
-
"@eslint-react/eslint-plugin": "5.
|
|
53
|
-
"@eslint/markdown": "8.0.
|
|
50
|
+
"@clack/prompts": "1.7.0",
|
|
51
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
|
|
52
|
+
"@eslint-react/eslint-plugin": "5.12.1",
|
|
53
|
+
"@eslint/markdown": "8.0.3",
|
|
54
54
|
"@stylistic/eslint-plugin": "5.10.0",
|
|
55
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
56
|
-
"@typescript-eslint/parser": "8.
|
|
57
|
-
"@vitest/eslint-plugin": "1.6.
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "8.63.0",
|
|
56
|
+
"@typescript-eslint/parser": "8.63.0",
|
|
57
|
+
"@vitest/eslint-plugin": "1.6.22",
|
|
58
58
|
"eslint-config-flat-gitignore": "2.3.0",
|
|
59
59
|
"eslint-flat-config-utils": "3.2.0",
|
|
60
60
|
"eslint-merge-processors": "2.0.0",
|
|
61
|
-
"eslint-plugin-antfu": "3.2.
|
|
61
|
+
"eslint-plugin-antfu": "3.2.3",
|
|
62
62
|
"eslint-plugin-command": "3.5.2",
|
|
63
63
|
"eslint-plugin-format": "2.0.1",
|
|
64
64
|
"eslint-plugin-import-lite": "0.6.0",
|
|
65
|
-
"eslint-plugin-jsdoc": "
|
|
66
|
-
"eslint-plugin-jsonc": "3.
|
|
67
|
-
"eslint-plugin-n": "
|
|
65
|
+
"eslint-plugin-jsdoc": "63.0.12",
|
|
66
|
+
"eslint-plugin-jsonc": "3.3.0",
|
|
67
|
+
"eslint-plugin-n": "18.2.1",
|
|
68
68
|
"eslint-plugin-no-only-tests": "3.4.0",
|
|
69
|
-
"eslint-plugin-perfectionist": "5.
|
|
70
|
-
"eslint-plugin-pnpm": "1.6.
|
|
69
|
+
"eslint-plugin-perfectionist": "5.10.0",
|
|
70
|
+
"eslint-plugin-pnpm": "1.6.1",
|
|
71
71
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
72
|
-
"eslint-plugin-react-refresh": "0.5.
|
|
73
|
-
"eslint-plugin-regexp": "3.1.
|
|
74
|
-
"eslint-plugin-toml": "1.
|
|
75
|
-
"eslint-plugin-unicorn": "
|
|
72
|
+
"eslint-plugin-react-refresh": "0.5.3",
|
|
73
|
+
"eslint-plugin-regexp": "3.1.1",
|
|
74
|
+
"eslint-plugin-toml": "1.4.0",
|
|
75
|
+
"eslint-plugin-unicorn": "71.1.0",
|
|
76
76
|
"eslint-plugin-unused-imports": "4.4.1",
|
|
77
|
-
"eslint-plugin-vue": "10.9.
|
|
78
|
-
"eslint-plugin-yml": "3.
|
|
77
|
+
"eslint-plugin-vue": "10.9.2",
|
|
78
|
+
"eslint-plugin-yml": "3.6.0",
|
|
79
79
|
"eslint-processor-vue-blocks": "2.0.0",
|
|
80
|
-
"globals": "17.
|
|
80
|
+
"globals": "17.7.0",
|
|
81
81
|
"jsonc-eslint-parser": "3.1.0",
|
|
82
|
-
"local-pkg": "1.1
|
|
82
|
+
"local-pkg": "1.2.1",
|
|
83
83
|
"parse-gitignore": "2.0.0",
|
|
84
84
|
"toml-eslint-parser": "1.0.3",
|
|
85
|
-
"vue-eslint-parser": "10.4.
|
|
86
|
-
"yaml-eslint-parser": "2.
|
|
85
|
+
"vue-eslint-parser": "10.4.1",
|
|
86
|
+
"yaml-eslint-parser": "2.1.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@eslint/config-inspector": "
|
|
89
|
+
"@eslint/config-inspector": "3.0.4",
|
|
90
90
|
"@prettier/plugin-xml": "3.4.2",
|
|
91
|
-
"@types/node": "
|
|
92
|
-
"@unocss/eslint-plugin": "66.
|
|
93
|
-
"bumpp": "11.0
|
|
94
|
-
"eslint": "10.
|
|
91
|
+
"@types/node": "26.1.1",
|
|
92
|
+
"@unocss/eslint-plugin": "66.7.5",
|
|
93
|
+
"bumpp": "11.1.0",
|
|
94
|
+
"eslint": "10.6.0",
|
|
95
95
|
"eslint-plugin-vuejs-accessibility": "2.5.0",
|
|
96
96
|
"eslint-typegen": "2.3.1",
|
|
97
97
|
"execa": "9.6.1",
|
|
98
|
-
"lint-staged": "
|
|
99
|
-
"pnpm-workspace-yaml": "1.6.
|
|
98
|
+
"lint-staged": "17.0.8",
|
|
99
|
+
"pnpm-workspace-yaml": "1.6.1",
|
|
100
100
|
"prettier-plugin-slidev": "1.0.5",
|
|
101
|
-
"react": "19.2.
|
|
101
|
+
"react": "19.2.7",
|
|
102
102
|
"simple-git-hooks": "2.13.1",
|
|
103
|
-
"tinyglobby": "0.2.
|
|
104
|
-
"tsdown": "0.
|
|
105
|
-
"tsx": "4.
|
|
103
|
+
"tinyglobby": "0.2.17",
|
|
104
|
+
"tsdown": "0.22.4",
|
|
105
|
+
"tsx": "4.23.0",
|
|
106
106
|
"typescript": "6.0.3",
|
|
107
|
-
"vitest": "4.1.
|
|
108
|
-
"vue": "3.5.
|
|
109
|
-
"@liwo/eslint-config": "0.
|
|
107
|
+
"vitest": "4.1.10",
|
|
108
|
+
"vue": "3.5.39",
|
|
109
|
+
"@liwo/eslint-config": "0.3.0"
|
|
110
110
|
},
|
|
111
111
|
"simple-git-hooks": {
|
|
112
112
|
"pre-commit": "npx lint-staged"
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"build": "pnpm run gen && tsdown --clean --dts",
|
|
119
119
|
"stub": "tsdown",
|
|
120
120
|
"dev": "npx @eslint/config-inspector --config eslint.config.ts",
|
|
121
|
-
"build:inspector": "pnpm build && npx @eslint/config-inspector build && tsx scripts/fixed-netlify.ts",
|
|
121
|
+
"build:inspector": "pnpm build && npx @eslint/config-inspector build --outDir .eslint-config-inspector && tsx scripts/fixed-netlify.ts",
|
|
122
122
|
"watch": "tsdown --watch",
|
|
123
123
|
"lint": "eslint",
|
|
124
124
|
"format": "eslint --fix .",
|