Skip to content

Commit 10d2164

Browse files
justin808claude
andauthored
Remove package/** ignore from fast ESLint config after #644 resolution (#821)
## Summary Removes the `package/**` ignore pattern from `eslint.config.fast.js` now that issue #644 has been resolved. The fast config can now lint TypeScript files alongside the main config. ## Changes - **Removed**: `"package/**"` ignore pattern that was blocking all TypeScript files - **Added**: Specific ignores for generated files (`*.js`, `*.d.ts`) matching main config - **Added**: TypeScript-specific rule overrides matching main config structure: - Global TypeScript rules (no-undef, no-require-imports) - File-specific overrides for config.ts, babel/preset.ts - Module overrides for configExporter, utils, environments, plugins, etc. - Type test overrides for intentionally unused variables - **Added**: Global rules (no-console, no-restricted-syntax) for consistency ## Verification ✅ Fast config now lints all TypeScript source files in `package/` ✅ Passes with 0 errors (verified with `ESLINT_USE_FLAT_CONFIG=true npx eslint --config eslint.config.fast.js .`) ✅ Main config still passes (`yarn lint`) ✅ Provides faster feedback by skipping type-aware rules while maintaining consistency ## Related Issues - Closes #644 (referenced in TODO comment) - Related to #783 (TypeScript ESLint technical debt tracking) ## Test Plan - [x] Run `yarn lint` - passes with 0 errors - [x] Run fast config directly - passes with 0 errors - [x] Verify TypeScript files are linted in fast mode - [x] Verify generated files (.js, .d.ts) are still ignored 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated linting configuration to optimize build tooling and relax certain code style rules for specific packages, improving development workflow consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5ed4088 commit 10d2164

1 file changed

Lines changed: 120 additions & 8 deletions

File tree

eslint.config.fast.js

Lines changed: 120 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ module.exports = [
1717
// Global ignores (replaces .eslintignore)
1818
{
1919
ignores: [
20-
"lib/**",
21-
"**/node_modules/**",
22-
"vendor/**",
23-
"spec/**",
24-
"package/**" // TODO: Remove after issue #644 is resolved (lints package/ TS source files)
20+
"lib/**", // Ruby files, not JavaScript
21+
"**/node_modules/**", // Third-party dependencies
22+
"vendor/**", // Vendored dependencies
23+
"spec/**", // Ruby specs, not JavaScript
24+
"package/**/*.js", // Generated/compiled JavaScript from TypeScript
25+
"package/**/*.d.ts" // Generated TypeScript declaration files
2526
]
2627
},
2728

@@ -63,7 +64,11 @@ module.exports = [
6364
"import/no-extraneous-dependencies": "off",
6465
// TypeScript handles extensions, not needed for JS imports
6566
"import/extensions": "off",
66-
indent: ["error", 2]
67+
indent: ["error", 2],
68+
// Allow for...of loops - modern JS syntax
69+
"no-restricted-syntax": "off",
70+
// Allow console statements - used for debugging/logging throughout
71+
"no-console": "off"
6772
},
6873
settings: {
6974
react: {
@@ -130,13 +135,120 @@ module.exports = [
130135
"@typescript-eslint/no-use-before-define": ["error"],
131136
"@typescript-eslint/no-unused-vars": [
132137
"error",
133-
{ argsIgnorePattern: "^_" }
138+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }
134139
],
135140
"@typescript-eslint/no-explicit-any": "error",
136-
"@typescript-eslint/explicit-module-boundary-types": "off"
141+
"@typescript-eslint/explicit-module-boundary-types": "off",
142+
"no-undef": "off"
137143
}
138144
},
139145

146+
// Global rule for all TypeScript files in package/
147+
// Suppress require() imports - these are intentional for CommonJS compatibility
148+
// Will be addressed in Phase 3 (breaking changes) - see #708
149+
{
150+
files: ["package/**/*.ts"],
151+
rules: {
152+
"@typescript-eslint/no-require-imports": "off",
153+
"global-require": "off",
154+
"import/no-import-module-exports": "off"
155+
}
156+
},
157+
158+
// Consolidated override for package/config.ts and package/babel/preset.ts
159+
{
160+
files: ["package/babel/preset.ts", "package/config.ts"],
161+
rules: {
162+
"@typescript-eslint/no-unused-vars": "off",
163+
"import/order": "off",
164+
"import/newline-after-import": "off",
165+
"import/first": "off",
166+
"@typescript-eslint/no-explicit-any": "off",
167+
"no-useless-escape": "off"
168+
}
169+
},
170+
171+
// configExporter module overrides
172+
{
173+
files: ["package/configExporter/**/*.ts"],
174+
rules: {
175+
"@typescript-eslint/no-use-before-define": "off",
176+
"import/no-dynamic-require": "off",
177+
"class-methods-use-this": "off",
178+
"import/prefer-default-export": "off",
179+
"no-underscore-dangle": "off",
180+
"no-restricted-globals": "off",
181+
"@typescript-eslint/no-unused-vars": "off",
182+
"@typescript-eslint/no-explicit-any": "off"
183+
}
184+
},
185+
186+
// Utils module overrides
187+
{
188+
files: [
189+
"package/utils/inliningCss.ts",
190+
"package/utils/errorCodes.ts",
191+
"package/utils/errorHelpers.ts",
192+
"package/utils/pathValidation.ts",
193+
"package/utils/getStyleRule.ts",
194+
"package/utils/helpers.ts",
195+
"package/utils/validateDependencies.ts",
196+
"package/webpackDevServerConfig.ts"
197+
],
198+
rules: {
199+
"@typescript-eslint/no-explicit-any": "off",
200+
"no-useless-escape": "off"
201+
}
202+
},
203+
204+
// Plugins and optimization overrides
205+
{
206+
files: ["package/plugins/**/*.ts", "package/optimization/**/*.ts"],
207+
rules: {
208+
"import/prefer-default-export": "off"
209+
}
210+
},
211+
212+
// Rules, rspack, swc, esbuild, and other modules
213+
{
214+
files: [
215+
"package/index.ts",
216+
"package/rspack/index.ts",
217+
"package/rules/**/*.ts",
218+
"package/swc/index.ts",
219+
"package/esbuild/index.ts",
220+
"package/dev_server.ts",
221+
"package/env.ts"
222+
],
223+
rules: {
224+
"@typescript-eslint/no-unused-vars": "off",
225+
"import/prefer-default-export": "off",
226+
"no-underscore-dangle": "off"
227+
}
228+
},
229+
230+
// Environments module overrides
231+
{
232+
files: ["package/environments/**/*.ts"],
233+
rules: {
234+
"import/prefer-default-export": "off",
235+
"no-underscore-dangle": "off"
236+
}
237+
},
238+
239+
// Type tests are intentionally unused - they test type compatibility
240+
{
241+
files: ["package/**/__type-tests__/**/*.ts"],
242+
rules: {
243+
"@typescript-eslint/no-unused-vars": "off"
244+
}
245+
},
246+
247+
// Note: Type-aware rule overrides from main config (e.g., @typescript-eslint/no-unsafe-*,
248+
// @typescript-eslint/restrict-template-expressions) are intentionally omitted here since
249+
// fast mode doesn't enable type-aware linting (no parserOptions.project specified).
250+
// This keeps fast mode performant while maintaining consistency for non-type-aware rules.
251+
140252
// Prettier config must be last to override other configs
141253
prettierConfig
142254
]

0 commit comments

Comments
 (0)