question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to semi to require semi colons after arrow function definitions in class body.

See original GitHub issue

What rule do you want to change? semi / no-extra-semi

Does this change cause the rule to produce more or fewer warnings? More warnings

How will the change be implemented? (New option, new default behavior, etc.)? Please add the option to require use of semi colons after class arrow function definitions in semi or require no semi colon in no-extra-semi.

The main thing is that either way, there is no ESLint rule that produces consistency in the code wrt to semi colons after class arrow functions. Here is the ECMAS definition for class body. I can make sense of this either way wrt arrow functions in the class body. http://www.ecma-international.org/ecma-262/11.0/index.html#prod-ClassBody

Please provide some example code that this change will affect:

class Project extends React.Component {

    constructor() {
    } // Require no semi colon in no-extra-semi (current)

    lifeCycle() {
    } // Require no semi colon in no-extra-semi (current)

    withoutSemi() {
    }  // Require no semi colon in no-extra-semi (current)

    withSemiArrow = () => {
    }; // Optional require semi colon in semi (requested)

    withoutSemiArrow = () => {
    } // Optional require semi colon in no-extra-semi (requested)

} // Require no semi colon in no-extra-semi (current)

What does the rule currently do for this code? semi add semi colons in many place. no-extra-semi removes them in many places.

Are you willing to submit a pull request to implement this change? Im not sure I would have the knowledge how.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sirmspencercommented, Nov 25, 2020

@sirmspencer thanks for the issue!

All core rules will be updated to support this syntax when class fields proposal reaches stage 4, per our policy about experimental features.

In the meantime you can use @babel/semi rule from @babel/eslint-plugin, instead of the core semi rule.

Thank you so much. The @babel/eslint-plugin works great for what I need.

0reactions
eslint-deprecated[bot]commented, Nov 22, 2020

Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrow Function semi-colon required? (Example) - Treehouse
Arrow functions are created by assigning a variable with a function expression. The entire statement is like any other JavaScript statement in ...
Read more >
semi - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
A Guide to Enhanced Readability with semi-colons in ES6
Below is a list of practical DO's and DON'Ts for enhanced readability in ES6 using semi-colons. They are inspired by the ES5 requirements, ......
Read more >
One line arrow functions without braces - can't have a ...
You put the name of the prop you want, an equal sign, then a single expression in braces. Remember, single expressions don't have...
Read more >
When (not) to use semicolons - Codecademy
You shouldn't put a semicolon after a closing curly bracket } . The only exceptions are assignment statements, such as var obj =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found