@zayne-labs/eslint-config 0.10.3 → 0.10.4
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 +250 -3
- package/dist/index.js +60 -23
- package/dist/index.js.map +1 -1
- package/dist/{src-ZlDTU7nv.js → src-tkLps0qA.js} +26 -23
- package/dist/{src-ZlDTU7nv.js.map → src-tkLps0qA.js.map} +1 -1
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -1047,7 +1047,7 @@ const react = async (options = {}) => {
|
|
|
1047
1047
|
enableReact ? interopDefault(import("@eslint-react/eslint-plugin")) : void 0,
|
|
1048
1048
|
enableReact ? interopDefault(import("eslint-plugin-react-hooks")) : void 0,
|
|
1049
1049
|
refresh ? interopDefault(import("eslint-plugin-react-refresh")) : void 0,
|
|
1050
|
-
youMightNotNeedAnEffect ? interopDefault(import("./src-
|
|
1050
|
+
youMightNotNeedAnEffect ? interopDefault(import("./src-tkLps0qA.js")) : void 0,
|
|
1051
1051
|
nextjs ? interopDefault(import("@next/eslint-plugin-next")) : void 0
|
|
1052
1052
|
]);
|
|
1053
1053
|
const recommendedReactConfig = eslintPluginReact?.configs[typescript$1 ? "recommended-type-checked" : "recommended"];
|
|
@@ -1064,17 +1064,37 @@ const react = async (options = {}) => {
|
|
|
1064
1064
|
"react-you-might-not-need-an-effect": eslintPluginReactYouMightNotNeedAnEffect
|
|
1065
1065
|
},
|
|
1066
1066
|
settings: recommendedReactConfig.settings
|
|
1067
|
+
}, {
|
|
1068
|
+
files,
|
|
1069
|
+
name: "zayne/react/official/recommended",
|
|
1070
|
+
rules: {
|
|
1071
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1072
|
+
"react-hooks/rules-of-hooks": "error"
|
|
1073
|
+
}
|
|
1074
|
+
}, {
|
|
1075
|
+
files,
|
|
1076
|
+
name: "zayne/react/official/rules",
|
|
1077
|
+
rules: {
|
|
1078
|
+
"react-hooks/error-boundaries": "error",
|
|
1079
|
+
"react-hooks/globals": "error",
|
|
1080
|
+
"react-hooks/immutability": "error",
|
|
1081
|
+
"react-hooks/purity": "warn",
|
|
1082
|
+
"react-hooks/refs": "error",
|
|
1083
|
+
"react-hooks/set-state-in-effect": "warn",
|
|
1084
|
+
"react-hooks/set-state-in-render": "error",
|
|
1085
|
+
"react-hooks/static-components": "warn",
|
|
1086
|
+
"react-hooks/use-memo": "warn"
|
|
1087
|
+
}
|
|
1067
1088
|
}, {
|
|
1068
1089
|
files: typescript$1 ? filesTypeAware : files,
|
|
1069
1090
|
...typescript$1 && { ignores: ignoresTypeAware },
|
|
1070
|
-
name: `zayne/react/${typescript$1 ? "recommended-type-checked" : "recommended"}`,
|
|
1091
|
+
name: `zayne/react/unofficial/${typescript$1 ? "recommended-type-checked" : "recommended"}`,
|
|
1071
1092
|
rules: renameRules(recommendedReactConfig.rules, defaultPluginRenameMap)
|
|
1072
1093
|
}, {
|
|
1073
1094
|
files,
|
|
1074
|
-
name: "zayne/react/rules",
|
|
1095
|
+
name: "zayne/react/unofficial/rules",
|
|
1075
1096
|
rules: {
|
|
1076
|
-
"react-hooks/
|
|
1077
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1097
|
+
"react-hooks-extra/no-direct-set-state-in-use-effect": "off",
|
|
1078
1098
|
"react-naming-convention/component-name": "warn",
|
|
1079
1099
|
"react-naming-convention/use-state": "off",
|
|
1080
1100
|
"react-x/jsx-shorthand-boolean": ["error", -1],
|
|
@@ -1094,6 +1114,17 @@ const react = async (options = {}) => {
|
|
|
1094
1114
|
...isObject$1(enableReact) && enableReact.overrides
|
|
1095
1115
|
}
|
|
1096
1116
|
});
|
|
1117
|
+
if (compiler && eslintPluginReact) config.push({
|
|
1118
|
+
files,
|
|
1119
|
+
name: "zayne/react/compiler/rules",
|
|
1120
|
+
rules: {
|
|
1121
|
+
"react-hooks/config": "error",
|
|
1122
|
+
"react-hooks/gating": "error",
|
|
1123
|
+
"react-hooks/incompatible-library": "warn",
|
|
1124
|
+
"react-hooks/preserve-manual-memoization": "warn",
|
|
1125
|
+
"react-hooks/unsupported-syntax": "error"
|
|
1126
|
+
}
|
|
1127
|
+
});
|
|
1097
1128
|
if (refresh && eslintPluginReactRefresh) config.push({
|
|
1098
1129
|
files,
|
|
1099
1130
|
name: "zayne/react/refresh/rules",
|
|
@@ -1120,15 +1151,6 @@ const react = async (options = {}) => {
|
|
|
1120
1151
|
...isObject$1(youMightNotNeedAnEffect) && youMightNotNeedAnEffect.overrides
|
|
1121
1152
|
}
|
|
1122
1153
|
});
|
|
1123
|
-
if (compiler) config.push({
|
|
1124
|
-
files,
|
|
1125
|
-
name: "zayne/react/compiler/rules",
|
|
1126
|
-
rules: {
|
|
1127
|
-
"react-hooks/react-compiler": "error",
|
|
1128
|
-
...overrides,
|
|
1129
|
-
...isObject$1(compiler) && compiler.overrides
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
1154
|
if (nextjs && eslintPluginNextjs) config.push({
|
|
1133
1155
|
files,
|
|
1134
1156
|
name: "zayne/react/nextjs/recommended",
|
|
@@ -1554,14 +1576,14 @@ const toml = async (options = {}) => {
|
|
|
1554
1576
|
//#endregion
|
|
1555
1577
|
//#region src/configs/typescript.ts
|
|
1556
1578
|
const typescript = async (options = {}) => {
|
|
1557
|
-
const { allowDefaultProject, componentExts = [], files = [
|
|
1579
|
+
const { allowDefaultProject, componentExts = [], componentExtsTypeAware = [], files = [
|
|
1558
1580
|
GLOB_TS,
|
|
1559
1581
|
GLOB_TSX,
|
|
1560
1582
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1561
1583
|
], filesTypeAware = [
|
|
1562
1584
|
GLOB_TS,
|
|
1563
1585
|
GLOB_TSX,
|
|
1564
|
-
...
|
|
1586
|
+
...componentExtsTypeAware.map((ext) => `**/*.${ext}`)
|
|
1565
1587
|
], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], tsconfigPath = true, isTypeAware = Boolean(tsconfigPath), overrides, parserOptions, stylistic: stylistic$1 = true } = options;
|
|
1566
1588
|
const tsEslint = await interopDefault(import("typescript-eslint"));
|
|
1567
1589
|
const projectServiceObject = isTypeAware && (allowDefaultProject ? {
|
|
@@ -1602,9 +1624,13 @@ const typescript = async (options = {}) => {
|
|
|
1602
1624
|
plugins: { "ts-eslint": tsEslint.plugin }
|
|
1603
1625
|
},
|
|
1604
1626
|
{
|
|
1605
|
-
name:
|
|
1606
|
-
...
|
|
1627
|
+
name: "zayne/ts-eslint/setup/parser",
|
|
1628
|
+
...makeParser(files)
|
|
1607
1629
|
},
|
|
1630
|
+
...isTypeAware ? [{
|
|
1631
|
+
name: "zayne/ts-eslint/setup/parser-type-aware",
|
|
1632
|
+
...makeParser(filesTypeAware, ignoresTypeAware)
|
|
1633
|
+
}] : [],
|
|
1608
1634
|
{
|
|
1609
1635
|
files: isTypeAware ? filesTypeAware : files,
|
|
1610
1636
|
name: `zayne/ts-eslint/recommended-${isTypeAware ? "strict-type-checked" : "strict"}`,
|
|
@@ -1617,7 +1643,7 @@ const typescript = async (options = {}) => {
|
|
|
1617
1643
|
}] : [],
|
|
1618
1644
|
{
|
|
1619
1645
|
files: isTypeAware ? filesTypeAware : files,
|
|
1620
|
-
name:
|
|
1646
|
+
name: `zayne/ts-eslint/${isTypeAware ? "rules-type-checked" : "rules"}`,
|
|
1621
1647
|
rules: {
|
|
1622
1648
|
"ts-eslint/array-type": ["error", { default: "array-simple" }],
|
|
1623
1649
|
"ts-eslint/consistent-type-definitions": ["error", "type"],
|
|
@@ -1867,9 +1893,13 @@ const vue = async (options = {}) => {
|
|
|
1867
1893
|
"vue/space-in-parens": ["error", "never"],
|
|
1868
1894
|
"vue/template-curly-spacing": "error"
|
|
1869
1895
|
},
|
|
1870
|
-
"ts-eslint/no-unused-vars": "off",
|
|
1871
1896
|
...overrides
|
|
1872
1897
|
}
|
|
1898
|
+
},
|
|
1899
|
+
{
|
|
1900
|
+
files,
|
|
1901
|
+
name: "zayne/vue/disables",
|
|
1902
|
+
rules: { "ts-eslint/no-unused-vars": "off" }
|
|
1873
1903
|
}
|
|
1874
1904
|
];
|
|
1875
1905
|
};
|
|
@@ -1934,7 +1964,7 @@ const ReactPackages = ["react", "react-dom"];
|
|
|
1934
1964
|
* The merged ESLint configurations.
|
|
1935
1965
|
*/
|
|
1936
1966
|
const zayne = (options = {}, ...userConfigs) => {
|
|
1937
|
-
const { autoRenamePlugins = true, componentExts = [], type = "app", withDefaults = true,...restOfOptions } = options;
|
|
1967
|
+
const { autoRenamePlugins = true, componentExts = [], componentExtsTypeAware = [], type = "app", withDefaults = true,...restOfOptions } = options;
|
|
1938
1968
|
const enableGitignore = restOfOptions.gitignore ?? true;
|
|
1939
1969
|
const enableJsx = restOfOptions.jsx ?? true;
|
|
1940
1970
|
const enableComments = restOfOptions.comments ?? withDefaults;
|
|
@@ -1957,10 +1987,17 @@ const zayne = (options = {}, ...userConfigs) => {
|
|
|
1957
1987
|
configs.push(ignores(restOfOptions.ignores), javascript(restOfOptions.javascript));
|
|
1958
1988
|
if (enableGitignore) configs.push(gitIgnores(resolveOptions(enableGitignore)));
|
|
1959
1989
|
if (enableJsx) configs.push(jsx());
|
|
1960
|
-
if (restOfOptions.vue)
|
|
1961
|
-
|
|
1990
|
+
if (restOfOptions.vue) {
|
|
1991
|
+
componentExts.push("vue");
|
|
1992
|
+
(resolveOptions(restOfOptions.vue).typescript ?? isTypeAware) && componentExtsTypeAware.push("vue");
|
|
1993
|
+
}
|
|
1994
|
+
if (restOfOptions.astro) {
|
|
1995
|
+
componentExts.push("astro");
|
|
1996
|
+
(resolveOptions(restOfOptions.astro).typescript ?? isTypeAware) && componentExtsTypeAware.push("astro");
|
|
1997
|
+
}
|
|
1962
1998
|
if (enableTypeScript) configs.push(typescript({
|
|
1963
1999
|
componentExts,
|
|
2000
|
+
componentExtsTypeAware,
|
|
1964
2001
|
isTypeAware,
|
|
1965
2002
|
stylistic: isStylistic,
|
|
1966
2003
|
...resolveOptions(enableTypeScript),
|