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

Drop support for Node.js 14 #4447

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus/nodejs.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest

USER root

ARG NODE_VERSION=14
ARG NODE_VERSION=16

RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && apt-get install -y nodejs=${NODE_VERSION}.*

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"homepage": "https:/SonarSource/SonarJS#readme",
"engines": {
"node": ">=14"
"node": "^16.0.0 || >=18.0.0"
},
"type": "commonjs",
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@
public class NodeDeprecationWarning {

static final Map<Integer, String> REMOVAL_DATE = Map.ofEntries(
entry(14, "May 1st, 2023"),
entry(15, "May 1st, 2023"),
entry(16, "Nov 30th, 2023"),
entry(17, "Nov 30th, 2023")
entry(16, "Jan 31th, 2024"),
entry(17, "Jan 31th, 2024")
);

private static final Logger LOG = Loggers.get(NodeDeprecationWarning.class);
Expand All @@ -56,10 +54,10 @@ public class NodeDeprecationWarning {
* The minor version is a requirement from the ESLint version that the bridge uses.
* @see https:/eslint/eslint/blob/d75d3c68ad8c98828aaa522b87ec267ab2dcb002/package.json#L169
*/
static final Version MIN_SUPPORTED_NODE_VERSION = Version.create(14, 17, 0);
static final Version MIN_SUPPORTED_NODE_VERSION = Version.create(16, 0, 0);
static final int MIN_RECOMMENDED_NODE_VERSION = 18;
static final List<Integer> RECOMMENDED_NODE_VERSIONS = Arrays.asList(18, 20);
static final List<Integer> ALL_RECOMMENDED_NODE_VERSIONS = Arrays.asList(14, 16, 18, 20);
static final List<Integer> ALL_RECOMMENDED_NODE_VERSIONS = Arrays.asList(16, 18, 20);
private final AnalysisWarningsWrapper analysisWarnings;

public NodeDeprecationWarning(AnalysisWarningsWrapper analysisWarnings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,44 +50,26 @@ public void addUnique(String text) {
TestAnalysisWarnings analysisWarnings = new TestAnalysisWarnings();
NodeDeprecationWarning deprecationWarning = new NodeDeprecationWarning(analysisWarnings);

@Test
void test_14() {
deprecationWarning.logNodeDeprecation(14);
assertWarnings(
"Using Node.js version 14 to execute analysis is deprecated and will stop being supported no earlier than May 1st, 2023. " +
"Please upgrade to a newer LTS version of Node.js [18, 20]"
);
}

@Test
void test_recommended() {
deprecationWarning.logNodeDeprecation(18);
deprecationWarning.logNodeDeprecation(20);
assertWarnings();
}

@Test
void test_15() {
deprecationWarning.logNodeDeprecation(15);
assertWarnings(
"Using Node.js version 15 to execute analysis is deprecated and will stop being supported no earlier than May 1st, 2023. Please upgrade to a newer LTS version of Node.js [18, 20]",
"Node.js version 15 is not recommended, you might experience issues. Please use a recommended version of Node.js [18, 20]"
);
}

@Test
void test_16() {
deprecationWarning.logNodeDeprecation(16);
assertWarnings(
"Using Node.js version 16 to execute analysis is deprecated and will stop being supported no earlier than Nov 30th, 2023. Please upgrade to a newer LTS version of Node.js [18, 20]"
"Using Node.js version 16 to execute analysis is deprecated and will stop being supported no earlier than Jan 31th, 2024. Please upgrade to a newer LTS version of Node.js [18, 20]"
);
}

@Test
void test_17() {
deprecationWarning.logNodeDeprecation(17);
assertWarnings(
"Using Node.js version 17 to execute analysis is deprecated and will stop being supported no earlier than Nov 30th, 2023. Please upgrade to a newer LTS version of Node.js [18, 20]",
"Using Node.js version 17 to execute analysis is deprecated and will stop being supported no earlier than Jan 31th, 2024. Please upgrade to a newer LTS version of Node.js [18, 20]",
"Node.js version 17 is not recommended, you might experience issues. Please use a recommended version of Node.js [18, 20]"
);
}
Expand Down