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

Buffer.slice is deprecated #40

Closed
jimmywarting opened this issue Aug 7, 2022 · 6 comments · Fixed by #272
Closed

Buffer.slice is deprecated #40

jimmywarting opened this issue Aug 7, 2022 · 6 comments · Fixed by #272

Comments

@jimmywarting
Copy link

It was bad that they overrided it in the first place...
https://nodejs.org/dist/latest-v18.x/docs/api/buffer.html#bufslicestart-end

Buffer don't even have a slice method that did the correct thing. slice is only an alias for subarray. and subarray is what ppl should have been using instead.

@aladdin-add
Copy link

PRs are welcome! 👍

@scagood
Copy link

scagood commented Feb 23, 2024

I have been thinking about this one while updating the es-syntax.

I think we should look to move definePrototypeMethodHandler from eslint-plugin-es-x into @eslint-community/eslint-utils

I think its the best solution to adding prototype deprecation warnings. The one change I would make would be to make the callback required. 🤔

I was looking for a similar thing here too -- #180 (comment)

Something like:

import { definePrototypeMethodHandler } from "@eslint-community/eslint-utils"

definePrototypeMethodHandler(
  context,
  { Buffer: ["slice"] },
  ({ node }) => context.report({
    node: node,
    messageId: "buffer#slice-deprecated"
  }),
)

What do you think @aladdin-add?

@aladdin-add
Copy link

Is this still an issue? @scagood

@scagood
Copy link

scagood commented May 10, 2024

I think it's a great thing to do... But I am not sure about the feasibility of it.

I think it'd be great to track the prototypal depreciation and support, but I am starting to think it may be a little too hard 😔

@aladdin-add
Copy link

Well, let's just document its limitations, and close this one. :)

@scagood
Copy link

scagood commented May 10, 2024

Yeah, agreed.

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