Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests - Generic/ESLint: fix test #436

Merged
merged 1 commit into from Apr 6, 2024
Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Apr 6, 2024

Description

ESLint has released a new major which no longer supports the .eslintrc.json config format by default.

To still allow for that format, an ESLINT_USE_FLAT_CONFIG environment variable has to be set to false.

This change is causing the tests for the Generic.Debug.ESLint sniff to fail.

Setting the environment variable fixes this.

This is a test-only change for the following reasons:

  • If end-users use this sniff, they are responsible for using the correct configuration for the version of ESLint they are using.
  • The sniff is deprecated and preferably end-users should move away from using the sniff and run the tool directly.
  • As the sniff is deprecated, no time has been spend to add support for the new ESLint configuration format to the sniff. A simple patch to add this support would be accepted as long as PHPCS 4.0 has not been released yet, but maintainers will not spend time on this as the sniff will be removed sooner rather than later.

As an alternative, it was considered to limit the version of ESLint being installed in the GH Actions workflow to version 8 of ESlint, but the change as made now is better IMO as it proves that the ESLint sniff does still work on 9, even though only for the old configuration formats.

Refs:

Suggested changelog entry

Maybe a note that ESLint >= 9.0 is not supported unless the "old" ESLint configuration formats are being used in combination with setting ESLINT_USE_FLAT_CONFIG=false ?

ESLint has released a new major which no longer supports the `.eslintrc.json` config format by default.

To still allow for that format, an `ESLINT_USE_FLAT_CONFIG` environment variable has to be set to `false`.

This change is causing the tests for the `Generic.Debug.ESLint` sniff to fail.

Setting the environment variable fixes this.

This is a test-only change for the following reasons:
* If end-users use this sniff, they are responsible for using the correct configuration for the version of ESLint they are using.
* The sniff is deprecated and preferably end-users should move away from using the sniff and run the tool directly.
* As the sniff is deprecated, no time has been spend to add support for the new ESLint configuration format to the sniff.
    A simple patch to add this support would be accepted as long as PHPCS 4.0 has not been released yet, but maintainers will not spend time on this as the sniff will be removed sooner rather than later.

As an alternative, it was considered to limit the version of `ESLint` being installed in the GH Actions workflow to version 8 of ESlint, but the change as made now is better IMO as it proves that the ESLint sniff does still work on 9, even though only for the old configuration formats.

Refs:
* https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#flat-config-is-now-the-default-and-has-some-changes
* https://eslint.org/docs/latest/use/migrate-to-9.0.0#-new-default-config-format-eslintconfigjs
@jrfnl jrfnl added this to the 3.9.2 milestone Apr 6, 2024
@jrfnl jrfnl merged commit dbfe1c3 into master Apr 6, 2024
40 checks passed
@jrfnl jrfnl deleted the feature/ghactions-fix-build branch April 6, 2024 17:32
@fredden
Copy link
Member

fredden commented Apr 8, 2024

Note that the old configuration format is scheduled to be removed completely in version 10 of eslint, so this change only works for v9 and under.

@jrfnl
Copy link
Member Author

jrfnl commented Apr 8, 2024

@fredden Good point, though I really, really, really am hoping that we'll have PHPCS 4.0 released by that time in which these type of sniffs will be removed anyhow. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants