Skip to content

Conversation

@ThiagoG8
Copy link
Contributor

@ThiagoG8 ThiagoG8 commented Jan 6, 2025

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[x] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Rewrited var using const in following rule examples:

new-cap
no-alert
max-statements

Related Issue: #19240

Is there anything you'd like reviewers to focus on?

I used const to replace var, I believe it is the best solution for the issue

@ThiagoG8 ThiagoG8 requested a review from a team as a code owner January 6, 2025 16:53
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 6, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented Jan 6, 2025

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit 6d8a65a
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/677c1dd60ae54f0008ef4f71
😎 Deploy Preview https://deploy-preview-19317--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 105 to 106
const bar;
const baz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const bar;
const baz;
let bar;
let baz;

when we use const to declare a variable, we must assign it a value at the time of declaration. so lets use let here.

Comment on lines 126 to 127
const bar;
const baz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const bar;
const baz;
let bar;
let baz;

same as https://github.com/eslint/eslint/pull/19317/files#r1904412913

@amareshsm amareshsm added the documentation Relates to ESLint's documentation label Jan 6, 2025
Comment on lines 105 to 106
const bar;
const baz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const bar;
const baz;
let bar;
let baz;

Uninitialized const is a syntax error.

Comment on lines 126 to 127
const bar;
const baz;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const bar;
const baz;
let bar;
let baz;

@ThiagoG8
Copy link
Contributor Author

ThiagoG8 commented Jan 6, 2025

Fixed, just a question I need to update this branch?

};
}

let bar = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let bar = () => {
const bar = () => {

This can be declared as const.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, any more suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Only two suggestions are left.

const foo11 = 11; // Too many.
}

let bar = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let bar = () => {
const bar = () => {

same as https://github.com/eslint/eslint/pull/19317/files#r1904454700

Copy link
Member

@amareshsm amareshsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@amareshsm amareshsm added the accepted There is consensus among the team that this change meets the criteria for inclusion label Jan 6, 2025
Copy link
Contributor

@Tanujkanti4441 Tanujkanti4441 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thanks!

@Tanujkanti4441
Copy link
Contributor

One more thing,

let two = class {

we can also use const here.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 03f2f44 into eslint:main Jan 7, 2025
28 checks passed
cswimr pushed a commit to cswimr/gauntlet-cswimr-plugins that referenced this pull request Jan 11, 2025