Skip to content

Migrate ESLint config from .eslintrc.json to flat config (eslint.conf…#5161

Open
JorgeEscire wants to merge 1 commit intoDSpace:mainfrom
JorgeEscire:Issue/5056
Open

Migrate ESLint config from .eslintrc.json to flat config (eslint.conf…#5161
JorgeEscire wants to merge 1 commit intoDSpace:mainfrom
JorgeEscire:Issue/5056

Conversation

@JorgeEscire
Copy link

References

Fixes #5056

Description

This PR migrates the ESLint configuration from the legacy .eslintrc.json format to the new flat config format (eslint.config.mjs).

ESLint 9 introduced flat config files as the new default, and ESLint 10 will remove .eslintrc.json support entirely (see ESLint 10 announcement). This PR proactively converts our configuration to ensure future compatibility.

Additionally, this PR fixes Windows path resolution issues in the custom DSpace ESLint plugins (theme-support.ts and typescript.ts) where globSync results and file paths were not being normalized to Unix-style paths, causing 8 test failures on Windows.

Instructions for Reviewers

  1. Run npm install to install new dependencies (@eslint/js, typescript-eslint, angular-eslint)
  2. Run npm run build:lint to compile custom ESLint plugins
  3. Run npm run test:lint:nobuild to verify all 169 custom rule tests pass
  4. Run npm run lint:nobuild to verify linting works with the new flat config
  5. Run ng lint --fix=true to verify autofix still works

List of changes in this PR

  • Deleted .eslintrc.json (legacy format)
  • Created eslint.config.mjs (flat config format) with all existing rules preserved
  • Added @eslint/js, typescript-eslint, and angular-eslint devDependencies for flat config helpers
  • Fixed Windows path normalization in lint/src/util/theme-support.ts (globSync results and getFileTheme())
  • Fixed Windows path normalization in lint/src/util/typescript.ts (fromSrc())

Checklist

  • My PR is created against the main branch of code
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR includes details on how to test it.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

…ig.mjs) and fix Windows path resolution in custom lint plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

Migrate deprecated .eslintrc.json to Flat Config for ESLint 10 compatibility

3 participants