@reasonabletech/eslint-config 0.1.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +89 -0
  3. package/dist/src/base-configs.d.ts +53 -0
  4. package/dist/src/base-configs.js +105 -0
  5. package/dist/src/custom-rules/architecture-patterns.d.ts +193 -0
  6. package/dist/src/custom-rules/architecture-patterns.js +344 -0
  7. package/dist/src/custom-rules/code-quality.d.ts +201 -0
  8. package/dist/src/custom-rules/code-quality.js +388 -0
  9. package/dist/src/custom-rules/error-handling.d.ts +103 -0
  10. package/dist/src/custom-rules/error-handling.js +349 -0
  11. package/dist/src/custom-rules/index.d.ts +79 -0
  12. package/dist/src/custom-rules/index.js +119 -0
  13. package/dist/src/custom-rules/null-undefined-checks.d.ts +20 -0
  14. package/dist/src/custom-rules/null-undefined-checks.js +153 -0
  15. package/dist/src/custom-rules/platform-conventions.d.ts +115 -0
  16. package/dist/src/custom-rules/platform-conventions.js +249 -0
  17. package/dist/src/custom-rules/test-quality.d.ts +38 -0
  18. package/dist/src/custom-rules/test-quality.js +68 -0
  19. package/dist/src/custom-rules/type-safety.d.ts +71 -0
  20. package/dist/src/custom-rules/type-safety.js +121 -0
  21. package/dist/src/custom-rules/ui-library-imports.d.ts +21 -0
  22. package/dist/src/custom-rules/ui-library-imports.js +31 -0
  23. package/dist/src/custom-rules/utils.d.ts +95 -0
  24. package/dist/src/custom-rules/utils.js +146 -0
  25. package/dist/src/index.d.ts +73 -0
  26. package/dist/src/index.js +80 -0
  27. package/dist/src/next/config.d.ts +26 -0
  28. package/dist/src/next/config.js +76 -0
  29. package/dist/src/next/ignores.d.ts +37 -0
  30. package/dist/src/next/ignores.js +69 -0
  31. package/dist/src/next/plugins.d.ts +44 -0
  32. package/dist/src/next/plugins.js +104 -0
  33. package/dist/src/next/rules.d.ts +39 -0
  34. package/dist/src/next/rules.js +48 -0
  35. package/dist/src/next/settings.d.ts +41 -0
  36. package/dist/src/next/settings.js +45 -0
  37. package/dist/src/next.d.ts +33 -0
  38. package/dist/src/next.js +74 -0
  39. package/dist/src/plugin.d.ts +48 -0
  40. package/dist/src/plugin.js +30 -0
  41. package/dist/src/react/config.d.ts +30 -0
  42. package/dist/src/react/config.js +40 -0
  43. package/dist/src/react/plugins.d.ts +24 -0
  44. package/dist/src/react/plugins.js +46 -0
  45. package/dist/src/react/rules.d.ts +30 -0
  46. package/dist/src/react/rules.js +35 -0
  47. package/dist/src/react.d.ts +27 -0
  48. package/dist/src/react.js +35 -0
  49. package/dist/src/shared/parser-options.d.ts +3 -0
  50. package/dist/src/shared/parser-options.js +19 -0
  51. package/dist/src/shared/plugin-utils.d.ts +8 -0
  52. package/dist/src/shared/plugin-utils.js +23 -0
  53. package/dist/src/shared/react-rules.d.ts +97 -0
  54. package/dist/src/shared/react-rules.js +126 -0
  55. package/dist/src/shared/strict-rules.d.ts +27 -0
  56. package/dist/src/shared/strict-rules.js +54 -0
  57. package/dist/src/shared-ignores.d.ts +15 -0
  58. package/dist/src/shared-ignores.js +68 -0
  59. package/dist/src/shared-rules.d.ts +29 -0
  60. package/dist/src/shared-rules.js +163 -0
  61. package/package.json +122 -0
@@ -0,0 +1,40 @@
1
+ import { createCombinedReactPluginConfig } from "./plugins.js";
2
+ import { allReactRules } from "./rules.js";
3
+ import { createSharedReactComponentFileConfig } from "../shared/react-rules.js";
4
+ /**
5
+ * Configuration builders for React projects.
6
+ *
7
+ * This module combines React plugins, rules, and file-specific
8
+ * configurations into complete ESLint configurations.
9
+ */
10
+ /**
11
+ * Base React rules configuration.
12
+ *
13
+ * Applies all React rules (shared and React-specific) to the
14
+ * ESLint configuration.
15
+ * @returns ESLint configuration object with React rules
16
+ */
17
+ export const createReactRulesConfig = () => ({
18
+ rules: {
19
+ ...allReactRules,
20
+ },
21
+ });
22
+ /**
23
+ * Complete React configuration builder.
24
+ *
25
+ * Combines all React-specific configurations including plugins,
26
+ * rules, and file-specific overrides into a comprehensive
27
+ * configuration array.
28
+ *
29
+ * Configuration includes:
30
+ * - React and React Hooks plugins with browser globals
31
+ * - All React rules (core, hooks, TypeScript overrides)
32
+ * - JSDoc rule exemptions for React component files
33
+ * @returns Array of ESLint configurations for React projects
34
+ */
35
+ export const createReactConfigs = () => [
36
+ ...createCombinedReactPluginConfig(),
37
+ createReactRulesConfig(),
38
+ createSharedReactComponentFileConfig(),
39
+ ];
40
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1,24 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * React plugin configurations for ESLint.
4
+ *
5
+ * This module provides pre-configured plugin setups for React development,
6
+ * including the base React plugin and React Hooks plugin with appropriate
7
+ * browser globals and settings.
8
+ */
9
+ /**
10
+ * Base React plugin configuration.
11
+ *
12
+ * Provides the core React ESLint plugin with browser and service worker
13
+ * globals enabled for modern React applications.
14
+ * @returns Array of ESLint configurations for React projects
15
+ */
16
+ export declare const createReactPluginConfig: () => Linter.Config[];
17
+ /**
18
+ * Combined React plugin configuration.
19
+ *
20
+ * Returns React plugin configurations.
21
+ * @returns Array of ESLint configurations for React
22
+ */
23
+ export declare const createCombinedReactPluginConfig: () => Linter.Config[];
24
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1,46 @@
1
+ import reactPlugin from "eslint-plugin-react";
2
+ import globals from "globals";
3
+ /**
4
+ * React plugin configurations for ESLint.
5
+ *
6
+ * This module provides pre-configured plugin setups for React development,
7
+ * including the base React plugin and React Hooks plugin with appropriate
8
+ * browser globals and settings.
9
+ */
10
+ /**
11
+ * Base React plugin configuration.
12
+ *
13
+ * Provides the core React ESLint plugin with browser and service worker
14
+ * globals enabled for modern React applications.
15
+ * @returns Array of ESLint configurations for React projects
16
+ */
17
+ export const createReactPluginConfig = () => {
18
+ const reactConfig = reactPlugin.configs.flat.recommended;
19
+ return [
20
+ reactConfig,
21
+ {
22
+ languageOptions: {
23
+ ...reactConfig.languageOptions,
24
+ globals: {
25
+ ...globals.serviceworker,
26
+ ...globals.browser,
27
+ },
28
+ },
29
+ settings: {
30
+ react: {
31
+ version: "detect",
32
+ },
33
+ },
34
+ },
35
+ ];
36
+ };
37
+ /**
38
+ * Combined React plugin configuration.
39
+ *
40
+ * Returns React plugin configurations.
41
+ * @returns Array of ESLint configurations for React
42
+ */
43
+ export const createCombinedReactPluginConfig = () => {
44
+ return createReactPluginConfig();
45
+ };
46
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1,30 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * React-specific ESLint rules for standalone React projects.
4
+ *
5
+ * This module provides rules specifically tailored for React projects
6
+ * that are not using Next.js. It leverages shared React rules while
7
+ * adding React-specific configurations.
8
+ */
9
+ /**
10
+ * Complete React rules configuration for standalone React projects.
11
+ *
12
+ * Uses shared React rules configured for modern React development
13
+ * with the new JSX transform.
14
+ */
15
+ export declare const reactRules: Record<string, Linter.RuleEntry<any[]>>;
16
+ /**
17
+ * Additional React-specific rules that don't apply to Next.js.
18
+ *
19
+ * These rules are specific to standalone React applications and
20
+ * may not be appropriate or necessary for Next.js projects.
21
+ */
22
+ export declare const reactOnlyRules: {};
23
+ /**
24
+ * Combined React rules for standalone React projects.
25
+ *
26
+ * Merges shared React rules with React-only rules to create
27
+ * a complete rule set for React projects.
28
+ */
29
+ export declare const allReactRules: {};
30
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { createSharedReactRules } from "../shared/react-rules.js";
2
+ /**
3
+ * React-specific ESLint rules for standalone React projects.
4
+ *
5
+ * This module provides rules specifically tailored for React projects
6
+ * that are not using Next.js. It leverages shared React rules while
7
+ * adding React-specific configurations.
8
+ */
9
+ /**
10
+ * Complete React rules configuration for standalone React projects.
11
+ *
12
+ * Uses shared React rules configured for modern React development
13
+ * with the new JSX transform.
14
+ */
15
+ export const reactRules = createSharedReactRules("react");
16
+ /**
17
+ * Additional React-specific rules that don't apply to Next.js.
18
+ *
19
+ * These rules are specific to standalone React applications and
20
+ * may not be appropriate or necessary for Next.js projects.
21
+ */
22
+ export const reactOnlyRules = {
23
+ // Add any React-only rules here if needed in the future
24
+ };
25
+ /**
26
+ * Combined React rules for standalone React projects.
27
+ *
28
+ * Merges shared React rules with React-only rules to create
29
+ * a complete rule set for React projects.
30
+ */
31
+ export const allReactRules = {
32
+ ...reactRules,
33
+ ...reactOnlyRules,
34
+ };
35
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1,27 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * Creates a type-aware ESLint configuration for React projects.
4
+ *
5
+ * This configuration extends the base TypeScript configuration with React-specific
6
+ * rules, plugins, and optimizations. It provides a comprehensive setup for modern
7
+ * React development with TypeScript.
8
+ *
9
+ * Key features:
10
+ * - Browser and service worker globals
11
+ * - React hooks validation with exhaustive dependencies
12
+ * - TypeScript rule overrides for React patterns
13
+ * - JSDoc requirement exemptions for React components
14
+ * - Modern JSX transform support (no React import required)
15
+ * @param projectDir - The directory containing the TypeScript project
16
+ * @returns A comprehensive type-aware ESLint configuration for React
17
+ * @example
18
+ * ```typescript
19
+ * // In your eslint.config.mjs
20
+ * import { createTypeAwareReactConfig } from "@reasonabletech/eslint-config/react";
21
+ *
22
+ * export default createTypeAwareReactConfig(import.meta.dirname);
23
+ * ```
24
+ */
25
+ export declare function createTypeAwareReactConfig(projectDir: string): Linter.Config[];
26
+ export default createTypeAwareReactConfig;
27
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { createTypeAwareConfig } from "./index.js";
2
+ import { createReactConfigs } from "./react/config.js";
3
+ /**
4
+ * Creates a type-aware ESLint configuration for React projects.
5
+ *
6
+ * This configuration extends the base TypeScript configuration with React-specific
7
+ * rules, plugins, and optimizations. It provides a comprehensive setup for modern
8
+ * React development with TypeScript.
9
+ *
10
+ * Key features:
11
+ * - Browser and service worker globals
12
+ * - React hooks validation with exhaustive dependencies
13
+ * - TypeScript rule overrides for React patterns
14
+ * - JSDoc requirement exemptions for React components
15
+ * - Modern JSX transform support (no React import required)
16
+ * @param projectDir - The directory containing the TypeScript project
17
+ * @returns A comprehensive type-aware ESLint configuration for React
18
+ * @example
19
+ * ```typescript
20
+ * // In your eslint.config.mjs
21
+ * import { createTypeAwareReactConfig } from "@reasonabletech/eslint-config/react";
22
+ *
23
+ * export default createTypeAwareReactConfig(import.meta.dirname);
24
+ * ```
25
+ */
26
+ export function createTypeAwareReactConfig(projectDir) {
27
+ return [
28
+ // Base TypeScript configuration with type-aware rules
29
+ ...createTypeAwareConfig(projectDir),
30
+ // React-specific configurations (plugins, rules, file overrides)
31
+ ...createReactConfigs(),
32
+ ];
33
+ }
34
+ export default createTypeAwareReactConfig;
35
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1,3 @@
1
+ import type { Linter } from "eslint";
2
+ export declare const removeProjectParserOption: (config: Linter.Config) => Linter.Config;
3
+ //# sourceMappingURL=parser-options.d.ts.map
@@ -0,0 +1,19 @@
1
+ export const removeProjectParserOption = (config) => {
2
+ const parserOptions = config.languageOptions?.parserOptions;
3
+ if (parserOptions == null ||
4
+ typeof parserOptions !== "object" ||
5
+ Array.isArray(parserOptions) ||
6
+ !("project" in parserOptions)) {
7
+ return config;
8
+ }
9
+ const parserOptionsRecord = parserOptions;
10
+ const { project: _project, ...rest } = parserOptionsRecord;
11
+ return {
12
+ ...config,
13
+ languageOptions: {
14
+ ...config.languageOptions,
15
+ parserOptions: rest,
16
+ },
17
+ };
18
+ };
19
+ //# sourceMappingURL=parser-options.js.map
@@ -0,0 +1,8 @@
1
+ import type { ESLint } from "eslint";
2
+ /**
3
+ * Removes plugin config metadata to avoid circular references in flat configs.
4
+ * @param plugin - ESLint plugin instance that may include circular configs
5
+ * @returns Plugin without the `configs` metadata attached
6
+ */
7
+ export declare const stripPluginConfigs: <T extends ESLint.Plugin>(plugin: T) => ESLint.Plugin;
8
+ //# sourceMappingURL=plugin-utils.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Removes plugin config metadata to avoid circular references in flat configs.
3
+ * @param plugin - ESLint plugin instance that may include circular configs
4
+ * @returns Plugin without the `configs` metadata attached
5
+ */
6
+ export const stripPluginConfigs = (plugin) => {
7
+ const { rules, processors, environments, meta } = plugin;
8
+ const stripped = {};
9
+ if (rules !== undefined) {
10
+ stripped.rules = rules;
11
+ }
12
+ if (processors !== undefined) {
13
+ stripped.processors = processors;
14
+ }
15
+ if (environments !== undefined) {
16
+ stripped.environments = environments;
17
+ }
18
+ if (meta !== undefined) {
19
+ stripped.meta = meta;
20
+ }
21
+ return stripped;
22
+ };
23
+ //# sourceMappingURL=plugin-utils.js.map
@@ -0,0 +1,97 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * Shared React ESLint rules used across both React and Next.js configurations.
4
+ *
5
+ * This module provides reusable rule configurations that are common between
6
+ * standalone React projects and Next.js projects, reducing duplication and
7
+ * ensuring consistency across project types.
8
+ */
9
+ /**
10
+ * Core React rules that apply to all React-based projects.
11
+ *
12
+ * These rules enforce modern React best practices and are suitable
13
+ * for both standalone React applications and Next.js applications.
14
+ */
15
+ export declare const sharedReactCoreRules: {
16
+ readonly "react/no-unescaped-entities": "error";
17
+ };
18
+ /**
19
+ * React JSX scope rules with framework-specific variations.
20
+ *
21
+ * The JSX scope rule behavior differs between standalone React and Next.js:
22
+ * - Next.js: Always off (built-in JSX transform)
23
+ * - React: Off for modern setups with new JSX transform
24
+ */
25
+ export declare const reactJSXScopeRules: {
26
+ /** For Next.js projects where JSX transform is built-in */
27
+ readonly nextjs: {
28
+ readonly "react/react-in-jsx-scope": "off";
29
+ };
30
+ /** For modern React projects with new JSX transform */
31
+ readonly modern: {
32
+ readonly "react/react-in-jsx-scope": "off";
33
+ };
34
+ };
35
+ /**
36
+ * TypeScript rule overrides for React development.
37
+ *
38
+ * These overrides disable specific TypeScript rules that conflict with
39
+ * React patterns while maintaining strict type safety standards.
40
+ * The same overrides apply to both React and Next.js projects.
41
+ *
42
+ * NOTE: strict-boolean-expressions is NOT disabled for React - we enforce
43
+ * explicit boolean checks even in conditional rendering to prevent bugs
44
+ * and maintain consistent architecture across the platform.
45
+ */
46
+ export declare const sharedReactTypeScriptRules: {
47
+ readonly "@typescript-eslint/prefer-readonly-parameter-types": "off";
48
+ readonly "@typescript-eslint/require-await": "off";
49
+ readonly "@typescript-eslint/unbound-method": "off";
50
+ };
51
+ /**
52
+ * Rules for React component files.
53
+ *
54
+ * React components often have obvious return types (React.JSX.Element) and
55
+ * don't need explicit return type annotations or `@returns` documentation.
56
+ * This applies to both React and Next.js projects.
57
+ *
58
+ * Additionally, React components use destructured props with well-documented
59
+ * Props interfaces. ESLint's jsdoc plugin options are configured to skip
60
+ * destructured parameter documentation:
61
+ * - `checkDestructured: false` - don't require `@param` for individual properties
62
+ * - `checkDestructuredRoots: false` - don't require `@param` for the root parameter
63
+ *
64
+ * This prevents conflicts with TypeDoc which warns about unused `@param` tags
65
+ * when Props interfaces already document the properties.
66
+ */
67
+ export declare const sharedReactComponentRules: {
68
+ readonly "jsdoc/require-returns": "off";
69
+ readonly "jsdoc/require-returns-description": "off";
70
+ readonly "jsdoc/require-param": ["warn", {
71
+ readonly checkDestructured: false;
72
+ readonly checkDestructuredRoots: false;
73
+ }];
74
+ readonly "jsdoc/check-param-names": ["warn", {
75
+ readonly checkDestructured: false;
76
+ }];
77
+ };
78
+ /**
79
+ * Creates a complete React rules configuration for a specific framework.
80
+ *
81
+ * Combines all shared React rules with framework-specific JSX scope rules
82
+ * to create a comprehensive rule set.
83
+ * @param framework - The target framework ("react" or "nextjs")
84
+ * @returns Combined React rules configuration
85
+ */
86
+ export declare const createSharedReactRules: (framework: "react" | "nextjs") => Record<string, Linter.RuleEntry>;
87
+ /**
88
+ * Creates a file-specific configuration for React components.
89
+ *
90
+ * Applies rule overrides to React component files (.tsx, .jsx) including:
91
+ * - Disables explicit return type requirements for React components only (JSX.Element is obvious)
92
+ * - Disables JSDoc return documentation requirements
93
+ * This configuration is identical for both React and Next.js projects.
94
+ * @returns ESLint configuration object for React component files
95
+ */
96
+ export declare const createSharedReactComponentFileConfig: () => Linter.Config;
97
+ //# sourceMappingURL=react-rules.d.ts.map
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Shared React ESLint rules used across both React and Next.js configurations.
3
+ *
4
+ * This module provides reusable rule configurations that are common between
5
+ * standalone React projects and Next.js projects, reducing duplication and
6
+ * ensuring consistency across project types.
7
+ */
8
+ /**
9
+ * Core React rules that apply to all React-based projects.
10
+ *
11
+ * These rules enforce modern React best practices and are suitable
12
+ * for both standalone React applications and Next.js applications.
13
+ */
14
+ export const sharedReactCoreRules = {
15
+ "react/no-unescaped-entities": "error", // Prevent HTML entity issues
16
+ };
17
+ /**
18
+ * React JSX scope rules with framework-specific variations.
19
+ *
20
+ * The JSX scope rule behavior differs between standalone React and Next.js:
21
+ * - Next.js: Always off (built-in JSX transform)
22
+ * - React: Off for modern setups with new JSX transform
23
+ */
24
+ export const reactJSXScopeRules = {
25
+ /** For Next.js projects where JSX transform is built-in */
26
+ nextjs: {
27
+ "react/react-in-jsx-scope": "off",
28
+ },
29
+ /** For modern React projects with new JSX transform */
30
+ modern: {
31
+ "react/react-in-jsx-scope": "off",
32
+ },
33
+ };
34
+ /**
35
+ * TypeScript rule overrides for React development.
36
+ *
37
+ * These overrides disable specific TypeScript rules that conflict with
38
+ * React patterns while maintaining strict type safety standards.
39
+ * The same overrides apply to both React and Next.js projects.
40
+ *
41
+ * NOTE: strict-boolean-expressions is NOT disabled for React - we enforce
42
+ * explicit boolean checks even in conditional rendering to prevent bugs
43
+ * and maintain consistent architecture across the platform.
44
+ */
45
+ export const sharedReactTypeScriptRules = {
46
+ "@typescript-eslint/prefer-readonly-parameter-types": "off", // Too restrictive for React props
47
+ "@typescript-eslint/require-await": "off", // React event handlers often don't need await
48
+ "@typescript-eslint/unbound-method": "off", // Known issue with React event handlers
49
+ };
50
+ /**
51
+ * Rules for React component files.
52
+ *
53
+ * React components often have obvious return types (React.JSX.Element) and
54
+ * don't need explicit return type annotations or `@returns` documentation.
55
+ * This applies to both React and Next.js projects.
56
+ *
57
+ * Additionally, React components use destructured props with well-documented
58
+ * Props interfaces. ESLint's jsdoc plugin options are configured to skip
59
+ * destructured parameter documentation:
60
+ * - `checkDestructured: false` - don't require `@param` for individual properties
61
+ * - `checkDestructuredRoots: false` - don't require `@param` for the root parameter
62
+ *
63
+ * This prevents conflicts with TypeDoc which warns about unused `@param` tags
64
+ * when Props interfaces already document the properties.
65
+ */
66
+ export const sharedReactComponentRules = {
67
+ // Disable explicit return types for React components - JSX.Element is obvious
68
+ // Note: This is applied via file-specific overrides in createSharedReactComponentFileConfig
69
+ // JSDoc return documentation not needed with explicit TypeScript types
70
+ "jsdoc/require-returns": "off",
71
+ "jsdoc/require-returns-description": "off",
72
+ // Disable requiring @param for destructured props - Props interfaces document these
73
+ // checkDestructuredRoots: false prevents the "Missing @param root0" warning
74
+ "jsdoc/require-param": [
75
+ "warn",
76
+ { checkDestructured: false, checkDestructuredRoots: false },
77
+ ],
78
+ // check-param-names only supports checkDestructured (not checkDestructuredRoots)
79
+ "jsdoc/check-param-names": ["warn", { checkDestructured: false }],
80
+ };
81
+ /**
82
+ * Creates a complete React rules configuration for a specific framework.
83
+ *
84
+ * Combines all shared React rules with framework-specific JSX scope rules
85
+ * to create a comprehensive rule set.
86
+ * @param framework - The target framework ("react" or "nextjs")
87
+ * @returns Combined React rules configuration
88
+ */
89
+ export const createSharedReactRules = (framework) => ({
90
+ ...sharedReactCoreRules,
91
+ ...(framework === "nextjs"
92
+ ? reactJSXScopeRules.nextjs
93
+ : reactJSXScopeRules.modern),
94
+ ...sharedReactTypeScriptRules,
95
+ });
96
+ /**
97
+ * Creates a file-specific configuration for React components.
98
+ *
99
+ * Applies rule overrides to React component files (.tsx, .jsx) including:
100
+ * - Disables explicit return type requirements for React components only (JSX.Element is obvious)
101
+ * - Disables JSDoc return documentation requirements
102
+ * This configuration is identical for both React and Next.js projects.
103
+ * @returns ESLint configuration object for React component files
104
+ */
105
+ export const createSharedReactComponentFileConfig = () => ({
106
+ files: ["**/*.tsx", "**/*.jsx"],
107
+ rules: {
108
+ ...sharedReactComponentRules,
109
+ // Only disable explicit return types for React component functions
110
+ // This uses overrides to target functions that return JSX elements
111
+ "@typescript-eslint/explicit-function-return-type": [
112
+ "error",
113
+ {
114
+ allowExpressions: true,
115
+ allowTypedFunctionExpressions: true,
116
+ allowHigherOrderFunctions: true,
117
+ allowDirectConstAssertionInArrowFunctions: true,
118
+ allowConciseArrowFunctionExpressionsStartingWithVoid: false,
119
+ // Allow JSX-returning functions to omit return types
120
+ allowedNames: [],
121
+ allowFunctionsWithoutTypeParameters: false,
122
+ },
123
+ ],
124
+ },
125
+ });
126
+ //# sourceMappingURL=react-rules.js.map
@@ -0,0 +1,27 @@
1
+ import type { Linter } from "eslint";
2
+ /**
3
+ * Strict TypeScript rules that should be applied to all projects.
4
+ *
5
+ * This module provides rules-only configurations that can be safely
6
+ * added to any ESLint setup without conflicting with existing plugins.
7
+ * These rules ensure consistent type safety across all project types.
8
+ */
9
+ /**
10
+ * Creates a rules-only configuration for strict TypeScript checking.
11
+ *
12
+ * This configuration contains only rules and does not define any plugins,
13
+ * making it safe to add to configurations that already have TypeScript
14
+ * ESLint plugins configured (like Next.js configs).
15
+ * @returns ESLint configuration with strict TypeScript rules
16
+ */
17
+ export declare const createStrictTypeScriptRulesConfig: () => Linter.Config;
18
+ /**
19
+ * Creates a rules-only configuration for strict boolean expressions specifically.
20
+ *
21
+ * This is a focused configuration that only includes the strict-boolean-expressions
22
+ * rule, which is often the most impactful rule for React/Next.js projects.
23
+ * @param projectDir - The project directory for TypeScript parser configuration (required for type-aware rules)
24
+ * @returns ESLint configuration with strict boolean expression rule and parser options
25
+ */
26
+ export declare const createStrictBooleanExpressionsConfig: (projectDir: string) => Linter.Config;
27
+ //# sourceMappingURL=strict-rules.d.ts.map
@@ -0,0 +1,54 @@
1
+ import { typeAwareRules } from "../shared-rules.js";
2
+ /**
3
+ * Strict TypeScript rules that should be applied to all projects.
4
+ *
5
+ * This module provides rules-only configurations that can be safely
6
+ * added to any ESLint setup without conflicting with existing plugins.
7
+ * These rules ensure consistent type safety across all project types.
8
+ */
9
+ /**
10
+ * Creates a rules-only configuration for strict TypeScript checking.
11
+ *
12
+ * This configuration contains only rules and does not define any plugins,
13
+ * making it safe to add to configurations that already have TypeScript
14
+ * ESLint plugins configured (like Next.js configs).
15
+ * @returns ESLint configuration with strict TypeScript rules
16
+ */
17
+ export const createStrictTypeScriptRulesConfig = () => ({
18
+ rules: {
19
+ // Include all type-aware rules from our base configuration
20
+ ...typeAwareRules,
21
+ },
22
+ });
23
+ /**
24
+ * Creates a rules-only configuration for strict boolean expressions specifically.
25
+ *
26
+ * This is a focused configuration that only includes the strict-boolean-expressions
27
+ * rule, which is often the most impactful rule for React/Next.js projects.
28
+ * @param projectDir - The project directory for TypeScript parser configuration (required for type-aware rules)
29
+ * @returns ESLint configuration with strict boolean expression rule and parser options
30
+ */
31
+ export const createStrictBooleanExpressionsConfig = (projectDir) => ({
32
+ languageOptions: {
33
+ parserOptions: {
34
+ projectService: true,
35
+ tsconfigRootDir: projectDir,
36
+ },
37
+ },
38
+ rules: {
39
+ "@typescript-eslint/strict-boolean-expressions": [
40
+ "error",
41
+ {
42
+ // Require explicit boolean checks - critical for AI-generated code safety
43
+ allowString: false, // Prevent truthy string checks
44
+ allowNumber: false, // Prevent truthy number checks
45
+ allowNullableObject: false, // Require explicit null checks
46
+ allowNullableBoolean: false,
47
+ allowNullableString: false,
48
+ allowNullableNumber: false,
49
+ allowAny: false, // Critical: prevent `any` in conditions
50
+ },
51
+ ],
52
+ },
53
+ });
54
+ //# sourceMappingURL=strict-rules.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shared ignore patterns for ESLint configurations
3
+ *
4
+ * This module defines the standard ignore patterns used across all ESLint
5
+ * configurations in the monorepo to ensure consistent behavior
6
+ * and avoid linting generated files, build outputs, and dependencies.
7
+ */
8
+ /**
9
+ * Standard ignore patterns for all ESLint configurations.
10
+ *
11
+ * These patterns exclude common build outputs, generated files,
12
+ * and dependencies that should not be linted.
13
+ */
14
+ export declare const sharedIgnores: string[];
15
+ //# sourceMappingURL=shared-ignores.d.ts.map