-
Notifications
You must be signed in to change notification settings - Fork 788
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
chore: enable eslint:no-shadow #4089
Conversation
@@ -24,10 +24,10 @@ import { isVisibleToScreenReaders } from '../../commons/dom'; | |||
* @memberof checks | |||
* @return {Mixed} True if aria-errormessage references an existing element that uses a supported technique. Undefined if it does not reference an existing element. False otherwise. | |||
*/ | |||
function ariaErrormessageEvaluate(node, options, virtualNode) { | |||
export default function ariaErrormessageEvaluate(node, options, virtualNode) { |
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.
What is the motivation behind this change?
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.
Follows our coding guidelines.
If you encounter any code that we maintain that does not put the default export at the top, you should update the file to do so.
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.
What is the motivation behind putting the default export at the top?
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.
Ensures that when you open the file the main code path is the first thing you read.
const ids = cells | ||
.filter(cell => cell.getAttribute('id')) | ||
.map(cell => cell.getAttribute('id')); |
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 much easier to read/understand 👍
* } | ||
*/ | ||
|
||
const mergeCheckLocale = (a, b) => { |
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.
Just curious - when is a function declaration preferred over a function expression? Also why is one preferred over the other?
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.
As far as I know we have no standard for when to use either. Mostly it's been up to the person writing the code.
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.
Generally I much prefer named functions, as they make debugging a bit easier.
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.
Both functions created using expressions and declarations have a name.
Welcome to Node.js v16.14.0.
Type ".help" for more information.
> function foo(){}
undefined
> foo.name
'foo'
> const bar = () => {}
undefined
> bar.name
'bar'
>
Co-authored-by: Stephen Mathieson <571265+stephenmathieson@users.noreply.github.com>
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.
Couple suggestions.
* } | ||
*/ | ||
|
||
const mergeCheckLocale = (a, b) => { |
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.
Generally I much prefer named functions, as they make debugging a bit easier.
Co-authored-by: Wilco Fiers <WilcoFiers@users.noreply.github.com>
This came up in a recent pr so went ahead and did it (hurray for resolving some 111 issues). For every file I touched I did the following:
const
/let
reduce
to better array functions (when the reduce caused the name conflict)/* global */
eslint stringsIn some files that had naming conflict issues the issues were in nested functions so I moved the function outside the nested scope.