@zayne-labs/eslint-config 0.9.17 → 0.10.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/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +357 -320
- package/dist/index.js +68 -59
- package/dist/index.js.map +1 -1
- package/dist/src-DwSufEpw.js +1769 -0
- package/dist/src-DwSufEpw.js.map +1 -0
- package/package.json +46 -42
package/dist/index.js
CHANGED
|
@@ -973,7 +973,7 @@ const defaultPluginRenameMap = defineEnum({
|
|
|
973
973
|
"@eslint-react/hooks-extra": "react-hooks-extra",
|
|
974
974
|
"@eslint-react/naming-convention": "react-naming-convention",
|
|
975
975
|
"@eslint-react/web-api": "react-web-api",
|
|
976
|
-
"@eslint-react": "react",
|
|
976
|
+
"@eslint-react": "react-x",
|
|
977
977
|
"@next/next": "nextjs",
|
|
978
978
|
"@stylistic": "stylistic",
|
|
979
979
|
"@tanstack/query": "tanstack-query",
|
|
@@ -1024,72 +1024,71 @@ const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) =
|
|
|
1024
1024
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
1025
1025
|
const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
|
|
1026
1026
|
const react = async (options = {}) => {
|
|
1027
|
-
const { compiler = false, files = [GLOB_SRC], nextjs = isUsingNext, overrides, react: enableReact = true, refresh = true, typescript: typescript$1 = true } = options;
|
|
1027
|
+
const { compiler = false, files = [GLOB_SRC], filesTypeAware = [GLOB_TS, GLOB_TSX], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], nextjs = isUsingNext, overrides, react: enableReact = true, refresh = true, typescript: typescript$1 = true, youMightNotNeedAnEffect = true } = options;
|
|
1028
1028
|
await ensurePackages([
|
|
1029
1029
|
"@eslint-react/eslint-plugin",
|
|
1030
1030
|
"eslint-plugin-react-hooks",
|
|
1031
1031
|
refresh ? "eslint-plugin-react-refresh" : void 0,
|
|
1032
|
+
youMightNotNeedAnEffect ? "eslint-plugin-react-you-might-not-need-an-effect" : void 0,
|
|
1032
1033
|
nextjs ? "@next/eslint-plugin-next" : void 0
|
|
1033
1034
|
]);
|
|
1034
|
-
const [eslintPluginReact, eslintReactHooks, eslintPluginReactRefresh, eslintPluginNextjs] = await Promise.all([
|
|
1035
|
+
const [eslintPluginReact, eslintReactHooks, eslintPluginReactRefresh, eslintPluginReactYouMightNotNeedAnEffect, eslintPluginNextjs] = await Promise.all([
|
|
1035
1036
|
enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
|
|
1036
1037
|
enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
|
|
1037
1038
|
refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
|
|
1039
|
+
youMightNotNeedAnEffect ? interopDefault(import("./src-DwSufEpw.js")) : void 0,
|
|
1038
1040
|
nextjs ? interopDefault(import("@next/eslint-plugin-next")) : void 0
|
|
1039
1041
|
]);
|
|
1040
1042
|
const recommendedReactConfig = eslintPluginReact?.configs[typescript$1 ? "recommended-type-checked" : "recommended"];
|
|
1041
1043
|
const config = [];
|
|
1042
1044
|
if (enableReact && recommendedReactConfig && eslintReactHooks) config.push({
|
|
1045
|
+
files,
|
|
1046
|
+
languageOptions: { parserOptions: {
|
|
1047
|
+
ecmaFeatures: { jsx: true },
|
|
1048
|
+
sourceType: "module"
|
|
1049
|
+
} },
|
|
1043
1050
|
name: "zayne/react/setup",
|
|
1044
1051
|
plugins: {
|
|
1045
1052
|
...renamePlugins(recommendedReactConfig.plugins, defaultPluginRenameMap),
|
|
1046
|
-
"react-hooks": eslintReactHooks
|
|
1053
|
+
"react-hooks": eslintReactHooks,
|
|
1054
|
+
"react-you-might-not-need-an-effect": eslintPluginReactYouMightNotNeedAnEffect
|
|
1047
1055
|
},
|
|
1048
1056
|
settings: recommendedReactConfig.settings
|
|
1049
1057
|
}, {
|
|
1050
|
-
files,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
sourceType: "module",
|
|
1054
|
-
...typescript$1 && { parser: (await interopDefault(import("typescript-eslint"))).parser }
|
|
1055
|
-
} },
|
|
1056
|
-
name: "zayne/react/setup-processor"
|
|
1057
|
-
}, {
|
|
1058
|
-
files,
|
|
1059
|
-
name: "zayne/react/recommended",
|
|
1058
|
+
files: typescript$1 ? filesTypeAware : files,
|
|
1059
|
+
...typescript$1 && { ignores: ignoresTypeAware },
|
|
1060
|
+
name: `zayne/react/${typescript$1 ? "recommended-type-checked" : "recommended"}`,
|
|
1060
1061
|
rules: renameRules(recommendedReactConfig.rules, defaultPluginRenameMap)
|
|
1061
1062
|
}, {
|
|
1062
1063
|
files,
|
|
1063
1064
|
name: "zayne/react/rules",
|
|
1064
1065
|
rules: {
|
|
1065
|
-
"react-hooks-extra/no-unnecessary-use-callback": "warn",
|
|
1066
|
-
"react-hooks-extra/no-unnecessary-use-memo": "warn",
|
|
1067
|
-
"react-hooks-extra/no-unnecessary-use-prefix": "error",
|
|
1068
|
-
"react-hooks-extra/prefer-use-state-lazy-initialization": "error",
|
|
1069
1066
|
"react-hooks/exhaustive-deps": "warn",
|
|
1070
1067
|
"react-hooks/rules-of-hooks": "error",
|
|
1071
1068
|
"react-naming-convention/component-name": "warn",
|
|
1072
1069
|
"react-naming-convention/use-state": "off",
|
|
1073
|
-
"react/
|
|
1074
|
-
"react/
|
|
1075
|
-
"react/no-array-index-key": "error",
|
|
1076
|
-
"react/no-children-count": "off",
|
|
1077
|
-
"react/no-children-only": "off",
|
|
1078
|
-
"react/no-children-prop": "error",
|
|
1079
|
-
"react/no-clone-element": "off",
|
|
1080
|
-
"react/no-
|
|
1081
|
-
"react/no-
|
|
1082
|
-
"react/no-
|
|
1083
|
-
"react/
|
|
1084
|
-
"react/
|
|
1085
|
-
"react/prefer-
|
|
1070
|
+
"react-x/jsx-shorthand-boolean": "error",
|
|
1071
|
+
"react-x/jsx-shorthand-fragment": "error",
|
|
1072
|
+
"react-x/no-array-index-key": "error",
|
|
1073
|
+
"react-x/no-children-count": "off",
|
|
1074
|
+
"react-x/no-children-only": "off",
|
|
1075
|
+
"react-x/no-children-prop": "error",
|
|
1076
|
+
"react-x/no-clone-element": "off",
|
|
1077
|
+
"react-x/no-missing-component-display-name": "error",
|
|
1078
|
+
"react-x/no-unnecessary-use-callback": "warn",
|
|
1079
|
+
"react-x/no-unnecessary-use-memo": "warn",
|
|
1080
|
+
"react-x/no-unnecessary-use-prefix": "error",
|
|
1081
|
+
"react-x/no-useless-fragment": "error",
|
|
1082
|
+
"react-x/prefer-destructuring-assignment": "error",
|
|
1083
|
+
"react-x/prefer-read-only-props": "off",
|
|
1084
|
+
"react-x/prefer-use-state-lazy-initialization": "error",
|
|
1086
1085
|
...overrides,
|
|
1087
1086
|
...isObject$1(enableReact) && enableReact.overrides
|
|
1088
1087
|
}
|
|
1089
1088
|
});
|
|
1090
1089
|
if (refresh && eslintPluginReactRefresh) config.push({
|
|
1091
1090
|
files,
|
|
1092
|
-
name: "zayne/react/refresh",
|
|
1091
|
+
name: "zayne/react/refresh/rules",
|
|
1093
1092
|
plugins: { "react-refresh": eslintPluginReactRefresh },
|
|
1094
1093
|
rules: {
|
|
1095
1094
|
"react-refresh/only-export-components": ["warn", {
|
|
@@ -1100,9 +1099,22 @@ const react = async (options = {}) => {
|
|
|
1100
1099
|
...isObject$1(refresh) && refresh.overrides
|
|
1101
1100
|
}
|
|
1102
1101
|
});
|
|
1102
|
+
if (youMightNotNeedAnEffect && eslintPluginReactYouMightNotNeedAnEffect) config.push({
|
|
1103
|
+
files,
|
|
1104
|
+
name: "zayne/react/you-might-not-need-an-effect/recommended",
|
|
1105
|
+
plugins: { "react-you-might-not-need-an-effect": eslintPluginReactYouMightNotNeedAnEffect },
|
|
1106
|
+
rules: eslintPluginReactYouMightNotNeedAnEffect.configs.recommended.rules
|
|
1107
|
+
}, {
|
|
1108
|
+
files,
|
|
1109
|
+
name: "zayne/react/you-might-not-need-an-effect/rules",
|
|
1110
|
+
rules: {
|
|
1111
|
+
...overrides,
|
|
1112
|
+
...isObject$1(youMightNotNeedAnEffect) && youMightNotNeedAnEffect.overrides
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1103
1115
|
if (compiler) config.push({
|
|
1104
1116
|
files,
|
|
1105
|
-
name: "zayne/react/compiler",
|
|
1117
|
+
name: "zayne/react/compiler/rules",
|
|
1106
1118
|
rules: {
|
|
1107
1119
|
"react-hooks/react-compiler": "error",
|
|
1108
1120
|
...overrides,
|
|
@@ -1111,14 +1123,19 @@ const react = async (options = {}) => {
|
|
|
1111
1123
|
});
|
|
1112
1124
|
if (nextjs && eslintPluginNextjs) config.push({
|
|
1113
1125
|
files,
|
|
1114
|
-
name: "zayne/react/nextjs",
|
|
1126
|
+
name: "zayne/react/nextjs/recommended",
|
|
1115
1127
|
plugins: { nextjs: eslintPluginNextjs },
|
|
1116
1128
|
rules: renameRules({
|
|
1117
1129
|
...eslintPluginNextjs.configs?.recommended?.rules,
|
|
1118
|
-
...eslintPluginNextjs.configs?.["core-web-vitals"]?.rules
|
|
1130
|
+
...eslintPluginNextjs.configs?.["core-web-vitals"]?.rules
|
|
1131
|
+
}, defaultPluginRenameMap)
|
|
1132
|
+
}, {
|
|
1133
|
+
files,
|
|
1134
|
+
name: "zayne/react/nextjs/rules",
|
|
1135
|
+
rules: {
|
|
1119
1136
|
...overrides,
|
|
1120
1137
|
...isObject$1(nextjs) && nextjs.overrides
|
|
1121
|
-
}
|
|
1138
|
+
}
|
|
1122
1139
|
});
|
|
1123
1140
|
return config;
|
|
1124
1141
|
};
|
|
@@ -1537,7 +1554,7 @@ const typescript = async (options = {}) => {
|
|
|
1537
1554
|
GLOB_TS,
|
|
1538
1555
|
GLOB_TSX,
|
|
1539
1556
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1540
|
-
], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], tsconfigPath = true, isTypeAware = Boolean(tsconfigPath), overrides,
|
|
1557
|
+
], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], tsconfigPath = true, isTypeAware = Boolean(tsconfigPath), overrides, parserOptions, stylistic: stylistic$1 = true } = options;
|
|
1541
1558
|
const tsEslint = await interopDefault(import("typescript-eslint"));
|
|
1542
1559
|
const projectServiceObject = isTypeAware && (allowDefaultProject ? {
|
|
1543
1560
|
projectService: {
|
|
@@ -1578,14 +1595,13 @@ const typescript = async (options = {}) => {
|
|
|
1578
1595
|
};
|
|
1579
1596
|
return [
|
|
1580
1597
|
{
|
|
1581
|
-
name: `zayne/ts-eslint/${isTypeAware ? "type-aware
|
|
1582
|
-
...makeParser(files)
|
|
1583
|
-
...isTypeAware && makeParser(filesTypeAware, ignoresTypeAware)
|
|
1598
|
+
name: `zayne/ts-eslint/${isTypeAware ? "setup-type-aware" : "setup"}`,
|
|
1599
|
+
...isTypeAware ? makeParser(filesTypeAware, ignoresTypeAware) : makeParser(files)
|
|
1584
1600
|
},
|
|
1585
1601
|
...renamePluginInConfigs({
|
|
1586
1602
|
configArray: tsEslint.configs[selectedBaseRuleSet],
|
|
1587
1603
|
overrides: {
|
|
1588
|
-
files,
|
|
1604
|
+
files: isTypeAware ? filesTypeAware : files,
|
|
1589
1605
|
name: `zayne/ts-eslint/${selectedBaseRuleSet}`
|
|
1590
1606
|
},
|
|
1591
1607
|
renameMap: { "@typescript-eslint": "ts-eslint" }
|
|
@@ -1593,13 +1609,13 @@ const typescript = async (options = {}) => {
|
|
|
1593
1609
|
...stylistic$1 ? renamePluginInConfigs({
|
|
1594
1610
|
configArray: tsEslint.configs[selectedStylisticRuleSet],
|
|
1595
1611
|
overrides: {
|
|
1596
|
-
files,
|
|
1612
|
+
files: isTypeAware ? filesTypeAware : files,
|
|
1597
1613
|
name: `zayne/ts-eslint/${selectedStylisticRuleSet}`
|
|
1598
1614
|
},
|
|
1599
1615
|
renameMap: { "@typescript-eslint": "ts-eslint" }
|
|
1600
1616
|
}) : [],
|
|
1601
1617
|
{
|
|
1602
|
-
files,
|
|
1618
|
+
files: isTypeAware ? filesTypeAware : files,
|
|
1603
1619
|
name: "zayne/ts-eslint/rules",
|
|
1604
1620
|
rules: {
|
|
1605
1621
|
"ts-eslint/array-type": ["error", { default: "array-simple" }],
|
|
@@ -1632,18 +1648,10 @@ const typescript = async (options = {}) => {
|
|
|
1632
1648
|
"ts-eslint/no-use-before-define": "off",
|
|
1633
1649
|
"ts-eslint/no-useless-constructor": "error",
|
|
1634
1650
|
"ts-eslint/no-useless-empty-export": "error",
|
|
1651
|
+
...isTypeAware && typeAwareRules,
|
|
1635
1652
|
...overrides
|
|
1636
1653
|
}
|
|
1637
|
-
}
|
|
1638
|
-
isTypeAware ? {
|
|
1639
|
-
files: filesTypeAware,
|
|
1640
|
-
ignores: ignoresTypeAware,
|
|
1641
|
-
name: "zayne/ts-eslint/rules-type-aware",
|
|
1642
|
-
rules: {
|
|
1643
|
-
...typeAwareRules,
|
|
1644
|
-
...overridesTypeAware
|
|
1645
|
-
}
|
|
1646
|
-
} : {}
|
|
1654
|
+
}
|
|
1647
1655
|
];
|
|
1648
1656
|
};
|
|
1649
1657
|
|
|
@@ -1685,10 +1693,11 @@ const vue = async (options = {}) => {
|
|
|
1685
1693
|
"vue-eslint-parser",
|
|
1686
1694
|
sfcBlocks ? "eslint-processor-vue-blocks" : void 0
|
|
1687
1695
|
]);
|
|
1688
|
-
const [pluginVue, parserVue, processorVueBlocks] = await Promise.all([
|
|
1696
|
+
const [pluginVue, parserVue, processorVueBlocks, tsEslint] = await Promise.all([
|
|
1689
1697
|
interopDefault(import("eslint-plugin-vue")),
|
|
1690
1698
|
interopDefault(import("vue-eslint-parser")),
|
|
1691
|
-
sfcBlocks ? interopDefault(import("eslint-processor-vue-blocks")) : void 0
|
|
1699
|
+
sfcBlocks ? interopDefault(import("eslint-processor-vue-blocks")) : void 0,
|
|
1700
|
+
typescript$1 ? interopDefault(import("typescript-eslint")) : void 0
|
|
1692
1701
|
]);
|
|
1693
1702
|
return [
|
|
1694
1703
|
{
|
|
@@ -1719,7 +1728,7 @@ const vue = async (options = {}) => {
|
|
|
1719
1728
|
ecmaFeatures: { jsx: true },
|
|
1720
1729
|
extraFileExtensions: [".vue"],
|
|
1721
1730
|
sourceType: "module",
|
|
1722
|
-
...typescript$1 && { parser:
|
|
1731
|
+
...typescript$1 && { parser: tsEslint?.parser }
|
|
1723
1732
|
}
|
|
1724
1733
|
},
|
|
1725
1734
|
name: "zayne/vue/setup/file-processor",
|
|
@@ -1943,8 +1952,8 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
1943
1952
|
componentExts,
|
|
1944
1953
|
isTypeAware,
|
|
1945
1954
|
stylistic: isStylistic,
|
|
1946
|
-
|
|
1947
|
-
|
|
1955
|
+
...resolveOptions(enableTypeScript),
|
|
1956
|
+
tsconfigPath
|
|
1948
1957
|
}));
|
|
1949
1958
|
if (enableStylistic) configs.push(stylistic({
|
|
1950
1959
|
jsx: enableJsx,
|
|
@@ -2002,7 +2011,7 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
2002
2011
|
typescript: isTypeAware,
|
|
2003
2012
|
...resolveOptions(restOfOptions.astro)
|
|
2004
2013
|
}));
|
|
2005
|
-
if (restOfOptions.expo) configs.push(expo());
|
|
2014
|
+
if (restOfOptions.expo) configs.push(expo(resolveOptions(restOfOptions.expo)));
|
|
2006
2015
|
if (restOfOptions.tailwindcssBetter) configs.push(tailwindcssBetter(resolveOptions(restOfOptions.tailwindcssBetter)));
|
|
2007
2016
|
if (restOfOptions.tanstack) configs.push(tanstack(resolveOptions(restOfOptions.tanstack)));
|
|
2008
2017
|
if (restOfOptions.depend) configs.push(depend(resolveOptions(restOfOptions.depend)));
|