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

[Feature Request] Get functions/methods from 3rd parties #6

Open
levz0r opened this issue Jun 15, 2021 · 8 comments
Open

[Feature Request] Get functions/methods from 3rd parties #6

levz0r opened this issue Jun 15, 2021 · 8 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@levz0r
Copy link

levz0r commented Jun 15, 2021

Versions

  • ESLint Version: v7.24.0
  • Plugin Version: v2.2.0
  • Node Version: v12.18.4 (Plugin require >= latest lts version)
  • Operating System: MacOS 11.3.1

Expected Behavior

The plugin should not warn when functions are not snake case in a 3rd party packages.

Actual Behavior

The plugin warns when functions are not snake case in a 3rd party packages.

Steps to Reproduce

  1. Enable plugin
const fs = require("fs");
fs.readFileSync(...)
      ^
     warning

Screenshots (Optional)

image

@ptkdev ptkdev self-assigned this Jun 19, 2021
@ptkdev ptkdev added the wontfix This will not be worked on label Jun 19, 2021
@ptkdev
Copy link
Owner

ptkdev commented Jun 19, 2021

Use white-list

@ptkdev ptkdev closed this as completed Jun 19, 2021
@levz0r
Copy link
Author

levz0r commented Jun 19, 2021 via email

@ptkdev
Copy link
Owner

ptkdev commented Jun 21, 2021

Hi @levz0r !
You need read documentation of 3rd party packages, create an array, example ["readFileSync", "exampleFunc", "otherFunc"] and create whitelist in eslint dotfile. You can fork this repo and add this list in plugin.js and send me pull request.

.eslintrc.json

{
    "plugins": [
        "snakecasejs"
    ],
    "settings":
    {
        "snakecasejs/whitelist": ["readFileSync", "exampleFunc", "otherFunc"]
    },
    "rules":
    {
        "snakecasejs/snakecasejs": "error"
    }
}

@levz0r
Copy link
Author

levz0r commented Jun 21, 2021 via email

@ptkdev
Copy link
Owner

ptkdev commented Jun 23, 2021

@levz0r don't exist a way in javascript to get all methods/function from 3rd parties. I write all methods/functions manually in this plugin. If you find way to get v8 methods/functions or get it from 3rd parties you are welcome with PR. If you want add missing methods/functions in plugin.js and send PR you are welcome.

@ptkdev ptkdev added the help wanted Extra attention is needed label Jun 23, 2021
@ptkdev ptkdev changed the title Ignore external violations Get functions/methods from 3rd parties Jun 23, 2021
@ptkdev ptkdev removed the wontfix This will not be worked on label Jun 23, 2021
@ptkdev ptkdev changed the title Get functions/methods from 3rd parties [Feature Request] Get functions/methods from 3rd parties Jun 23, 2021
@ptkdev ptkdev reopened this Jun 23, 2021
@purefan
Copy link

purefan commented Aug 15, 2022

@ptkdev is there a way to namespace the white list? for example, it is ok to ignore fs.readFileSync but if we whitelist readFileSync it applies to every instance of readFileSync, even if for some reason our project makes our own readFileSync function

What information do you get from eslint? is there anything we can use there?

edit: another example is passportjs it has a function serializeUser, but it would be a bad idea to add that to the plugin.js in a pull request

@blakerutledge
Copy link

Can't you just exclusively lint the function and variable names that are declared in the user's code?

Right now this is linting everything, even when I do anything like:

import { fileURLToPath } from 'url'

gets linted to:

import { file_u_r_l_to_path } from 'url'

which is clearly broken, as that module does not export a function by that name.

@phil294
Copy link

phil294 commented Apr 27, 2024

on top of that, even external_object.externalMethod() gets changed to external_object.external_method() so it's basically not usable :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants