Skip to content

Migrate ESLint config from .eslintrc.json to flat config#5346

Open
oscar-escire wants to merge 4 commits into
DSpace:mainfrom
oscar-escire:Issue/5056
Open

Migrate ESLint config from .eslintrc.json to flat config#5346
oscar-escire wants to merge 4 commits into
DSpace:mainfrom
oscar-escire:Issue/5056

Conversation

@oscar-escire

@oscar-escire oscar-escire commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

References

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 (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • 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.

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

Hi @oscar-escire,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

# Conflicts:
#	.eslintrc.json
#	package-lock.json
#	package.json
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

Hi @oscar-escire,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

1 similar comment
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

Hi @oscar-escire,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

# Conflicts:
#	package-lock.json
#	package.json
@github-actions

Copy link
Copy Markdown

Hi @oscar-escire,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@lgeggleston lgeggleston moved this to 🙋 Needs Reviewers Assigned in DSpace 11.0 Release Jun 2, 2026
Comment thread eslint.config.mjs
Comment on lines +81 to +85
'no-console': [
'error',
{
'allow': [
'log',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous .eslintrc.json, the 'log' statement was not allowed, and it looks like this was also introduced by your team in a previous PR 🙂 #5089

Could we keep the same behavior here and remove log from the allow list?

@github-project-automation github-project-automation Bot moved this from 🙋 Needs Reviewers Assigned to 👀 Under Review in DSpace 11.0 Release Jul 24, 2026
@MMilosz
MMilosz self-requested a review July 24, 2026 16:20
@MMilosz

MMilosz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

During the review, I noticed that the README.md still mentions tslint.json, but this file has not been used since 2022 (see: 245977a) (I mean, it was deleted).

In your PR, could you update the line below to reference eslint.config.mjs instead?

├── tslint.json * TSLint (https://palantir.github.io/tslint/) configuration

Comment thread .eslintrc.json
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@smarttools/rxjs/recommended-legacy"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one (@smarttools/rxjs/recommended-legacy) was also not migrated, could you ensure it's included in the new config so we keep the same linting behavior as before?

@MMilosz

MMilosz commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Apart from my previous few comments, I completed the steps listed under the 'Instructions for Reviewers', confirming that:

  • npm install completed successfully, and the new dependencies were verified with npm list @eslint/js typescript-eslint angular-eslint
  • npm run build:lint completed successfully
  • npm run test:lint:nobuild passed: 169 specs, 0 failures
  • npm run lint:nobuild completed successfully with warning only (no errors)
  • ng lint --fix=true also completed succesfully with warning only, applying fixes to 77 files, confirming that autofix still works

Everything else looks good, and the Windows path normalization fixes are a great addition, they should help ensure the linting behaves consistently across platforms

@MMilosz
MMilosz self-requested a review July 24, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 👀 Under Review

Development

Successfully merging this pull request may close these issues.

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

3 participants