eslint-plugin-n8n-nodes-base
Advanced tools
Comparing version 1.9.1 to 1.9.3
@@ -23,3 +23,3 @@ "use strict"; | ||
getDocumentationUrl: () => getDocumentationUrl, | ||
getExtendsOAuth2: () => getExtendsOAuth2, | ||
getExtendsValue: () => getExtendsValue, | ||
getName: () => getName, | ||
@@ -30,3 +30,3 @@ getPlaceholder: () => getPlaceholder | ||
var import_identifiers = require("../identifiers"); | ||
var import_restorers = require("../restorers"); | ||
var import_restoreValue = require("../utils/restoreValue"); | ||
function getStringClassField(identifier, nodeParam) { | ||
@@ -53,10 +53,9 @@ const found = nodeParam.body.find(identifier); | ||
} | ||
function getExtendsOAuth2(classBody) { | ||
const found = classBody.body.find(import_identifiers.id.credClassBody.isFieldExtends); | ||
if (!found) | ||
function getExtendsValue(classBody, context) { | ||
var _a; | ||
const extendsNode = classBody.body.find(import_identifiers.id.credClassBody.isFieldExtends); | ||
if (!extendsNode) | ||
return null; | ||
return { | ||
ast: found, | ||
value: (0, import_restorers.restoreArray)(found.value.elements) | ||
}; | ||
const extendsSource = context.getSourceCode().getText(extendsNode.value); | ||
return (_a = (0, import_restoreValue.restoreValue)(extendsSource)) != null ? _a : null; | ||
} | ||
@@ -67,5 +66,5 @@ // Annotate the CommonJS export names for ESM import in node: | ||
getDocumentationUrl, | ||
getExtendsOAuth2, | ||
getExtendsValue, | ||
getName, | ||
getPlaceholder | ||
}); |
@@ -23,3 +23,4 @@ "use strict"; | ||
__reExport(ast_exports, require("./utils/range"), module.exports); | ||
__reExport(ast_exports, require("./utils/restoreValue"), module.exports); | ||
__reExport(ast_exports, require("./utils/rule"), module.exports); | ||
__reExport(ast_exports, require("./utils/sort"), module.exports); |
@@ -48,5 +48,6 @@ "use strict"; | ||
var range = __toESM(require("./range")); | ||
var restoreValue = __toESM(require("./restoreValue")); | ||
var rule = __toESM(require("./rule")); | ||
var sort = __toESM(require("./sort")); | ||
const utils = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, filename), format), insertion), range), rule), sort); | ||
const utils = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, filename), format), insertion), range), restoreValue), rule), sort); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -53,0 +54,0 @@ 0 && (module.exports = { |
@@ -37,3 +37,3 @@ "use strict"; | ||
messages: { | ||
addOAuth2: "Insert 'OAuth2' [non-autofixable]" | ||
addOAuth2: "Add 'OAuth2' [non-autofixable]" | ||
} | ||
@@ -47,4 +47,7 @@ }, | ||
return; | ||
const extendsOAuth2 = import_getters.getters.credClassBody.getExtendsOAuth2(node.body); | ||
if (!extendsOAuth2) | ||
const extendsValue = import_getters.getters.credClassBody.getExtendsValue( | ||
node.body, | ||
context | ||
); | ||
if (!extendsValue) | ||
return; | ||
@@ -54,3 +57,3 @@ const displayName = import_getters.getters.credClassBody.getDisplayName(node.body); | ||
return; | ||
if (extendsOAuth2.value.includes("oAuth2Api") && !displayName.value.endsWith("OAuth2 API")) { | ||
if (extendsValue.includes("oAuth2Api") && !displayName.value.endsWith("OAuth2 API")) { | ||
context.report({ | ||
@@ -57,0 +60,0 @@ messageId: "addOAuth2", |
@@ -47,4 +47,4 @@ "use strict"; | ||
const { body: classBody } = node; | ||
const extendsOAuth2 = import_getters.getters.credClassBody.getExtendsOAuth2(classBody); | ||
if (!extendsOAuth2) | ||
const extendsValue = import_getters.getters.credClassBody.getExtendsValue(classBody, context); | ||
if (!extendsValue) | ||
return; | ||
@@ -54,3 +54,3 @@ const name = import_getters.getters.credClassBody.getName(classBody); | ||
return; | ||
if (extendsOAuth2.value.includes("oAuth2Api") && !name.value.endsWith("OAuth2Api")) { | ||
if (extendsValue.includes("oAuth2Api") && !name.value.endsWith("OAuth2Api")) { | ||
context.report({ | ||
@@ -57,0 +57,0 @@ messageId: "addOAuth2", |
@@ -46,4 +46,7 @@ "use strict"; | ||
return; | ||
const extendsOAuth2 = import_getters.getters.credClassBody.getExtendsOAuth2(node.body); | ||
if (!extendsOAuth2) | ||
const extendsValue = import_getters.getters.credClassBody.getExtendsValue( | ||
node.body, | ||
context | ||
); | ||
if (!extendsValue) | ||
return; | ||
@@ -53,3 +56,3 @@ const className = import_getters.getters.getClassName(node); | ||
return; | ||
if (extendsOAuth2.value.includes("oAuth2Api") && !className.value.endsWith("OAuth2Api")) { | ||
if (extendsValue.includes("oAuth2Api") && !className.value.endsWith("OAuth2Api")) { | ||
context.report({ | ||
@@ -56,0 +59,0 @@ messageId: "addOAuth2", |
@@ -24,2 +24,3 @@ "use strict"; | ||
module.exports = __toCommonJS(node_param_default_missing_exports); | ||
var import_utils = require("@typescript-eslint/utils"); | ||
var import_utils2 = require("../ast/utils"); | ||
@@ -33,3 +34,3 @@ var import_identifiers = require("../ast/identifiers"); | ||
docs: { | ||
description: "`default` must be present in a node parameter.", | ||
description: "`default` must be present in a node parameter, except in node parameters under `modes`.", | ||
recommended: "error" | ||
@@ -47,4 +48,10 @@ }, | ||
ObjectExpression(node) { | ||
var _a; | ||
if (!import_identifiers.id.isNodeParameter(node, { skipKeys: ["default"] })) | ||
return; | ||
if ((_a = node.parent) == null ? void 0 : _a.parent) { | ||
if (node.parent.parent.type === import_utils.AST_NODE_TYPES.Property && node.parent.parent.key.type === import_utils.AST_NODE_TYPES.Identifier && node.parent.parent.key.name === "modes") { | ||
return; | ||
} | ||
} | ||
const type = import_getters.getters.nodeParam.getType(node); | ||
@@ -51,0 +58,0 @@ if (!type) |
{ | ||
"name": "eslint-plugin-n8n-nodes-base", | ||
"version": "1.9.1", | ||
"version": "1.9.3", | ||
"main": "dist/index.js", | ||
@@ -26,6 +26,7 @@ "author": { | ||
"format": "prettier lib scripts tests --write", | ||
"lint": "eslint lib tests --ext .ts", | ||
"lint-plugin": "eslint lib tests --ext .ts", | ||
"lint-codebase": "node scripts/get-codebase.mjs && node scripts/make-lint-codebase-config.mjs && npm install eslint-plugin-n8n-nodes-base && chmod +x ./scripts/lint-codebase.sh && ./scripts/lint-codebase.sh", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"prepare": "npm run lint; npm run test; npm run build" | ||
"prepublishOnly": "npm run lint-plugin && npm run test && npm run build && npm run lint-codebase" | ||
}, | ||
@@ -35,2 +36,3 @@ "dependencies": { | ||
"camel-case": "^4.1.2", | ||
"eslint-plugin-n8n-nodes-base": "^1.9.1", | ||
"indefinite": "^2.4.1", | ||
@@ -51,3 +53,3 @@ "pascal-case": "^3.1.2", | ||
"esbuild-jest": "^0.5.0", | ||
"eslint": "^8.0.0", | ||
"eslint": "8.23.0", | ||
"eslint-config-airbnb-typescript": "^17.0.0", | ||
@@ -58,5 +60,9 @@ "eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-local": "^1.0.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^28.1.3", | ||
"list-github-dir-content": "^3.0.0", | ||
"node-fetch": "^3.2.10", | ||
"outdent": "^0.8.0", | ||
"p-map": "^5.5.0", | ||
"shelljs": "^0.8.5", | ||
@@ -63,0 +69,0 @@ "tiny-glob": "^0.2.9", |
@@ -129,3 +129,3 @@ # eslint-plugin-n8n-nodes-base | ||
| [node-param-color-type-unused](docs/rules/node-param-color-type-unused.md) | `string`-type color-related node parameter must be `color`-type. | Yes | | ||
| [node-param-default-missing](docs/rules/node-param-default-missing.md) | `default` must be present in a node parameter. | Yes | | ||
| [node-param-default-missing](docs/rules/node-param-default-missing.md) | `default` must be present in a node parameter, except in node parameters under `modes`. | Yes | | ||
| [node-param-default-wrong-for-boolean](docs/rules/node-param-default-wrong-for-boolean.md) | `default` for boolean-type node parameter must be a boolean. | Yes | | ||
@@ -132,0 +132,0 @@ | [node-param-default-wrong-for-collection](docs/rules/node-param-default-wrong-for-collection.md) | `default` for collection-type node parameter must be an object. | Yes | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
511714
163
12051
9
23