@zayne-labs/eslint-config 0.0.2 → 0.0.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/index.js CHANGED
@@ -156,7 +156,8 @@ var gitIgnores = async (options) => {
156
156
  const antfuGitIgnore = await interopDefault(import('eslint-config-flat-gitignore'));
157
157
  const config = antfuGitIgnore({
158
158
  name: "zayne/gitignore",
159
- ...isObject(options) ? options : { strict: false }
159
+ strict: false,
160
+ ...options
160
161
  });
161
162
  return [config];
162
163
  };
@@ -491,7 +492,7 @@ var tailwindcss = async (options = {}) => {
491
492
  {
492
493
  name: "zayne/tailwindcss/rules",
493
494
  rules: {
494
- ...eslintPluginTailwindCss.rules,
495
+ ...eslintPluginTailwindCss.configs["flat/recommended"][1]?.rules,
495
496
  "tailwindcss/no-contradicting-classname": "off",
496
497
  // Turned off cuz tw intellisense already handles this
497
498
  "tailwindcss/no-custom-classname": [
@@ -509,15 +510,15 @@ var typescript = async (options = {}) => {
509
510
  const {
510
511
  allowDefaultProjects,
511
512
  componentExts = [],
513
+ files = [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
514
+ filesTypeAware = [GLOB_TS, GLOB_TSX],
515
+ ignoresTypeAware = [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS],
512
516
  overrides,
513
517
  parserOptions,
514
518
  stylistic: stylistic2 = true,
515
519
  tsconfigPath
516
520
  } = options;
517
521
  const isTypeAware = Boolean(tsconfigPath);
518
- const files = options.files ?? [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)];
519
- const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
520
- const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
521
522
  const tsEslint = await interopDefault(import('typescript-eslint'));
522
523
  const makeParser = (parsedFiles, ignores2) => ({
523
524
  files: parsedFiles,
@@ -962,12 +963,12 @@ var ReactRefreshAllowConstantExportPackages = ["vite"];
962
963
  var RemixPackages = ["@remix-run/node", "@remix-run/react", "@remix-run/serve", "@remix-run/dev"];
963
964
  var NextJsPackages = ["next"];
964
965
  var eslintReactRenameMap = {
965
- "@eslint-react": "react",
966
- "@eslint-react/debug": "react/debug",
967
- "@eslint-react/dom": "react/dom",
968
- "@eslint-react/hooks-extra": "react/hooks-extra",
969
- "@eslint-react/naming-convention": "react/naming-convention",
970
- "@eslint-react/web-api": "react/web-api"
966
+ "@eslint-react": "react-base",
967
+ "@eslint-react/debug": "react-debug",
968
+ "@eslint-react/dom": "react-dom",
969
+ "@eslint-react/hooks-extra": "react-hooks-extra",
970
+ "@eslint-react/naming-convention": "react-naming-convention",
971
+ "@eslint-react/web-api": "react-web-api"
971
972
  };
972
973
  var react = async (options = {}) => {
973
974
  const { files, overrides, typescript: typescript2 = true } = options;
@@ -1001,22 +1002,22 @@ var react = async (options = {}) => {
1001
1002
  name: "zayne/react/rules",
1002
1003
  rules: {
1003
1004
  ...renameRules(recommendedReactConfig.rules, eslintReactRenameMap),
1004
- "react/avoid-shorthand-boolean": "error",
1005
- "react/function-component-definition": "off",
1006
- "react/hooks-extra/ensure-custom-hooks-using-other-hooks": "error",
1007
- "react/hooks-extra/prefer-use-state-lazy-initialization": "error",
1008
- "react/naming-convention/component-name": "warn",
1009
- "react/naming-convention/use-state": "warn",
1010
- "react/no-array-index-key": "error",
1011
- "react/no-children-count": "off",
1012
- "react/no-children-only": "off",
1013
- "react/no-children-prop": "error",
1014
- "react/no-children-to-array": "off",
1015
- "react/no-clone-element": "off",
1016
- "react/no-missing-component-display-name": "error",
1017
- "react/prefer-destructuring-assignment": "error",
1018
- "react/prefer-read-only-props": "off",
1019
- "react/prefer-shorthand-fragment": "error",
1005
+ "react-base/avoid-shorthand-boolean": "error",
1006
+ "react-base/function-component-definition": "off",
1007
+ "react-base/no-array-index-key": "error",
1008
+ "react-base/no-children-count": "off",
1009
+ "react-base/no-children-only": "off",
1010
+ "react-base/no-children-prop": "error",
1011
+ "react-base/no-children-to-array": "off",
1012
+ "react-base/no-clone-element": "off",
1013
+ "react-base/no-missing-component-display-name": "error",
1014
+ "react-base/prefer-destructuring-assignment": "error",
1015
+ "react-base/prefer-read-only-props": "off",
1016
+ "react-base/prefer-shorthand-fragment": "error",
1017
+ "react-hooks-extra/ensure-custom-hooks-using-other-hooks": "error",
1018
+ "react-hooks-extra/prefer-use-state-lazy-initialization": "error",
1019
+ "react-naming-convention/component-name": "warn",
1020
+ "react-naming-convention/use-state": "warn",
1020
1021
  // Hook rules
1021
1022
  // eslint-disable-next-line perfectionist/sort-objects
1022
1023
  "react-hooks/exhaustive-deps": "warn",
@@ -1285,10 +1286,6 @@ var jsx = () => {
1285
1286
  };
1286
1287
 
1287
1288
  // src/factory.ts
1288
- var getOverrides = (option) => {
1289
- return isObject(option) ? option.overrides : {};
1290
- };
1291
- var ReactPackages = ["react", "react-dom", "next", "remix"];
1292
1289
  var defaultPluginRenaming = {
1293
1290
  ...eslintReactRenameMap,
1294
1291
  "@stylistic": "stylistic",
@@ -1296,6 +1293,8 @@ var defaultPluginRenaming = {
1296
1293
  "import-x": "import",
1297
1294
  n: "node"
1298
1295
  };
1296
+ var ReactPackages = ["react", "react-dom"];
1297
+ var resolveOptions = (option) => isObject(option) ? option : {};
1299
1298
  var zayne = (options = {}, userConfigs = []) => {
1300
1299
  const {
1301
1300
  autoRenamePlugins = true,
@@ -1306,7 +1305,6 @@ var zayne = (options = {}, userConfigs = []) => {
1306
1305
  perfectionist: enablePerfectionist = true,
1307
1306
  react: enableReact = ReactPackages.some((pkg) => isPackageExists(pkg)),
1308
1307
  stylistic: enableStylistic = true,
1309
- tailwindcss: enableTailwindCSS = isPackageExists("tailwindcss"),
1310
1308
  typescript: enableTypeScript = isPackageExists("typescript"),
1311
1309
  unicorn: enableUnicorn = true,
1312
1310
  ...restOfOptions
@@ -1315,7 +1313,7 @@ var zayne = (options = {}, userConfigs = []) => {
1315
1313
  const tsconfigPath = isObject(enableTypeScript) && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : null;
1316
1314
  const configs = [];
1317
1315
  if (enableGitignore) {
1318
- configs.push(gitIgnores(enableGitignore));
1316
+ configs.push(gitIgnores(resolveOptions(enableGitignore)));
1319
1317
  }
1320
1318
  configs.push(
1321
1319
  ignores(restOfOptions.ignores),
@@ -1324,16 +1322,16 @@ var zayne = (options = {}, userConfigs = []) => {
1324
1322
  jsdoc({ stylistic: isStylistic })
1325
1323
  );
1326
1324
  if (enablePerfectionist) {
1327
- configs.push(perfectionist({ overrides: getOverrides(enablePerfectionist) }));
1325
+ configs.push(perfectionist(resolveOptions(enablePerfectionist)));
1328
1326
  }
1329
1327
  if (enableUnicorn) {
1330
- configs.push(unicorn({ overrides: getOverrides(enableUnicorn) }));
1328
+ configs.push(unicorn(resolveOptions(enableUnicorn)));
1331
1329
  }
1332
1330
  if (enableJsonc) {
1333
1331
  configs.push(
1334
1332
  jsonc({
1335
- overrides: getOverrides(enableJsonc),
1336
- stylistic: isStylistic
1333
+ stylistic: isStylistic,
1334
+ ...resolveOptions(enableJsonc)
1337
1335
  }),
1338
1336
  sortPackageJson(),
1339
1337
  sortTsconfig()
@@ -1342,10 +1340,9 @@ var zayne = (options = {}, userConfigs = []) => {
1342
1340
  if (enableTypeScript) {
1343
1341
  configs.push(
1344
1342
  typescript({
1345
- ...isObject(enableTypeScript) && enableTypeScript,
1346
1343
  componentExts,
1347
- overrides: getOverrides(enableTypeScript),
1348
- stylistic: true
1344
+ stylistic: isStylistic,
1345
+ ...resolveOptions(enableTypeScript)
1349
1346
  })
1350
1347
  );
1351
1348
  }
@@ -1353,17 +1350,17 @@ var zayne = (options = {}, userConfigs = []) => {
1353
1350
  configs.push(jsx());
1354
1351
  }
1355
1352
  if (enableStylistic) {
1356
- const stylisticOptions = isObject(enableStylistic) ? enableStylistic : {};
1353
+ const stylisticOptions = resolveOptions(enableStylistic);
1357
1354
  !Object.hasOwn(stylisticOptions, "jsx") && (stylisticOptions.jsx = enableJsx);
1358
1355
  configs.push(stylistic(stylisticOptions));
1359
1356
  }
1360
- if (enableTailwindCSS) {
1361
- configs.push(tailwindcss({ ...isObject(enableTailwindCSS) && enableTailwindCSS }));
1357
+ if (restOfOptions.tailwindcss) {
1358
+ configs.push(tailwindcss(resolveOptions(restOfOptions.tailwindcss)));
1362
1359
  }
1363
1360
  if (enableReact) {
1364
1361
  configs.push(
1365
1362
  react({
1366
- overrides: getOverrides(enableReact),
1363
+ ...resolveOptions(enableReact),
1367
1364
  typescript: Boolean(tsconfigPath)
1368
1365
  })
1369
1366
  );