-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add id-length
ESLint rule
#1982
Conversation
@@ -12,12 +12,14 @@ const getFeatureFlag = function (name) { | |||
return { [name]: true } | |||
} | |||
|
|||
/* eslint-disable id-length */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature flags are often long, and that's ok.
@@ -1,4 +1,5 @@ | |||
const { | |||
// eslint-disable-next-line id-length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an external environment variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't go over all the changes, since I wanted to start a discussion.
Min length makes sense, but max length can be too restricting.
I added some comments where the previous version was more explicit and readable (to me).
Please let me know what you think
packages/build/src/core/constants.js
Outdated
@@ -82,12 +82,12 @@ const getEdgeHandlersSrc = async function (edgeHandlers, buildDir) { | |||
return edgeHandlers | |||
} | |||
|
|||
if (await isDirectory(`${buildDir}/${DEFAULT_EDGE_HANDLERS_SRC}`)) { | |||
return DEFAULT_EDGE_HANDLERS_SRC | |||
if (await isDirectory(`${buildDir}/${DEFAULT_HANDLERS_SRC}`)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The longer name is more explicit here and I think it is better, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -2,18 +2,18 @@ const { dirname } = require('path') | |||
|
|||
const readdirp = require('readdirp') | |||
|
|||
const { logInstallFunctionDependencies } = require('../log/messages/install') | |||
const { logInstallFunctionDeps } = require('../log/messages/install') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[sand] I prefer the non abbreviated logInstallFunctionDependencies
name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -17,13 +17,13 @@ const logMissingPluginsWarning = function (logs, packages) { | |||
logArray(logs, packages, { color: THEME.errorSubHeader }) | |||
} | |||
|
|||
const logInstallLocalPluginsDeps = function (logs, localPluginsOptions) { | |||
const logInstallLocalDeps = function (logs, localPluginsOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the longer name makes sense here, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This makes sense 👍 What would you prefer?
Both solutions sound good to me 👍 |
I would go with this one, haven't seen many cases with a very long name that wasn't justified. |
1ee8dc3
to
9afcc3f
Compare
Sounds good, I have removed the |
Done as part of #2004. |
This adds the
id-length
ESLint rule.Even with autocompletion, long variables can be annoying. On the other hand, too short variables can be obscure. So this PR gives a 24 characters maximum per variable, which is hopefully a good balance. Please let me know if this should be decreased or increased.