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.

Rule Proposal: no-strict-with-complex-params

See original GitHub issue
function foo(a = 1) {
    "use strict"
}

This is a valid code in ES2015, but this is an invalid code (syntax error) in ES2016.

It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. https://tc39.github.io/ecma262/2016/#sec-function-definitions-static-semantics-early-errors

So a combination of a non-simple parameter list and a "use strict" directive is going to break the software in future.

The purpose of this rule is that it protects software from the break.

/*eslint no-strict-with-complex-params: error*/

// ✘ BAD
function foo(a = 1) {
    "use strict"
}
function foo({a, b}) {
    "use strict"
}

// ✔ GOOD
function foo(a, b, c) {
    "use strict"
}
function foo(a = 1) {
}
function foo({a, b}) {
}

I think this is a good rule for eslint:recommended, so I separated this rule proposal from strict rule. I’m happy to work on this if accepted.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:47 (46 by maintainers)

github_iconTop GitHub Comments

2reactions
platinumazurecommented, Jan 30, 2017

I’m not sure strict is stylistic anymore. Should we consider changing its category?

2reactions
mikesherovcommented, Jun 15, 2016

To me this absolutely must modify default behavior, but because it’s essentially a bug fix that might start failing builds, it’d need to go out in a minor release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SEC Proposed Rules
SEC Proposed Rules · Regulation NMS: Minimum Pricing Increments, Access Fees, and Transparency of Better Priced Orders · File No: S7-30-22 · Comments...
Read more >
SEC proposes substantive changes in 4 stock market rules
This proposal, if adopted, would increase transparency for investors and facilitate their ability to compare brokers. That helps make our ...
Read more >
SEC Proposes Equity Market Overhaul and Best Execution Rule
The SEC is proposing to amend Regulation NMS to (1) amend the tick sizes under Rule 612 to establish a variable minimum pricing...
Read more >
3235-AM89 - View Rule
The Division is considering recommending that the Commission propose rule amendments to enhance issuer disclosures regarding cybersecurity risk governance.
Read more >
SEC Proposes New Rules on Adviser Oversight of Service ...
On October 26, 2022, the SEC proposed, by a vote of 3-2, a new rule (“Proposed Rule”) that, if adopted, would require SEC-registered ......
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