refactor: extract shared ESLint config and add lint scripts#4459
refactor: extract shared ESLint config and add lint scripts#4459JessenReinhart wants to merge 3 commits into
Conversation
Addresses discussion less#3787 by extracting shared ESLint rules to config/eslint/base.cjs and adding lint/lint:fix npm scripts. Changes: - Created config/eslint/base.cjs with common ESLint rules - Updated packages/less/.eslintrc.cjs to extend the shared config - Added lint and lint:fix scripts to root package.json The shared config maintains compatibility with both JS and TS files. TypeScript-specific recommended rules are scoped to .ts files only to avoid noise in legacy .js source files. Verified: pnpm run lint passes with zero errors, 139/139 unit tests pass (pre-commit hook failed only on unrelated port conflict).
Auto-generated by 'pnpm run lint:fix' using the new shared config. Touches only quote style and indentation; no logic changes. - benchmark/benchmark-runner.js: indent - build/rollup.js: quotes (backtick -> single) - lib/less-node/environment.js: indent - lib/less/tree/nested-at-rule.js: indent
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughA shared ESLint base config is added and consumed by ChangesESLint base config and lint tooling
Package ESLint config and source cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.0)packages/less/benchmark/benchmark-runner.jsFile contains syntax errors that prevent linting: Line 134: expected 🔧 ESLint
packages/less/benchmark/benchmark-runner.jsParsing error: '}' expected. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/eslint/base.cjs (1)
11-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winScope
mochato the test override. Keepingenv.mocha = truein the shared base makesdescribe/itlegal in every file. Move it into thetestoverride so production sources still getno-undefprotection.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@config/eslint/base.cjs` around lines 11 - 15, The shared ESLint base config currently enables mocha globally, which makes test globals available in all files. Move the mocha environment setting out of the base env block and into the existing test override in base.cjs so only test files get describe/it, while production code still benefits from no-undef; use the env sections in the base config and the test override as the places to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@config/eslint/base.cjs`:
- Around line 11-15: The shared ESLint base config currently enables mocha
globally, which makes test globals available in all files. Move the mocha
environment setting out of the base env block and into the existing test
override in base.cjs so only test files get describe/it, while production code
still benefits from no-undef; use the env sections in the base config and the
test override as the places to update.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e252831e-e4dd-419d-b489-0908dfd0ec81
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
config/eslint/base.cjspackage.jsonpackages/less/.eslintrc.cjspackages/less/benchmark/benchmark-runner.jspackages/less/build/rollup.jspackages/less/lib/less-node/environment.jspackages/less/lib/less/tree/nested-at-rule.js
Addresses docstring coverage warning in PR less#4459 by adding full JSDoc to all functions in the benchmark-runner script.
Summary
Addresses discussion #3787 by extracting shared ESLint rules to a central config location.
Changes
Commit 1: ESLint configuration setup
config/eslint/base.cjswith common ESLint rulespackages/less/.eslintrc.cjsto extend the shared configlintandlint:fixscripts to rootpackage.json.tsfiles only to avoid noise in legacy.jsfilesCommit 2: Auto-formatting
pnpm run lint:fixusing the new shared configTesting
pnpm run lintpasses with zero errorsNote
The pre-commit hook (
pnpm test) fails locally due to a port 8081 conflict (unrelated to these changes). Tests pass successfully when run manually.References:
Summary by CodeRabbit
New Features
Chores