@ncontiero/eslint-config 7.2.0 → 7.3.0-beta.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.mts +514 -850
- package/dist/index.mjs +54 -151
- package/package.json +28 -27
package/dist/index.mjs
CHANGED
|
@@ -760,12 +760,11 @@ const ReactRouterPackages = [
|
|
|
760
760
|
];
|
|
761
761
|
const NextJsPackages = ["next"];
|
|
762
762
|
async function react(options = {}) {
|
|
763
|
-
const { files = [GLOB_REACT], overrides = {}, reactQuery
|
|
763
|
+
const { files = [GLOB_REACT], overrides = {}, reactQuery } = options;
|
|
764
764
|
if (reactQuery) ensurePackages(["@tanstack/eslint-plugin-query"]);
|
|
765
|
-
const [pluginA11y, pluginReact,
|
|
765
|
+
const [pluginA11y, pluginReact, pluginReactRefresh] = await Promise.all([
|
|
766
766
|
interopDefault(import("eslint-plugin-jsx-a11y")),
|
|
767
|
-
interopDefault(import("eslint-plugin
|
|
768
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
767
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
769
768
|
interopDefault(import("eslint-plugin-react-refresh"))
|
|
770
769
|
]);
|
|
771
770
|
const isAllowConstantExport = ReactRefreshAllowPackages.some((i) => isPackageExists(i));
|
|
@@ -773,15 +772,12 @@ async function react(options = {}) {
|
|
|
773
772
|
const isUsingNextJs = NextJsPackages.some((i) => isPackageExists(i));
|
|
774
773
|
return [
|
|
775
774
|
{
|
|
776
|
-
files,
|
|
777
775
|
name: "ncontiero/react/setup",
|
|
778
776
|
plugins: {
|
|
779
777
|
"jsx-a11y": pluginA11y,
|
|
780
778
|
react: pluginReact,
|
|
781
|
-
"react-hooks": pluginReactHooks,
|
|
782
779
|
"react-refresh": pluginReactRefresh
|
|
783
|
-
}
|
|
784
|
-
settings: { react: { version: "detect" } }
|
|
780
|
+
}
|
|
785
781
|
},
|
|
786
782
|
reactQuery ? {
|
|
787
783
|
...(await interopDefault(import("@tanstack/eslint-plugin-query"))).configs["flat/recommended"][0],
|
|
@@ -789,149 +785,13 @@ async function react(options = {}) {
|
|
|
789
785
|
} : {},
|
|
790
786
|
{
|
|
791
787
|
files,
|
|
792
|
-
languageOptions: {
|
|
788
|
+
languageOptions: {
|
|
789
|
+
parserOptions: { ecmaFeatures: { jsx: true } },
|
|
790
|
+
sourceType: "module"
|
|
791
|
+
},
|
|
793
792
|
name: "ncontiero/react/rules",
|
|
794
793
|
rules: {
|
|
795
|
-
|
|
796
|
-
"react-hooks/error-boundaries": "warn",
|
|
797
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
798
|
-
"react-hooks/globals": "warn",
|
|
799
|
-
"react-hooks/immutability": "warn",
|
|
800
|
-
"react-hooks/incompatible-library": "warn",
|
|
801
|
-
"react-hooks/preserve-manual-memoization": "warn",
|
|
802
|
-
"react-hooks/purity": "warn",
|
|
803
|
-
"react-hooks/refs": "warn",
|
|
804
|
-
"react-hooks/rules-of-hooks": "error",
|
|
805
|
-
"react-hooks/set-state-in-effect": "warn",
|
|
806
|
-
"react-hooks/set-state-in-render": "warn",
|
|
807
|
-
"react-hooks/static-components": "warn",
|
|
808
|
-
"react-hooks/unsupported-syntax": "warn",
|
|
809
|
-
"react-hooks/use-memo": "warn",
|
|
810
|
-
"react-refresh/only-export-components": ["warn", {
|
|
811
|
-
allowConstantExport: isAllowConstantExport,
|
|
812
|
-
allowExportNames: [...isUsingNextJs ? [
|
|
813
|
-
"experimental_ppr",
|
|
814
|
-
"dynamic",
|
|
815
|
-
"dynamicParams",
|
|
816
|
-
"revalidate",
|
|
817
|
-
"fetchCache",
|
|
818
|
-
"runtime",
|
|
819
|
-
"preferredRegion",
|
|
820
|
-
"maxDuration",
|
|
821
|
-
"metadata",
|
|
822
|
-
"generateMetadata",
|
|
823
|
-
"viewport",
|
|
824
|
-
"generateViewport",
|
|
825
|
-
"generateImageMetadata",
|
|
826
|
-
"generateSitemaps",
|
|
827
|
-
"generateStaticParams"
|
|
828
|
-
] : [], ...isUsingReactRouter ? [
|
|
829
|
-
"meta",
|
|
830
|
-
"links",
|
|
831
|
-
"headers",
|
|
832
|
-
"loader",
|
|
833
|
-
"action",
|
|
834
|
-
"clientLoader",
|
|
835
|
-
"clientAction",
|
|
836
|
-
"handle",
|
|
837
|
-
"shouldRevalidate"
|
|
838
|
-
] : []]
|
|
839
|
-
}],
|
|
840
|
-
"react/boolean-prop-naming": ["off", {
|
|
841
|
-
rule: "^(is|has|are|can|should|did|will)[A-Z]([A-Za-z0-9])+",
|
|
842
|
-
validateNested: true
|
|
843
|
-
}],
|
|
844
|
-
"react/button-has-type": ["error", {
|
|
845
|
-
button: true,
|
|
846
|
-
reset: false,
|
|
847
|
-
submit: true
|
|
848
|
-
}],
|
|
849
|
-
"react/display-name": ["error", { ignoreTranspilerName: false }],
|
|
850
|
-
"react/hook-use-state": ["error"],
|
|
851
|
-
"react/iframe-missing-sandbox": ["error"],
|
|
852
|
-
"react/jsx-boolean-value": ["error", "never"],
|
|
853
|
-
"react/jsx-filename-extension": ["warn", { extensions: [".tsx"] }],
|
|
854
|
-
"react/jsx-fragments": ["error", "syntax"],
|
|
855
|
-
"react/jsx-handler-names": ["error", {
|
|
856
|
-
eventHandlerPrefix: "handle",
|
|
857
|
-
eventHandlerPropPrefix: "on"
|
|
858
|
-
}],
|
|
859
|
-
"react/jsx-key": ["error", {
|
|
860
|
-
checkFragmentShorthand: true,
|
|
861
|
-
checkKeyMustBeforeSpread: true,
|
|
862
|
-
warnOnDuplicates: true
|
|
863
|
-
}],
|
|
864
|
-
"react/jsx-no-bind": ["error", { allowArrowFunctions: true }],
|
|
865
|
-
"react/jsx-no-comment-textnodes": "error",
|
|
866
|
-
"react/jsx-no-constructed-context-values": "error",
|
|
867
|
-
"react/jsx-no-duplicate-props": ["error"],
|
|
868
|
-
"react/jsx-no-leaked-render": ["error"],
|
|
869
|
-
"react/jsx-no-script-url": ["error", [{
|
|
870
|
-
name: "Link",
|
|
871
|
-
props: ["to"]
|
|
872
|
-
}]],
|
|
873
|
-
"react/jsx-no-target-blank": ["error", {
|
|
874
|
-
forms: true,
|
|
875
|
-
links: true,
|
|
876
|
-
warnOnSpreadAttributes: true
|
|
877
|
-
}],
|
|
878
|
-
"react/jsx-no-undef": "error",
|
|
879
|
-
"react/jsx-no-useless-fragment": "error",
|
|
880
|
-
"react/jsx-uses-react": "error",
|
|
881
|
-
"react/jsx-uses-vars": "error",
|
|
882
|
-
"react/no-access-state-in-setstate": "error",
|
|
883
|
-
"react/no-array-index-key": "error",
|
|
884
|
-
"react/no-arrow-function-lifecycle": "error",
|
|
885
|
-
"react/no-children-prop": "error",
|
|
886
|
-
"react/no-danger": "error",
|
|
887
|
-
"react/no-danger-with-children": "error",
|
|
888
|
-
"react/no-deprecated": "error",
|
|
889
|
-
"react/no-did-update-set-state": "error",
|
|
890
|
-
"react/no-direct-mutation-state": "error",
|
|
891
|
-
"react/no-find-dom-node": "error",
|
|
892
|
-
"react/no-invalid-html-attribute": "error",
|
|
893
|
-
"react/no-is-mounted": "error",
|
|
894
|
-
"react/no-namespace": "error",
|
|
895
|
-
"react/no-object-type-as-default-prop": "error",
|
|
896
|
-
"react/no-redundant-should-component-update": "error",
|
|
897
|
-
"react/no-render-return-value": "error",
|
|
898
|
-
"react/no-string-refs": ["error", { noTemplateLiterals: true }],
|
|
899
|
-
"react/no-this-in-sfc": ["error"],
|
|
900
|
-
"react/no-typos": ["error"],
|
|
901
|
-
"react/no-unescaped-entities": "error",
|
|
902
|
-
"react/no-unknown-property": "error",
|
|
903
|
-
"react/no-unstable-nested-components": ["error"],
|
|
904
|
-
"react/no-unused-class-component-methods": ["error"],
|
|
905
|
-
"react/no-unused-prop-types": ["error", {
|
|
906
|
-
customValidators: [],
|
|
907
|
-
skipShapeProps: true
|
|
908
|
-
}],
|
|
909
|
-
"react/no-unused-state": ["error"],
|
|
910
|
-
"react/no-will-update-set-state": ["error"],
|
|
911
|
-
"react/prefer-es6-class": ["error", "always"],
|
|
912
|
-
"react/prefer-exact-props": ["error"],
|
|
913
|
-
"react/prefer-read-only-props": ["error"],
|
|
914
|
-
"react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
|
|
915
|
-
"react/prop-types": ["error", {
|
|
916
|
-
customValidators: [],
|
|
917
|
-
ignore: [],
|
|
918
|
-
skipUndeclared: false
|
|
919
|
-
}],
|
|
920
|
-
"react/react-in-jsx-scope": "off",
|
|
921
|
-
"react/require-render-return": "error",
|
|
922
|
-
"react/self-closing-comp": ["error", {
|
|
923
|
-
component: true,
|
|
924
|
-
html: true
|
|
925
|
-
}],
|
|
926
|
-
"react/sort-default-props": ["error"],
|
|
927
|
-
"react/state-in-constructor": ["error", "never"],
|
|
928
|
-
"react/static-property-placement": ["error", "property assignment"],
|
|
929
|
-
"react/style-prop-object": ["error", { allow: ["FormattedNumber"] }],
|
|
930
|
-
"react/void-dom-elements-no-children": ["error"],
|
|
931
|
-
...typescript ? {
|
|
932
|
-
"react/jsx-no-undef": "off",
|
|
933
|
-
"react/prop-types": "off"
|
|
934
|
-
} : {},
|
|
794
|
+
...pluginReact.configs.recommended.rules,
|
|
935
795
|
"jsx-a11y/alt-text": ["warn", {
|
|
936
796
|
area: [],
|
|
937
797
|
elements: [
|
|
@@ -1058,6 +918,50 @@ async function react(options = {}) {
|
|
|
1058
918
|
"jsx-a11y/role-supports-aria-props": ["warn"],
|
|
1059
919
|
"jsx-a11y/scope": ["warn"],
|
|
1060
920
|
"jsx-a11y/tabindex-no-positive": ["warn"],
|
|
921
|
+
"react-refresh/only-export-components": ["warn", {
|
|
922
|
+
allowConstantExport: isAllowConstantExport,
|
|
923
|
+
allowExportNames: [...isUsingNextJs ? [
|
|
924
|
+
"experimental_ppr",
|
|
925
|
+
"dynamic",
|
|
926
|
+
"dynamicParams",
|
|
927
|
+
"revalidate",
|
|
928
|
+
"fetchCache",
|
|
929
|
+
"runtime",
|
|
930
|
+
"preferredRegion",
|
|
931
|
+
"maxDuration",
|
|
932
|
+
"metadata",
|
|
933
|
+
"generateMetadata",
|
|
934
|
+
"viewport",
|
|
935
|
+
"generateViewport",
|
|
936
|
+
"generateImageMetadata",
|
|
937
|
+
"generateSitemaps",
|
|
938
|
+
"generateStaticParams"
|
|
939
|
+
] : [], ...isUsingReactRouter ? [
|
|
940
|
+
"meta",
|
|
941
|
+
"links",
|
|
942
|
+
"headers",
|
|
943
|
+
"loader",
|
|
944
|
+
"action",
|
|
945
|
+
"clientLoader",
|
|
946
|
+
"clientAction",
|
|
947
|
+
"handle",
|
|
948
|
+
"shouldRevalidate"
|
|
949
|
+
] : []]
|
|
950
|
+
}],
|
|
951
|
+
"react/dom-no-missing-button-type": "warn",
|
|
952
|
+
"react/dom-no-missing-iframe-sandbox": "warn",
|
|
953
|
+
"react/dom-no-unknown-property": "warn",
|
|
954
|
+
"react/dom-no-unsafe-target-blank": "warn",
|
|
955
|
+
"react/globals": "warn",
|
|
956
|
+
"react/immutability": "warn",
|
|
957
|
+
"react/jsx-no-useless-fragment": "warn",
|
|
958
|
+
"react/no-duplicate-key": "warn",
|
|
959
|
+
"react/no-leaked-conditional-rendering": "error",
|
|
960
|
+
"react/no-missing-component-display-name": "warn",
|
|
961
|
+
"react/no-unstable-context-value": "warn",
|
|
962
|
+
"react/no-unstable-default-props": "error",
|
|
963
|
+
"react/no-unused-props": "warn",
|
|
964
|
+
"react/refs": "warn",
|
|
1061
965
|
...overrides
|
|
1062
966
|
}
|
|
1063
967
|
}
|
|
@@ -1714,8 +1618,7 @@ function ncontiero(options = {}, ...userConfigs) {
|
|
|
1714
1618
|
if (enableRegexp) configs.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
1715
1619
|
if (enableReact) configs.push(react({
|
|
1716
1620
|
overrides: getOverrides(options, "react"),
|
|
1717
|
-
reactQuery: !!enableTanStackReactQuery
|
|
1718
|
-
typescript: !!enableTypescript
|
|
1621
|
+
reactQuery: !!enableTanStackReactQuery
|
|
1719
1622
|
}));
|
|
1720
1623
|
if (enableNextJs) configs.push(nextJs({ overrides: getOverrides(options, "nextjs") }));
|
|
1721
1624
|
if (options.html ?? true) configs.push(html({
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ncontiero/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.3.0-beta.0",
|
|
5
|
+
"packageManager": "pnpm@10.33.2",
|
|
5
6
|
"description": "Nicolas's ESLint config.",
|
|
6
7
|
"author": {
|
|
7
8
|
"name": "Nicolas Contiero",
|
|
@@ -27,6 +28,19 @@
|
|
|
27
28
|
"publishConfig": {
|
|
28
29
|
"access": "public"
|
|
29
30
|
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "pnpm typegen && tsdown",
|
|
33
|
+
"dev": "pnpm dlx @eslint/config-inspector --config eslint-inspector.config.ts",
|
|
34
|
+
"build:inspector": "pnpm build && pnpm dlx @eslint/config-inspector build --config eslint-inspector.config.ts",
|
|
35
|
+
"typegen": "tsx scripts/typegen.ts",
|
|
36
|
+
"test": "vitest",
|
|
37
|
+
"lint": "eslint .",
|
|
38
|
+
"lint:fix": "pnpm lint --fix",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"check": "pnpm lint && pnpm typecheck",
|
|
41
|
+
"release": "changeset publish",
|
|
42
|
+
"prepare": "husky"
|
|
43
|
+
},
|
|
30
44
|
"peerDependencies": {
|
|
31
45
|
"@tanstack/eslint-plugin-query": ">=5.50.0",
|
|
32
46
|
"eslint": ">=9.20.0"
|
|
@@ -38,12 +52,13 @@
|
|
|
38
52
|
},
|
|
39
53
|
"dependencies": {
|
|
40
54
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
55
|
+
"@eslint-react/eslint-plugin": "^4.2.3",
|
|
41
56
|
"@eslint/markdown": "^8.0.1",
|
|
42
57
|
"@html-eslint/eslint-plugin": "^0.59.0",
|
|
43
58
|
"@html-eslint/parser": "^0.59.0",
|
|
44
59
|
"@next/eslint-plugin-next": "^16.2.4",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
46
|
-
"@typescript-eslint/parser": "^8.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
61
|
+
"@typescript-eslint/parser": "^8.59.0",
|
|
47
62
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
48
63
|
"eslint-merge-processors": "^2.0.0",
|
|
49
64
|
"eslint-plugin-antfu": "^3.2.2",
|
|
@@ -55,11 +70,9 @@
|
|
|
55
70
|
"eslint-plugin-jsonc": "^3.1.2",
|
|
56
71
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
57
72
|
"eslint-plugin-n": "^17.24.0",
|
|
58
|
-
"eslint-plugin-perfectionist": "^5.
|
|
73
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
59
74
|
"eslint-plugin-prettier": "^5.5.5",
|
|
60
75
|
"eslint-plugin-promise": "^7.2.1",
|
|
61
|
-
"eslint-plugin-react": "^7.37.5",
|
|
62
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
63
76
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
64
77
|
"eslint-plugin-regexp": "^3.1.0",
|
|
65
78
|
"eslint-plugin-toml": "^1.3.1",
|
|
@@ -73,24 +86,24 @@
|
|
|
73
86
|
"yaml-eslint-parser": "^2.0.0"
|
|
74
87
|
},
|
|
75
88
|
"devDependencies": {
|
|
76
|
-
"@changesets/cli": "^2.
|
|
89
|
+
"@changesets/cli": "^2.31.0",
|
|
77
90
|
"@commitlint/cli": "^20.5.0",
|
|
78
91
|
"@commitlint/config-conventional": "^20.5.0",
|
|
79
|
-
"@ncontiero/changelog-github": "^2.1.
|
|
92
|
+
"@ncontiero/changelog-github": "^2.1.3",
|
|
80
93
|
"@ncontiero/prettier-config": "^1.0.0",
|
|
81
|
-
"@tanstack/eslint-plugin-query": "^5.
|
|
94
|
+
"@tanstack/eslint-plugin-query": "^5.100.1",
|
|
82
95
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
83
96
|
"@types/node": "^25.6.0",
|
|
84
|
-
"eslint": "^10.2.
|
|
97
|
+
"eslint": "^10.2.1",
|
|
85
98
|
"eslint-typegen": "^2.3.1",
|
|
86
99
|
"execa": "^9.6.1",
|
|
87
100
|
"husky": "^9.1.7",
|
|
88
101
|
"lint-staged": "^16.4.0",
|
|
89
102
|
"tinyglobby": "^0.2.16",
|
|
90
|
-
"tsdown": "^0.21.
|
|
103
|
+
"tsdown": "^0.21.10",
|
|
91
104
|
"tsx": "^4.21.0",
|
|
92
|
-
"typescript": "^6.0.
|
|
93
|
-
"vitest": "^4.1.
|
|
105
|
+
"typescript": "^6.0.3",
|
|
106
|
+
"vitest": "^4.1.5"
|
|
94
107
|
},
|
|
95
108
|
"engines": {
|
|
96
109
|
"node": ">=20.19.0"
|
|
@@ -98,17 +111,5 @@
|
|
|
98
111
|
"lint-staged": {
|
|
99
112
|
"*": "pnpm lint:fix"
|
|
100
113
|
},
|
|
101
|
-
"prettier": "@ncontiero/prettier-config"
|
|
102
|
-
|
|
103
|
-
"build": "pnpm typegen && tsdown",
|
|
104
|
-
"dev": "pnpm dlx @eslint/config-inspector --config eslint-inspector.config.ts",
|
|
105
|
-
"build:inspector": "pnpm build && pnpm dlx @eslint/config-inspector build --config eslint-inspector.config.ts",
|
|
106
|
-
"typegen": "tsx scripts/typegen.ts",
|
|
107
|
-
"test": "vitest",
|
|
108
|
-
"lint": "eslint .",
|
|
109
|
-
"lint:fix": "pnpm lint --fix",
|
|
110
|
-
"typecheck": "tsc --noEmit",
|
|
111
|
-
"check": "pnpm lint && pnpm typecheck",
|
|
112
|
-
"release": "changeset publish"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
114
|
+
"prettier": "@ncontiero/prettier-config"
|
|
115
|
+
}
|