Skip to content

Commit

Permalink
JS-371 - Deprecate Node.js 18 (#4913)
Browse files Browse the repository at this point in the history
Co-authored-by: Yassin Kammoun <[email protected]>
  • Loading branch information
1 parent 48fef6c commit 1024c59
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,26 @@ If you want to report a bug, request a feature, or provide other kind of feedbac

# Contributing

#### 1. Request a new feature
## Prerequisites

To work on this project, it is required to have the following tools installed:

- [JDK 17](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/what-is-corretto-17.html)
- [Node.js](https://nodejs.org/en) >= 22
- [npm](https://www.npmjs.com/) >= 8
- [Maven](https://maven.apache.org/) >= 3.8

## How-to

### 1. Request a new feature

To request a new feature, create a new thread in [SonarSource Community Forum](https://community.sonarsource.com/). Even if you plan to implement it yourself and submit it back to the community, please create a thread to be sure that we can follow up on it.

#### 2. Pull Request
### 2. Pull Request

To submit a contribution, create a pull request for this repository. Please make sure that you follow our [code style](https://github.com/SonarSource/sonar-developer-toolset) and that all [tests](/docs/DEV.md#testing) are passing.

#### Work with us
## Work with us

Would you like to work on this project full-time? We are hiring! Check out https://www.sonarsource.com/hiring

Expand Down
9 changes: 6 additions & 3 deletions docs/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

## Prerequisites

To work on this project, it is required to have the following tools installed:

- [JDK 17](https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/what-is-corretto-17.html)
- [Maven](https://maven.apache.org/install.html)
- Node.js (we recommend using [NVM](https://github.com/nvm-sh/nvm#installing-and-updating))
- [Node.js](https://nodejs.org/en) >= 22
- [npm](https://www.npmjs.com/) >= 8
- [Maven](https://maven.apache.org/) >= 3.8

You can also use Docker container defined in `./.cirrus/nodejs-lts.Dockerfile` which bundles all required dependencies and is used for our CI pipeline.
You can also use Docker container defined in `./.cirrus/nodejs.Dockerfile` which bundles all required dependencies and is used for our CI pipeline.

## Build and run unit tests

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"homepage": "https://github.com/SonarSource/SonarJS#readme",
"engines": {
"node": "^18.17.0 || ^20.9.0 || >=21.1.0"
"node": ">=22"
},
"type": "module",
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class NodeDeprecationWarning {
*/
static final Version MIN_SUPPORTED_NODE_VERSION = Version.create(18, 17, 0);

private static final int MIN_RECOMMENDED_NODE_VERSION = 18;
private static final List<String> RECOMMENDED_NODE_VERSIONS = List.of("^18.18.0", "^20.9.0", "^22.9.0");
private static final int MIN_RECOMMENDED_NODE_VERSION = 20;
private static final List<String> RECOMMENDED_NODE_VERSIONS = List.of("^20.9.0", "^22.9.0");
private final AnalysisWarningsWrapper analysisWarnings;

public NodeDeprecationWarning(AnalysisWarningsWrapper analysisWarnings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void test_unsupported() {
deprecationWarning.logNodeDeprecation(16);
assertWarnings(
"Using Node.js version 16 to execute analysis is not supported. " +
"Please upgrade to a newer LTS version of Node.js: [^18.18.0, ^20.9.0, ^22.9.0].");
"Please upgrade to a newer LTS version of Node.js: [^20.9.0, ^22.9.0].");
}

@Test
Expand All @@ -57,7 +57,8 @@ void test_supported() {
deprecationWarning.logNodeDeprecation(20);
deprecationWarning.logNodeDeprecation(21);
deprecationWarning.logNodeDeprecation(22);
assertWarnings();
assertWarnings("Using Node.js version 18 to execute analysis is not supported. " +
"Please upgrade to a newer LTS version of Node.js: [^20.9.0, ^22.9.0].");
}

private void assertWarnings(String... messages) {
Expand Down

0 comments on commit 1024c59

Please sign in to comment.