dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Update ESLint configuration for json5 files

Open alanorth opened this issue 1 year ago • 3 comments

References

  • Related to #2306
  • Closes #2309

Description

Update the ESLint configuration for json5 files to enforce a certain style that we can automatically verify and enforce for all future commits, pull requests, etc.

Note: after merging this, all i18n JSON5 files will need to be fixed using yarn lint --fix, or it can be done as part of this.

Instructions for Reviewers

List of changes in this PR:

  • Use plugin:jsonc/recommended-with-json5 instead of plugin:jsonc/recommended-with-jsonc
  • Use jsonc/no-irregular-whitespace plugin instead of ESLint's no-irregular-whitespace
  • Use no-multiple-empty-lines plugin to enforce one blank line in between content
  • Use comma-spacing plugin to disallow content like this ,

We need to decide:

  • If the proposed configuration for no-multiple-empty-lines is what we want, ie do we want to enforce one blank line as the standard to maintain human readability?
  • If I should apply yarn lint --fix to all i18n JSON5 files as part of this pull request

Checklist

  • [x] 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.
  • [x] My PR passes ESLint validation using yarn lint
  • [x] My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • [x] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • [x] My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • [x] 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.
  • [x] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • [x] If my PR fixes an issue ticket, I've linked them together.

alanorth avatar Jun 16 '23 06:06 alanorth

I will restart the discussion on this after DSpace 7.6 gets released. In that time it would be good to think about the irregular space rule and the one blank line rule so we can start enforcing style in CI lint tests.

alanorth avatar Jun 16 '23 17:06 alanorth

@alanorth some tests failing but a rebase will probably fix them i imagine. i'll give this a check

kshepherd avatar Feb 06 '24 21:02 kshepherd

Thanks @kshepherd. I've rebased on latest main and the tests are running now. Let's see...

alanorth avatar Feb 07 '24 03:02 alanorth