Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
16
node_modules/eslint/lib/rules/no-lone-blocks.js
generated
vendored
16
node_modules/eslint/lib/rules/no-lone-blocks.js
generated
vendored
|
|
@ -9,13 +9,13 @@
|
|||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "disallow unnecessary nested blocks",
|
||||
category: "Best Practices",
|
||||
description: "Disallow unnecessary nested blocks",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/no-lone-blocks"
|
||||
},
|
||||
|
|
@ -40,7 +40,9 @@ module.exports = {
|
|||
* @returns {void}
|
||||
*/
|
||||
function report(node) {
|
||||
const messageId = node.parent.type === "BlockStatement" ? "redundantNestedBlock" : "redundantBlock";
|
||||
const messageId = node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock"
|
||||
? "redundantNestedBlock"
|
||||
: "redundantBlock";
|
||||
|
||||
context.report({
|
||||
node,
|
||||
|
|
@ -55,6 +57,7 @@ module.exports = {
|
|||
*/
|
||||
function isLoneBlock(node) {
|
||||
return node.parent.type === "BlockStatement" ||
|
||||
node.parent.type === "StaticBlock" ||
|
||||
node.parent.type === "Program" ||
|
||||
|
||||
// Don't report blocks in switch cases if the block is the only statement of the case.
|
||||
|
|
@ -88,7 +91,7 @@ module.exports = {
|
|||
};
|
||||
|
||||
// ES6: report blocks without block-level bindings, or that's only child of another block
|
||||
if (context.parserOptions.ecmaVersion >= 6) {
|
||||
if (context.languageOptions.ecmaVersion >= 2015) {
|
||||
ruleDef = {
|
||||
BlockStatement(node) {
|
||||
if (isLoneBlock(node)) {
|
||||
|
|
@ -100,7 +103,10 @@ module.exports = {
|
|||
loneBlocks.pop();
|
||||
report(node);
|
||||
} else if (
|
||||
node.parent.type === "BlockStatement" &&
|
||||
(
|
||||
node.parent.type === "BlockStatement" ||
|
||||
node.parent.type === "StaticBlock"
|
||||
) &&
|
||||
node.parent.body.length === 1
|
||||
) {
|
||||
report(node);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue