Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
42
node_modules/eslint/lib/rules/max-classes-per-file.js
generated
vendored
42
node_modules/eslint/lib/rules/max-classes-per-file.js
generated
vendored
|
|
@ -13,21 +13,38 @@
|
|||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "enforce a maximum number of classes per file",
|
||||
category: "Best Practices",
|
||||
description: "Enforce a maximum number of classes per file",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/max-classes-per-file"
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "integer",
|
||||
minimum: 1
|
||||
oneOf: [
|
||||
{
|
||||
type: "integer",
|
||||
minimum: 1
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
ignoreExpressions: {
|
||||
type: "boolean"
|
||||
},
|
||||
max: {
|
||||
type: "integer",
|
||||
minimum: 1
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
|
|
@ -36,8 +53,10 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
create(context) {
|
||||
|
||||
const maxClasses = context.options[0] || 1;
|
||||
const [option = {}] = context.options;
|
||||
const [ignoreExpressions, max] = typeof option === "number"
|
||||
? [false, option || 1]
|
||||
: [option.ignoreExpressions, option.max || 1];
|
||||
|
||||
let classCount = 0;
|
||||
|
||||
|
|
@ -46,19 +65,24 @@ module.exports = {
|
|||
classCount = 0;
|
||||
},
|
||||
"Program:exit"(node) {
|
||||
if (classCount > maxClasses) {
|
||||
if (classCount > max) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: "maximumExceeded",
|
||||
data: {
|
||||
classCount,
|
||||
max: maxClasses
|
||||
max
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
"ClassDeclaration, ClassExpression"() {
|
||||
"ClassDeclaration"() {
|
||||
classCount++;
|
||||
},
|
||||
"ClassExpression"() {
|
||||
if (!ignoreExpressions) {
|
||||
classCount++;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue