Skip to content

Conversation

@fisker
Copy link
Collaborator

@fisker fisker commented Apr 29, 2021

No description provided.

@fisker fisker marked this pull request as draft April 29, 2021 02:33
@fisker
Copy link
Collaborator Author

fisker commented Apr 29, 2021

Bad idea, this may violate no-case-declarations

Update: seems not possible to declare a variable without a BlockStatement

if (foo) const a = 1;

and

if (foo) {} else const a = 1;

Both invalid.


Update 2:

if (1) var a = 1;

This seems valid.... WTF?

@fisker fisker closed this Apr 29, 2021
@fisker fisker deleted the prefer-switch-default-braces branch April 29, 2021 02:36
@fisker fisker restored the prefer-switch-default-braces branch April 29, 2021 02:42
@fisker fisker reopened this Apr 29, 2021
@fisker fisker marked this pull request as ready for review April 29, 2021 02:44
fisker and others added 3 commits April 29, 2021 15:56
# Conflicts:
#	test/snapshots/prefer-switch.mjs.md
#	test/snapshots/prefer-switch.mjs.snap
@sindresorhus sindresorhus merged commit c241782 into sindresorhus:main May 1, 2021
@fisker fisker deleted the prefer-switch-default-braces branch May 1, 2021 08:27
bmish added a commit to bmish/eslint-plugin-unicorn that referenced this pull request May 14, 2021
* main:
  Temporarily disable `import/extensions` rule
  Update `xo` to v0.40 (sindresorhus#1257)
  Test: Better `output` assertion (sindresorhus#1259)
  `prefer-negative-index`: Refactor (sindresorhus#1255)
  `prefer-dom-node-remove`: Improve parentheses handling (sindresorhus#1254)
  Update `eslint-plugin-eslint-plugin` to v3.0.3 (sindresorhus#1256)
  32.0.1
  `prefer-set-has`: Remove outdated AST types (sindresorhus#1253)
  `prevent-abbreviations`: Fix shorthand import/export detection (sindresorhus#1252)
  32.0.0
  `no-for-loop`: Ignore known non-array loop variables (sindresorhus#1242)
  Add `no-document-cookie` rule (sindresorhus#1244)
  `prefer-array-find`: Singularize variable name in autofix (sindresorhus#1243)
  Update `@babel/core` (sindresorhus#1241)
  Mention libraries used under the hood in `better-regexp` rule doc (sindresorhus#1240)
  `prefer-switch`: Do not add braces to the default case (sindresorhus#1235)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants