@zayne-labs/eslint-config 0.9.4 → 0.9.6

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.js CHANGED
@@ -275,7 +275,7 @@ const ignores = (userIgnores = []) => {
275
275
  const gitIgnores = async (options) => {
276
276
  const antfuGitIgnore = await interopDefault(import("eslint-config-flat-gitignore"));
277
277
  const config = antfuGitIgnore({
278
- name: "zayne/gitignore",
278
+ name: "zayne/gitignore/setup",
279
279
  strict: false,
280
280
  ...options
281
281
  });
@@ -914,19 +914,41 @@ const defaultPluginRenameMap = defineEnum({
914
914
  "import-x": "import",
915
915
  n: "node"
916
916
  });
917
+ const allowedNextJsExportNames = [
918
+ "dynamic",
919
+ "dynamicParams",
920
+ "revalidate",
921
+ "fetchCache",
922
+ "runtime",
923
+ "preferredRegion",
924
+ "maxDuration",
925
+ "config",
926
+ "generateStaticParams",
927
+ "metadata",
928
+ "generateMetadata",
929
+ "viewport",
930
+ "generateViewport"
931
+ ];
932
+ const allowedReactRouterExportNames = [
933
+ "meta",
934
+ "links",
935
+ "headers",
936
+ "loader",
937
+ "action"
938
+ ];
917
939
 
918
940
  //#endregion
919
941
  //#region src/configs/react.ts
920
942
  const ReactRefreshAllowConstantExportPackages = ["vite"];
921
- const RemixPackages = [
922
- "@remix-run/node",
923
- "@remix-run/react",
924
- "@remix-run/serve",
925
- "@remix-run/dev"
943
+ const ReactRouterPackages = [
944
+ "@react-router/node",
945
+ "@react-router/react",
946
+ "@react-router/serve",
947
+ "@react-router/dev"
926
948
  ];
927
949
  const NextJsPackages = ["next"];
928
950
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => isPackageExists(i));
929
- const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
951
+ const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
930
952
  const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
931
953
  const react = async (options = {}) => {
932
954
  const { compiler = false, files = [GLOB_SRC], nextjs = isUsingNext, overrides, refresh = true, typescript: typescript$1 = true } = options;
@@ -1001,27 +1023,7 @@ const react = async (options = {}) => {
1001
1023
  plugins: { "react-refresh": eslintPluginReactRefresh },
1002
1024
  rules: { "react-refresh/only-export-components": ["warn", {
1003
1025
  allowConstantExport: isAllowConstantExport,
1004
- allowExportNames: [...isUsingNext ? [
1005
- "dynamic",
1006
- "dynamicParams",
1007
- "revalidate",
1008
- "fetchCache",
1009
- "runtime",
1010
- "preferredRegion",
1011
- "maxDuration",
1012
- "config",
1013
- "generateStaticParams",
1014
- "metadata",
1015
- "generateMetadata",
1016
- "viewport",
1017
- "generateViewport"
1018
- ] : [], ...isUsingRemix ? [
1019
- "meta",
1020
- "links",
1021
- "headers",
1022
- "loader",
1023
- "action"
1024
- ] : []]
1026
+ allowExportNames: [...isUsingNext ? allowedNextJsExportNames : [], ...isUsingReactRouter ? allowedReactRouterExportNames : []]
1025
1027
  }] }
1026
1028
  });
1027
1029
  if (compiler) config.push({
@@ -1356,10 +1358,13 @@ const tailwindcssBetter = async (options = {}) => {
1356
1358
  {
1357
1359
  name: "zayne/tailwindcss-better/rules",
1358
1360
  rules: {
1359
- "tailwindcss-better/multiline": "off",
1361
+ "tailwindcss-better/enforce-consistent-important-position": "warn",
1360
1362
  "tailwindcss-better/enforce-consistent-line-wrapping": "off",
1361
1363
  "tailwindcss-better/enforce-consistent-variable-syntax": "warn",
1364
+ "tailwindcss-better/enforce-shorthand-classes": "warn",
1365
+ "tailwindcss-better/multiline": "off",
1362
1366
  "tailwindcss-better/no-conflicting-classes": "warn",
1367
+ "tailwindcss-better/no-deprecated-classes": "warn",
1363
1368
  "tailwindcss-better/no-unregistered-classes": "warn",
1364
1369
  ...overrides
1365
1370
  }
@@ -1368,7 +1373,7 @@ const tailwindcssBetter = async (options = {}) => {
1368
1373
  };
1369
1374
  /**
1370
1375
  * @description tailwindcss v4 is not supported yet
1371
- * @deprecated until eslint-plugin-tailwindcss supports tailwindcss v4
1376
+ * @deprecated until `eslint-plugin-tailwindcss` supports tailwindcss v4
1372
1377
  */
1373
1378
 
1374
1379
  //#endregion
@@ -1447,8 +1452,7 @@ const typescript = async (options = {}) => {
1447
1452
  GLOB_TS,
1448
1453
  GLOB_TSX,
1449
1454
  ...componentExts.map((ext) => `**/*.${ext}`)
1450
- ], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], overrides, overridesTypeAware, parserOptions, stylistic: stylistic$1 = true, tsconfigPath } = options;
1451
- const isTypeAware = Boolean(tsconfigPath);
1455
+ ], ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS], tsconfigPath = true, isTypeAware = Boolean(tsconfigPath), overrides, overridesTypeAware, parserOptions, stylistic: stylistic$1 = true } = options;
1452
1456
  const tsEslint = await interopDefault(import("typescript-eslint"));
1453
1457
  const projectServiceObject = isTypeAware && (allowDefaultProject ? {
1454
1458
  projectService: {
@@ -1457,7 +1461,7 @@ const typescript = async (options = {}) => {
1457
1461
  },
1458
1462
  tsconfigRootDir: process.cwd()
1459
1463
  } : {
1460
- project: tsconfigPath ?? true,
1464
+ project: tsconfigPath,
1461
1465
  tsconfigRootDir: process.cwd()
1462
1466
  });
1463
1467
  const makeParser = (parsedFiles, ignores$1) => ({
@@ -1574,7 +1578,6 @@ const unicorn = async (options = {}) => {
1574
1578
  kebabCase: true,
1575
1579
  pascalCase: true
1576
1580
  } }],
1577
- ...type === "app" ? { "unicorn/prefer-global-this": "off" } : { "unicorn/prefer-global-this": "warn" },
1578
1581
  "unicorn/new-for-builtins": "off",
1579
1582
  "unicorn/no-array-for-each": "off",
1580
1583
  "unicorn/no-array-reduce": "off",
@@ -1582,6 +1585,7 @@ const unicorn = async (options = {}) => {
1582
1585
  "unicorn/no-null": "off",
1583
1586
  "unicorn/no-useless-undefined": ["error", { checkArguments: true }],
1584
1587
  "unicorn/numeric-separators-style": "off",
1588
+ "unicorn/prefer-global-this": type === "lib" || type === "lib-strict" ? "warn" : "off",
1585
1589
  "unicorn/prevent-abbreviations": "off",
1586
1590
  ...overrides
1587
1591
  }
@@ -1843,15 +1847,17 @@ const zayne = (options = {}, ...userConfigs) => {
1843
1847
  const enableUnicorn = restOfOptions.unicorn ?? withDefaults;
1844
1848
  const enableYaml = restOfOptions.yaml ?? withDefaults;
1845
1849
  const isStylistic = Boolean(enableStylistic);
1846
- const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : null;
1850
+ const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : restOfOptions.typescript === true ? true : null;
1847
1851
  const isTypeAware = Boolean(tsconfigPath);
1848
1852
  const configs = [];
1849
1853
  configs.push(ignores(restOfOptions.ignores), javascript(restOfOptions.javascript));
1854
+ if (enableGitignore) configs.push(gitIgnores(resolveOptions(enableGitignore)));
1850
1855
  if (enableJsx) configs.push(jsx());
1851
1856
  if (restOfOptions.vue) componentExts.push("vue");
1852
1857
  if (restOfOptions.astro) componentExts.push("astro");
1853
1858
  if (enableTypeScript) configs.push(typescript({
1854
1859
  componentExts,
1860
+ isTypeAware,
1855
1861
  stylistic: isStylistic,
1856
1862
  ...resolveOptions(enableTypeScript)
1857
1863
  }));
@@ -1863,7 +1869,6 @@ const zayne = (options = {}, ...userConfigs) => {
1863
1869
  type,
1864
1870
  ...resolveOptions(enableComments)
1865
1871
  }));
1866
- if (enableGitignore) configs.push(gitIgnores(resolveOptions(enableGitignore)));
1867
1872
  if (enableImports) configs.push(imports({
1868
1873
  stylistic: isStylistic,
1869
1874
  typescript: isTypeAware,