Rule Proposal: no-strict-with-complex-params
See original GitHub issuefunction 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:
- Created 7 years ago
- Comments:47 (46 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not sure
strict
is stylistic anymore. Should we consider changing its category?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.