Skip to content

New lint rule to disallow named function expressions #3792

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

Merged
merged 5 commits into from
Apr 22, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Apr 18, 2019

A follow up of #3162, #3162 (comment) and the discussion with @etpinard concerning redundant and sometime confusing function names this PR adds a new lint rule to disallow extra function names when they are not required. Image below illustrates one example where the function is named put and exported as get.

Sieve.prototype.get = function put(position, value) {

Screenshot from 2019-04-18 16-38-50

@plotly/plotly_js

@etpinard
Copy link
Contributor

Ah ooops. I think I might have unestimated what adding this new rule meant this morning (in-person convo)

I very much dislike removing the function names from things we export off module.exports e.g.:

image

@etpinard
Copy link
Contributor

@archmoj maybe https://eslint.org/docs/rules/func-name-matching would give better results.

@archmoj
Copy link
Contributor Author

archmoj commented Apr 19, 2019

@archmoj maybe https://eslint.org/docs/rules/func-name-matching would give better results.

Awesome! That one was able to detect the mismatches: 6d1609a.

@etpinard
Copy link
Contributor

Ok. Nicely done 💃

@archmoj archmoj merged commit 36b4773 into master Apr 22, 2019
@archmoj archmoj deleted the eslint-name-functions branch April 22, 2019 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants