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

Align ESLint rules with oldest supported Node.js version #4646

Open
watson opened this issue Sep 2, 2024 · 1 comment
Open

Align ESLint rules with oldest supported Node.js version #4646

watson opened this issue Sep 2, 2024 · 1 comment
Labels
dev-ex Developer Experience

Comments

@watson
Copy link
Collaborator

watson commented Sep 2, 2024

Node.js doesn't 100% align with a specific ECMAScript version, since it adds support for certain features before a given version of ECMAScript is published. E.g. private class properties has been in Node.js since version 12, but didn't appear in ECMAScript before version 2022.

To ensure our ESLint config aligns with the versions of Node.js that we want to support instead of a specific ECMAScript version we rely on the Node.js module eslint-plugin-n to enable/disable the rules needed to target the desired Node.js version.

However, this doesn't seem like it actually works as intended: Take the example of private class properties. We're supposed to have support for these in the dd-trace-js code base, but ESLint complains if we try to use them. So something in our ESLint config is set up correctly.

@watson watson added the dev-ex Developer Experience label Sep 2, 2024
@rochdev
Copy link
Member

rochdev commented Sep 4, 2024

One important thing to note is that we also need to use only features that are supported by the oldest transpilers we support as well. For example, some features might be available in Node 16 but not necessarily in older versions of Webpack, which would prevent transpiling when using those versions. It might be worth it to add tests for these cases before making any changes to eslint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-ex Developer Experience
Projects
None yet
Development

No branches or pull requests

2 participants