Initial commit

This commit is contained in:
2025-03-07 19:22:02 +01:00
commit 4a98255d83
55743 changed files with 5280367 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
export {};
+108
View File
@@ -0,0 +1,108 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const rules_1 = __importDefault(require("./rules"));
const parser_1 = __importDefault(require("@typescript-eslint/parser"));
const eslint_plugin_1 = __importDefault(require("@typescript-eslint/eslint-plugin"));
const eslint_plugin_prettier_1 = __importDefault(require("eslint-plugin-prettier"));
const eslint_plugin_react_1 = __importDefault(require("eslint-plugin-react"));
const js_1 = __importDefault(require("@eslint/js"));
const eslint_config_prettier_1 = __importDefault(require("eslint-config-prettier"));
// eslint-disable-next-line @typescript-eslint/no-require-imports
const reactnativeplugin = require("eslint-plugin-react-native");
const plugin = {
meta: {
name: "eslint-plugin-office-addins",
version: "5.0.0",
},
rules: rules_1.default,
configs: {},
};
const recommended = [
js_1.default.configs.recommended,
eslint_config_prettier_1.default,
{
files: ["**/*.{js,mjs,cjs,ts,cts,mts}"],
plugins: {
"@typescript-eslint": eslint_plugin_1.default,
"office-addins": plugin,
prettier: eslint_plugin_prettier_1.default,
},
languageOptions: {
parser: parser_1.default,
ecmaVersion: 6,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
"@typescript-eslint/no-unused-vars": "error",
"no-delete-var": "warn",
"no-eval": "error",
"no-inner-declarations": "warn",
"no-octal": "warn",
"no-unused-vars": "off",
"office-addins/call-sync-after-load": "error",
"office-addins/call-sync-before-read": "error",
"office-addins/load-object-before-read": "error",
"office-addins/no-context-sync-in-loop": "warn",
"office-addins/no-empty-load": "warn",
"office-addins/no-navigational-load": "warn",
"office-addins/no-office-initialize": "warn",
"office-addins/test-for-null-using-isNullObject": "error",
"prettier/prettier": ["error", { endOfLine: "auto" }],
},
},
];
const react = [
eslint_plugin_react_1.default.configs.flat.recommended,
...recommended,
{
plugins: {
"office-addins": plugin,
react: eslint_plugin_react_1.default,
},
settings: {
react: {
version: "detect",
},
},
},
];
const reactnative = [
reactnativeplugin.configs.all,
...recommended,
{
plugins: {
"office-addins": plugin,
react: reactnativeplugin,
},
settings: {
react: {
version: "detect",
},
},
},
];
const test = [
...recommended,
{
plugins: {
"office-addins": plugin,
},
rules: {},
},
];
Object.assign(plugin.configs, {
recommended,
react,
reactnative,
test,
});
module.exports = plugin;
//# sourceMappingURL=main.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,uEAAiD;AACjD,qFAAgE;AAChE,oFAAoD;AACpD,8EAA8C;AAC9C,oDAAkC;AAClC,oFAA0D;AAE1D,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAEhE,MAAM,MAAM,GAAG;IACb,IAAI,EAAE;QACJ,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,OAAO;KACjB;IACD,KAAK,EAAL,eAAK;IACL,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,YAAQ,CAAC,OAAO,CAAC,WAAW;IAC5B,gCAAoB;IACpB;QACE,KAAK,EAAE,CAAC,8BAA8B,CAAC;QACvC,OAAO,EAAE;YACP,oBAAoB,EAAE,uBAAgB;YACtC,eAAe,EAAE,MAAM;YACvB,QAAQ,EAAE,gCAAc;SACzB;QACD,eAAe,EAAE;YACf,MAAM,EAAE,gBAAQ;YAChB,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,QAAQ;YACpB,aAAa,EAAE;gBACb,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI;iBACV;aACF;SACF;QACD,KAAK,EAAE;YACL,mCAAmC,EAAE,OAAO;YAC5C,eAAe,EAAE,MAAM;YACvB,SAAS,EAAE,OAAO;YA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const _default: ESLintUtils.RuleModule<"callSyncAfterLoad", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,103 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const load_1 = require("../utils/load");
const utils_2 = require("../utils/utils");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#load")({
name: "call-sync-after-load",
meta: {
type: "suggestion",
messages: {
callSyncAfterLoad: "Call context.sync() after calling load on '{{name}}' for the property '{{loadValue}}' and before reading the property.",
},
docs: {
description: "Always call context.sync() between loading one or more properties on objects and reading any of those properties.",
},
schema: [],
},
create: function (context) {
var _a;
const sourceCode = (_a = context.sourceCode) !== null && _a !== void 0 ? _a : context.getSourceCode();
class VariablePropertySet extends Set {
add(variableProperty) {
return super.add(JSON.stringify(variableProperty));
}
has(variableProperty) {
return super.has(JSON.stringify(variableProperty));
}
}
let apiReferences = [];
function findLoadBeforeSync() {
const needSync = new VariablePropertySet();
apiReferences.forEach((apiReference) => {
const operation = apiReference.operation;
const reference = apiReference.reference;
const identifier = reference.identifier;
const variable = reference.resolved;
if (operation === "Load" && variable) {
const propertiesArgument = getPropertiesArgument(identifier);
const propertyNames = propertiesArgument
? (0, load_1.parsePropertiesArgument)(propertiesArgument)
: ["*"];
propertyNames.forEach((propertyName) => {
needSync.add({
variable: variable.name,
property: propertyName,
});
});
}
else if (operation === "Sync") {
needSync.clear();
}
else if (operation === "Read" && variable) {
const propertyName = (0, utils_2.findPropertiesRead)(reference.identifier.parent);
if (needSync.has({ variable: variable.name, property: propertyName }) ||
needSync.has({ variable: variable.name, property: "*" })) {
const node = reference.identifier;
context.report({
node: node,
messageId: "callSyncAfterLoad",
data: { name: node.name, loadValue: propertyName },
});
}
}
});
}
function getPropertiesArgument(identifier) {
var _a, _b;
let propertiesArgument;
if (((_a = identifier.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression) {
// Look for <obj>.load(...) call
const methodCall = (0, utils_2.findCallExpression)(identifier.parent);
if (methodCall && (0, load_1.isLoadCall)(methodCall)) {
propertiesArgument = methodCall.arguments[0];
}
}
else if (((_b = identifier.parent) === null || _b === void 0 ? void 0 : _b.type) === utils_1.TSESTree.AST_NODE_TYPES.CallExpression) {
// Look for context.load(<obj>, "...") call
const args = identifier.parent.arguments;
if ((0, load_1.isLoadCall)(identifier.parent) &&
args[0] == identifier &&
args.length < 3) {
propertiesArgument = args[1];
}
}
return propertiesArgument;
}
return {
Program(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
apiReferences = (0, utils_2.findOfficeApiReferences)(scope);
apiReferences.sort((left, right) => {
return (left.reference.identifier.range[1] -
right.reference.identifier.range[1]);
});
findLoadBeforeSync();
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=call-sync-after-load.js.map
@@ -0,0 +1 @@
{"version":3,"file":"call-sync-after-load.js","sourceRoot":"","sources":["../../src/rules/call-sync-after-load.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,wCAAoE;AACpE,0CAKwB;AAExB,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,2FAA2F,CAC9F,CAAC;IACA,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE;YACR,iBAAiB,EACf,wHAAwH;SAC3H;QACD,IAAI,EAAE;YACJ,WAAW,EACT,mHAAmH;SACtH;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE,UAAU,OAAO;;QACvB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAMjE,MAAM,mBAAoB,SAAQ,GAAG;YACnC,GAAG,CAAC,gBAAkC;gBACpC,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB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B,IAAI,CAAC,MAAM,GAAG,CAAC,EACf,CAAC;oBACD,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;gBAC/B,CAAC;YACH,CAAC;YAED,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QAED,OAAO;YACL,OAAO,CAAC,IAAI;gBACV,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ;oBAC/B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACvB,aAAa,GAAG,IAAA,+BAAuB,EAAC,KAAK,CAAC,CAAC;gBAC/C,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oBACjC,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;wBAClC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,CAAC;gBACJ,CAAC,CAAC,CAAC;gBACH,kBAAkB,EAAE,CAAC;YACvB,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"callSync", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const utils_2 = require("../utils/utils");
const utils_3 = require("../utils/utils");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#sync")({
name: "call-sync-before-read",
meta: {
type: "problem",
messages: {
callSync: "Call context.sync() before trying to read '{{name}}'.",
},
docs: {
description: "Always call load on the object's properties followed by a context.sync() before reading them.",
},
schema: [],
},
create: function (context) {
var _a;
const sourceCode = (_a = context.sourceCode) !== null && _a !== void 0 ? _a : context.getSourceCode();
let apiReferences = [];
function checkPropertyIsRead(node) {
var _a;
const topExpression = (0, utils_2.findTopMemberExpression)(node);
switch ((_a = topExpression.parent) === null || _a === void 0 ? void 0 : _a.type) {
case utils_1.TSESTree.AST_NODE_TYPES.AssignmentExpression:
return topExpression.parent.right === topExpression;
default:
return true;
}
}
function findReadBeforeSync() {
const needSync = new Set();
apiReferences.forEach((apiReference) => {
var _a;
const operation = apiReference.operation;
const reference = apiReference.reference;
const variable = reference.resolved;
if (operation === "Get" && variable) {
needSync.add(variable);
}
if (operation === "Sync") {
needSync.clear();
}
if (operation === "Read" && variable && needSync.has(variable)) {
const node = reference.identifier;
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
checkPropertyIsRead(node.parent)) {
context.report({
node: node,
messageId: "callSync",
data: { name: node.name },
});
}
}
});
}
return {
Program(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
apiReferences = (0, utils_3.findOfficeApiReferences)(scope);
apiReferences.sort((left, right) => {
return (left.reference.identifier.range[1] -
right.reference.identifier.range[1]);
});
findReadBeforeSync();
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=call-sync-before-read.js.map
@@ -0,0 +1 @@
{"version":3,"file":"call-sync-before-read.js","sourceRoot":"","sources":["../../src/rules/call-sync-before-read.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,0CAAyD;AACzD,0CAA6E;AAE7E,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,2FAA2F,CAC9F,CAAC;IACA,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,QAAQ,EAAE,uDAAuD;SAClE;QACD,IAAI,EAAE;YACJ,WAAW,EACT,+FAA+F;SAClG;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE,UA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AAC,MAAM,CAAC,EAChC,CAAC;wBACD,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,IAAI;4BACV,SAAS,EAAE,UAAU;4BACrB,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;yBAC1B,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,OAAO,CAAC,IAAI;gBACV,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ;oBAC/B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACvB,aAAa,GAAG,IAAA,+BAAuB,EAAC,KAAK,CAAC,CAAC;gBAC/C,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oBACjC,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;wBAClC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CACpC,CAAC;gBACJ,CAAC,CAAC,CAAC;gBACH,kBAAkB,EAAE,CAAC;YACvB,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
+11
View File
@@ -0,0 +1,11 @@
declare const _default: {
"call-sync-before-read": import("@typescript-eslint/utils/ts-eslint").RuleModule<"callSync", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"load-object-before-read": import("@typescript-eslint/utils/ts-eslint").RuleModule<"loadBeforeRead", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"call-sync-after-load": import("@typescript-eslint/utils/ts-eslint").RuleModule<"callSyncAfterLoad", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"no-context-sync-in-loop": import("@typescript-eslint/utils/ts-eslint").RuleModule<"loopedSync", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"no-empty-load": import("@typescript-eslint/utils/ts-eslint").RuleModule<"emptyLoad", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"no-navigational-load": import("@typescript-eslint/utils/ts-eslint").RuleModule<"navigationalLoad", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"no-office-initialize": import("@typescript-eslint/utils/ts-eslint").RuleModule<"noOfficeInitialize", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
"test-for-null-using-isNullObject": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useIsNullObject", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
};
export default _default;
+24
View File
@@ -0,0 +1,24 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const call_sync_after_load_1 = __importDefault(require("./call-sync-after-load"));
const call_sync_before_read_1 = __importDefault(require("./call-sync-before-read"));
const load_object_before_read_1 = __importDefault(require("./load-object-before-read"));
const no_context_sync_in_loop_1 = __importDefault(require("./no-context-sync-in-loop"));
const no_empty_load_1 = __importDefault(require("./no-empty-load"));
const no_navigational_load_1 = __importDefault(require("./no-navigational-load"));
const no_office_initialize_1 = __importDefault(require("./no-office-initialize"));
const test_for_null_using_isNullObject_1 = __importDefault(require("./test-for-null-using-isNullObject"));
exports.default = {
"call-sync-before-read": call_sync_before_read_1.default,
"load-object-before-read": load_object_before_read_1.default,
"call-sync-after-load": call_sync_after_load_1.default,
"no-context-sync-in-loop": no_context_sync_in_loop_1.default,
"no-empty-load": no_empty_load_1.default,
"no-navigational-load": no_navigational_load_1.default,
"no-office-initialize": no_office_initialize_1.default,
"test-for-null-using-isNullObject": test_for_null_using_isNullObject_1.default,
};
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;;;AAAA,kFAAuD;AACvD,oFAAyD;AACzD,wFAA6D;AAC7D,wFAA4D;AAC5D,oEAA0C;AAC1C,kFAAwD;AACxD,kFAAwD;AACxD,0GAA8E;AAE9E,kBAAe;IACb,uBAAuB,EAAE,+BAAkB;IAC3C,yBAAyB,EAAE,iCAAoB;IAC/C,sBAAsB,EAAE,8BAAiB;IACzC,yBAAyB,EAAE,iCAAmB;IAC9C,eAAe,EAAE,uBAAW;IAC5B,sBAAsB,EAAE,8BAAkB;IAC1C,sBAAsB,EAAE,8BAAkB;IAC1C,kCAAkC,EAAE,0CAA4B;CACjE,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"loadBeforeRead", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,117 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const load_1 = require("../utils/load");
const utils_2 = require("../utils/utils");
const getFunction_1 = require("../utils/getFunction");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#load")({
name: "load-object-before-read",
meta: {
type: "problem",
messages: {
loadBeforeRead: "An explicit load call on '{{name}}' for property '{{loadValue}}' needs to be made before the property can be read.",
},
docs: {
description: "Before you can read the properties of a proxy object, you must explicitly load the properties.",
},
schema: [],
},
create: function (context) {
var _a;
const sourceCode = (_a = context.sourceCode) !== null && _a !== void 0 ? _a : context.getSourceCode();
function isInsideWriteStatement(node) {
while (node.parent) {
node = node.parent;
if (node.type === utils_1.TSESTree.AST_NODE_TYPES.AssignmentExpression)
return true;
}
return false;
}
function hasBeenLoaded(node, loadLocation, propertyName) {
var _a;
return (loadLocation.has(propertyName) && // If reference came after load, return
node.range[1] > ((_a = loadLocation.get(propertyName)) !== null && _a !== void 0 ? _a : 0));
}
function findLoadBeforeRead(scope) {
scope.variables.forEach((variable) => {
const loadLocation = new Map();
let getFound = false;
variable.references.forEach((reference) => {
const node = reference.identifier;
const parent = node.parent;
if ((parent === null || parent === void 0 ? void 0 : parent.type) === utils_1.TSESTree.AST_NODE_TYPES.VariableDeclarator) {
getFound = false; // In case of reassignment
if (parent.init &&
(0, getFunction_1.isGetFunction)(parent.init) &&
!(0, getFunction_1.isGetOrNullObjectFunction)(parent.init)) {
getFound = true;
return;
}
}
if ((parent === null || parent === void 0 ? void 0 : parent.type) === utils_1.TSESTree.AST_NODE_TYPES.AssignmentExpression) {
getFound = false; // In case of reassignment
if ((0, getFunction_1.isGetFunction)(parent.right) &&
!(0, getFunction_1.isGetOrNullObjectFunction)(parent.right)) {
getFound = true;
return;
}
}
if (!getFound) {
// If reference was not related to a previous get
return;
}
// Look for <obj>.load(...) call
if ((parent === null || parent === void 0 ? void 0 : parent.type) === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression) {
const methodCall = (0, utils_2.findCallExpression)(parent);
if (methodCall && (0, load_1.isLoadCall)(methodCall)) {
const argument = methodCall.arguments[0];
const propertyNames = argument
? (0, load_1.parsePropertiesArgument)(argument)
: ["*"];
propertyNames.forEach((propertyName) => {
loadLocation.set(propertyName, node.range[1]);
});
return;
}
}
// Look for context.load(<obj>, "...") call
if ((parent === null || parent === void 0 ? void 0 : parent.type) === utils_1.TSESTree.AST_NODE_TYPES.CallExpression) {
const args = parent === null || parent === void 0 ? void 0 : parent.arguments;
if ((0, load_1.isLoadCall)(parent) && args[0] == node && args.length < 3) {
const propertyNames = args[1]
? (0, load_1.parsePropertiesArgument)(args[1])
: ["*"];
propertyNames.forEach((propertyName) => {
loadLocation.set(propertyName, node.range[1]);
});
return;
}
}
const propertyName = (0, utils_2.findPropertiesRead)(parent);
if (!propertyName ||
hasBeenLoaded(node, loadLocation, propertyName) ||
hasBeenLoaded(node, loadLocation, "*") ||
isInsideWriteStatement(node)) {
return;
}
context.report({
node: node,
messageId: "loadBeforeRead",
data: { name: node.name, loadValue: propertyName },
});
});
});
scope.childScopes.forEach(findLoadBeforeRead);
}
return {
Program(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
findLoadBeforeRead(scope);
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=load-object-before-read.js.map
@@ -0,0 +1 @@
{"version":3,"file":"load-object-before-read.js","sourceRoot":"","sources":["../../src/rules/load-object-before-read.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,wCAAoE;AACpE,0CAAwE;AACxE,sDAAgF;AAEhF,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,2FAA2F,CAC9F,CAAC;IACA,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,cAAc,EACZ,oHAAoH;SACvH;QACD,IAAI,EAAE;YACJ,WAAW,EACT,gGAAgG;SACnG;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE,UAAU,OAAO;;QACvB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QACjE,SAAS,sBAAsB,CAAC,IAAmB;YACjD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;gBACnB,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;gBACnB,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,oBAAoB;oBAC5D,OAAO,IAAI,CAAC;YAChB,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,SAAS,aAAa,CACpB,IAAmB,EACnB,YAAiC,EACjC,YAAoB;;YAEpB,OAAO,CACL,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,uCAAuC;gBACzE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,MAAA,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,mCAAI,CAAC,CAAC,CACtD,CAAC;QACJ,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I,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;4BAChD,CAAC,CAAC,CAAC;4BACH,OAAO;wBACT,CAAC;oBACH,CAAC;oBAED,MAAM,YAAY,GAAW,IAAA,0BAAkB,EAAC,MAAM,CAAC,CAAC;oBAExD,IACE,CAAC,YAAY;wBACb,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;wBAC/C,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,CAAC;wBACtC,sBAAsB,CAAC,IAAI,CAAC,EAC5B,CAAC;wBACD,OAAO;oBACT,CAAC;oBAED,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,IAAI;wBACV,SAAS,EAAE,gBAAgB;wBAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE;qBACnD,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAChD,CAAC;QAED,OAAO;YACL,OAAO,CAAC,IAAI;gBACV,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ;oBAC/B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACvB,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"loopedSync", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/concepts/correlated-objects-pattern")({
name: "no-context-sync-in-loop",
meta: {
type: "problem",
messages: {
loopedSync: "Calling context.sync() inside a loop can lead to poor performance",
},
docs: {
description: "Calling context.sync() inside of a loop dramatically increases the time the code runs, proportional to the number of iterations.",
},
schema: [],
},
create: function (context) {
return {
":matches(ForStatement, ForInStatement, WhileStatement, DoWhileStatement, ForOfStatement) CallExpression[callee.object.name='context'][callee.property.name='sync']"(node) {
context.report({
node: node.callee,
messageId: "loopedSync",
});
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=no-context-sync-in-loop.js.map
@@ -0,0 +1 @@
{"version":3,"file":"no-context-sync-in-loop.js","sourceRoot":"","sources":["../../src/rules/no-context-sync-in-loop.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,mFAAmF,CACtF,CAAC;IACA,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,UAAU,EACR,mEAAmE;SACtE;QACD,IAAI,EAAE;YACJ,WAAW,EACT,kIAAkI;SACrI;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE,UAAU,OAAO;QACvB,OAAO;YACL,oKAAoK,CAClK,IAA6B;gBAE7B,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,IAAI,CAAC,MAAM;oBACjB,SAAS,EAAE,YAAY;iBACxB,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"emptyLoad", [], unknown, ESLintUtils.RuleListener>;
export default _default;
+76
View File
@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const getFunction_1 = require("../utils/getFunction");
const load_1 = require("../utils/load");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#calling-load-without-parameters-not-recommended")({
name: "no-empty-load",
meta: {
type: "problem",
messages: {
emptyLoad: "Calling load without any argument slows down your add-in.",
},
docs: {
description: "Calling load without any argument causes unneeded data to load and slows down your add-in.",
},
schema: [],
},
create: function (context) {
var _a;
const sourceCode = (_a = context.sourceCode) !== null && _a !== void 0 ? _a : context.getSourceCode();
function isEmptyLoad(node) {
if ((0, load_1.isLoadFunction)(node)) {
const propertyNames = (0, load_1.parseLoadArguments)(node);
if (propertyNames.length === 0) {
return true;
}
let foundEmptyProperty = false;
propertyNames.forEach((property) => {
if (!property) {
foundEmptyProperty = true;
}
});
return foundEmptyProperty;
}
return false;
}
function findEmptyLoad(scope) {
scope.variables.forEach((variable) => {
let getFound = false;
variable.references.forEach((reference) => {
var _a;
const node = reference.identifier;
if (reference.isWrite()) {
getFound = false; // In case of reassignment
if (reference.writeExpr && (0, getFunction_1.isGetFunction)(reference.writeExpr)) {
getFound = true;
return;
}
}
if (!getFound) {
// If reference was not related to a previous get
return;
}
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
isEmptyLoad(node.parent)) {
context.report({
node: node.parent,
messageId: "emptyLoad",
});
}
});
});
scope.childScopes.forEach(findEmptyLoad);
}
return {
Program(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
findEmptyLoad(scope);
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=no-empty-load.js.map
@@ -0,0 +1 @@
{"version":3,"file":"no-empty-load.js","sourceRoot":"","sources":["../../src/rules/no-empty-load.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,sDAAqD;AACrD,wCAAmE;AAEnE,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,sIAAsI,CACzI,CAAC;IAC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Aa,EAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;4BAC9D,QAAQ,GAAG,IAAI,CAAC;4BAChB,OAAO;wBACT,CAAC;oBACH,CAAC;oBAED,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACd,iDAAiD;wBACjD,OAAO;oBACT,CAAC;oBAED,IACE,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,MAAK,gBAAQ,CAAC,cAAc,CAAC,gBAAgB;wBAC9D,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EACxB,CAAC;wBACD,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,IAAI,CAAC,MAAM;4BACjB,SAAS,EAAE,WAAW;yBACvB,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO;YACL,OAAO,CAAC,IAAI;gBACV,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ;oBAC/B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACvB,aAAa,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"navigationalLoad", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const getFunction_1 = require("../utils/getFunction");
const load_1 = require("../utils/load");
const propertiesType_1 = require("../utils/propertiesType");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#scalar-and-navigation-properties")({
name: "no-navigational-load",
meta: {
type: "problem",
messages: {
navigationalLoad: "Calling load on the navigation property '{{loadValue}}' slows down your add-in.",
},
docs: {
description: "Calling load on a navigation property causes unneeded data to load and slows down your add-in.",
},
schema: [],
},
create: function (context) {
var _a;
const sourceCode = (_a = context.sourceCode) !== null && _a !== void 0 ? _a : context.getSourceCode();
function isLoadingValidPropeties(propertyName) {
const properties = propertyName.split("/");
const lastProperty = properties.pop();
if (!lastProperty)
return false;
for (const property of properties) {
const propertyType = (0, propertiesType_1.getPropertyType)(property);
if (propertyType !== propertiesType_1.PropertyType.navigational &&
propertyType !== propertiesType_1.PropertyType.ambiguous) {
return false;
}
}
if (lastProperty === "*") {
return true;
}
const propertyType = (0, propertiesType_1.getPropertyType)(lastProperty);
return (propertyType === propertiesType_1.PropertyType.scalar ||
propertyType === propertiesType_1.PropertyType.ambiguous);
}
function findNavigationalLoad(scope) {
scope.variables.forEach((variable) => {
let getFound = false;
variable.references.forEach((reference) => {
var _a, _b;
const node = reference.identifier;
if (reference.isWrite()) {
getFound = false; // In case of reassignment
if (reference.writeExpr && (0, getFunction_1.isGetFunction)(reference.writeExpr)) {
getFound = true;
return;
}
}
if (!getFound) {
// If reference was not related to a previous get
return;
}
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
(0, load_1.isLoadFunction)(node.parent)) {
// <obj>.load(...) call
const propertyNames = (0, load_1.parseLoadArguments)(node.parent);
propertyNames.forEach((propertyName) => {
if (propertyName && !isLoadingValidPropeties(propertyName)) {
context.report({
node: node.parent,
messageId: "navigationalLoad",
data: { name: node.name, loadValue: propertyName },
});
}
});
}
else if (((_b = node.parent) === null || _b === void 0 ? void 0 : _b.type) === utils_1.TSESTree.AST_NODE_TYPES.CallExpression) {
//context.load(<obj>, "...") call
const callee = node.parent
.callee;
const args = node.parent.arguments;
if ((0, load_1.isLoadFunction)(callee) && args[0] == node && args.length < 3) {
const propertyNames = (0, load_1.parsePropertiesArgument)(args[1]);
propertyNames.forEach((propertyName) => {
if (propertyName && !isLoadingValidPropeties(propertyName)) {
context.report({
node: node.parent,
messageId: "navigationalLoad",
data: { name: node.name, loadValue: propertyName },
});
}
});
}
}
});
});
scope.childScopes.forEach(findNavigationalLoad);
}
return {
Program(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
findNavigationalLoad(scope);
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=no-navigational-load.js.map
@@ -0,0 +1 @@
{"version":3,"file":"no-navigational-load.js","sourceRoot":"","sources":["../../src/rules/no-navigational-load.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,sDAAqD;AACrD,wCAIuB;AACvB,4DAAwE;AAExE,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,uHAAuH,CAC1H,CAAC;IACA,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,gBAAgB,EACd,iFAAiF;SACpF;QACD,IAAI,EAAE;YACJ,WAAW,EACT,gGAAgG;SACnG;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE,UAAU,OAAO;;QACvB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QACjE,SAAS,uBAAuB,CAAC,YAAoB;YACnD,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC;YACtC,IAAI,CAAC,YAAY;gBAAE,OAAO,KAAK,CAAC;YAEhC,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;gBAClC,MAAM,YAAY,GAAG,IAAA,gCAAe,EAAC,QAAQ,CAAC,CAAC;gBAC/C,IACE,YAAY,KAAK,6BAAY,CAAC,YAAY;oBAC1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AAC;YACH,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAClD,CAAC;QAED,OAAO;YACL,OAAO,CAAC,IAAI;gBACV,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ;oBAC/B,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACvB,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"noOfficeInitialize", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/initialize-add-in#initialize-with-officeonready")({
name: "no-office-initialize",
meta: {
type: "suggestion",
messages: {
noOfficeInitialize: "Office.onReady() is preferred over Office.initialize.",
},
docs: {
description: "Office.onReady() is more flexible than Office.initialize.",
},
schema: [],
},
create: function (context) {
return {
"AssignmentExpression[left.object.name='Office'][left.property.name='initialize']"(node) {
context.report({
node: node,
messageId: "noOfficeInitialize",
});
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=no-office-initialize.js.map
@@ -0,0 +1 @@
{"version":3,"file":"no-office-initialize.js","sourceRoot":"","sources":["../../src/rules/no-office-initialize.ts"],"names":[],"mappings":";;AAAA,oDAAiE;AAEjE,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,uGAAuG,CAC1G,CAAC;IACA,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE;YACR,kBAAkB,EAChB,uDAAuD;SAC1D;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,2DAA2D;SACzE;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,EAAE,UAAU,OAAO;QACvB,OAAO;YACL,kFAAkF,CAChF,IAAmC;gBAEnC,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,IAAI;oBACV,SAAS,EAAE,oBAAoB;iBAChC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
import { ESLintUtils } from "@typescript-eslint/utils";
declare const _default: ESLintUtils.RuleModule<"useIsNullObject", [], unknown, ESLintUtils.RuleListener>;
export default _default;
@@ -0,0 +1,119 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const getFunction_1 = require("../utils/getFunction");
exports.default = utils_1.ESLintUtils.RuleCreator(() => "https://docs.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties")({
name: "test-for-null-using-isNullObject",
meta: {
type: "problem",
messages: {
useIsNullObject: "Test the isNullObject property of '{{name}}'.",
},
docs: {
description: "Do not test the truthiness of an object returned by an OrNullObject method or property. Test it's isNullObject property.",
},
schema: [],
fixable: "code",
},
create: function (context) {
var _a;
const sourceCode = (_a = context.sourceCode) !== null && _a !== void 0 ? _a : context.getSourceCode();
function isConditionalTestExpression(node) {
return (node.parent != undefined &&
(node.parent.type === utils_1.AST_NODE_TYPES.IfStatement ||
node.parent.type === utils_1.AST_NODE_TYPES.WhileStatement ||
node.parent.type === utils_1.AST_NODE_TYPES.DoWhileStatement ||
node.parent.type === utils_1.AST_NODE_TYPES.ForStatement ||
node.parent.type === utils_1.AST_NODE_TYPES.ConditionalExpression) &&
node === node.parent.test);
}
function isInUnaryNullTest(node) {
return (node.parent != undefined &&
node.parent.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
node.parent.operator === "!" &&
node.parent.argument === node);
}
function isInBinaryNullTest(node) {
return (node.parent != undefined &&
node.parent.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
((node.parent.left === node &&
node.parent.right.type === utils_1.AST_NODE_TYPES.Literal &&
node.parent.right.raw === "null") ||
(node.parent.right === node &&
node.parent.left.type === utils_1.AST_NODE_TYPES.Literal &&
node.parent.left.raw === "null")));
}
function isInNullTest(node) {
var _a;
return (isConditionalTestExpression(node) ||
((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.LogicalExpression ||
isInUnaryNullTest(node) ||
isInBinaryNullTest(node));
}
function isNullObjectNode(node) {
if (node &&
((node.type === utils_1.AST_NODE_TYPES.VariableDeclarator &&
node.init &&
(0, getFunction_1.isGetOrNullObjectFunction)(node.init) &&
node.id.type === utils_1.AST_NODE_TYPES.Identifier) ||
(node.type === utils_1.AST_NODE_TYPES.AssignmentExpression &&
(0, getFunction_1.isGetOrNullObjectFunction)(node.right) &&
node.left.type === utils_1.AST_NODE_TYPES.Identifier))) {
return true;
}
return false;
}
function findNullObjectNullTests(scope) {
const variables = scope.variables;
const childScopes = scope.childScopes;
for (let i = 0; i < variables.length; i++) {
const variable = variables[i];
const references = variable.references;
let nullObjectCall = false;
const nullTests = [];
for (let ref = 0; ref < references.length; ref++) {
const identifier = references[ref].identifier;
if (isNullObjectNode(identifier.parent)) {
nullObjectCall = true;
}
if (isInNullTest(identifier)) {
nullTests.push(identifier);
}
}
if (nullObjectCall === true && nullTests.length > 0) {
nullTests.forEach((identifier) => {
context.report({
node: identifier,
messageId: "useIsNullObject",
data: { name: identifier.name },
fix: function (fixer) {
let ruleFix;
if (isInBinaryNullTest(identifier) && identifier.parent) {
const newTest = identifier.name + ".isNullObject";
ruleFix = fixer.replaceText(identifier.parent, newTest);
}
else {
ruleFix = fixer.insertTextAfter(identifier, ".isNullObject");
}
return ruleFix;
},
});
});
}
}
for (let i = 0; i < childScopes.length; ++i) {
findNullObjectNullTests(childScopes[i]);
}
}
return {
"Program:exit"(node) {
const scope = sourceCode.getScope
? sourceCode.getScope(node)
: context.getScope();
findNullObjectNullTests(scope);
},
};
},
defaultOptions: [],
});
//# sourceMappingURL=test-for-null-using-isNullObject.js.map
@@ -0,0 +1 @@
{"version":3,"file":"test-for-null-using-isNullObject.js","sourceRoot":"","sources":["../../src/rules/test-for-null-using-isNullObject.ts"],"names":[],"mappings":";;AAAA,oDAIkC;AAGlC,sDAAiE;AAEjE,kBAAe,mBAAW,CAAC,WAAW,CACpC,GAAG,EAAE,CACH,0HAA0H,CAC7H,CAAC;IACA,IAAI,EAAE,kCAAkC;IACxC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,eAAe,EAAE,+CAA+C;SACjE;QACD,IAAI,EAAE;YACJ,WAAW,EACT,0HAA0H;SAC7H;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAyB,MAAM;KACvC;IACD,MAAM,EAAE,UAAU,OAAO;;QACvB,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QACjE,SAAS,2BAA2B,CAClC,IAAkD;YAElD,OAAO,CACL,IAAI,CAAC,MAAM,IAAI,SAAS;gBACxB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,WAAW;oBAC9C,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,cAAc;oBAClD,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB;oBACpD,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,YAAY;oBAChD,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,qBAAqB,CAAC;gBAC5D,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,CAC1B,CAAC;QACJ,CAAC;QAED,SAAS,iBAAiB,CACxB,IAAkD;YAElD,OAAO,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
"getAbsoluteResizedRange",
"getActiveCell",
"getActiveChart",
"getActiveNotebook",
"getActiveOutline",
"getActivePage",
"getActiveParagraph",
"getActiveSection",
"getActiveSlicer",
"getActiveWorksheet",
"getAncestor",
"getAsImage",
"getBase64Image",
"getBase64ImageSrc",
"getBorder",
"getBoundingRect",
"getById",
"getByName",
"getByNamespace",
"getByTag",
"getByTitle",
"getByTypes",
"getCell",
"getCellPadding",
"getCellProperties",
"getColumn",
"getColumnLabelRange",
"getColumnProperties",
"getColumnsAfter",
"getColumnsBefore",
"getCount",
"getDataBodyRange",
"getDataCommonPostprocess",
"getDataHierarchy",
"getDefault",
"getDescendants",
"getDimensionValues",
"getDirectPrecedents",
"getDocument",
"getEntireColumn",
"getEntireRow",
"getExtendedRange",
"getFilterAxisRange",
"getFirst",
"getFooter",
"getHeader",
"GetHeaderRowRange",
"getHtml",
"getHyperlinkRanges",
"getImage",
"getIntersection",
"getInvalidCells",
"getIsActiveCollabSession",
"getItem",
"getItemAt",
"getLast",
"getLastCell",
"getLastColumn",
"getLastRow",
"getLevelParagraphs",
"getLevelString",
"getLocation",
"getMergedAreas",
"getNext",
"getNextTextRange",
"getOffsetRange",
"getOffsetRangeAreas",
"getOoxml",
"getParagraphAfter",
"getParagraphBefore",
"getParagraphInfo",
"getParentComment",
"getPivotItems",
"getPivotTables",
"getPrevious",
"getPrintArea",
"getPrintTitleColumns",
"getPrintTitleRows",
"getRange",
"getRangeAreasBySheet",
"getRangeByIndexes",
"getRangeEdge",
"getRanges",
"getReferenceId",
"getResizedRange",
"getRestApiId",
"getRow",
"getRowLabelRange",
"getRowProperties",
"getRowsAbove",
"getRowsBelow",
"getSelectedRange",
"getSelectedRanges",
"getSelection",
"getSpecialCells",
"getSpillingToRange",
"getSpillParent",
"GetStencilInfo",
"getSubstring",
"getSurroundingRegion",
"getTables",
"getText",
"getTextRanges",
"getTotalRowRange",
"getUsedRange",
"getUsedRangeAreas",
"getVisibleView",
"getWindowSize",
"getXml"
],
"getOrNullObjectFunctions": [
"getActiveChartOrNullObject",
"getActiveNotebookOrNull",
"getActiveOutlineOrNull",
"getActivePageOrNull",
"getActiveParagraphOrNull",
"getActiveSectionOrNull",
"getActiveSlicerOrNullObject",
"getAncestorOrNullObject",
"getByIdOrNullObject",
"getCellOrNullObject",
"getFirstOrNullObject",
"getIntersectionOrNullObject",
"getIntersectionOrNullObject",
"getInvalidCellsOrNullObject",
"getItemOrNullObject",
"getLastOrNullObject",
"getLocationOrNullObject",
"getNextOrNullObject",
"getNextTextRangeOrNullObject",
"getParagraphAfterOrNullObject",
"getParagraphBeforeOrNullObject",
"getPreviousOrNullObject",
"getPrintAreaOrNullObject",
"getPrintTitleColumnsOrNullObject",
"getPrintTitleRowsOrNullObject",
"getRangeAreasOrNullObjectBySheet",
"getRangeOrNullObject",
"getSpecialCellsOrNullObject",
"getSpecialCellsOrNullObject",
"getSpillingToRangeOrNullObject",
"getSpillParentOrNullObject",
"getUsedRangeAreasOrNullObject",
"getUsedRangeOrNullObject"
]
}
+485
View File
@@ -0,0 +1,485 @@
{
"navigational": [
"_V1Api",
"application",
"areas",
"arrayValues",
"autoFilter",
"axes",
"beginConnectedShape",
"binOptions",
"bindings",
"border",
"borders",
"bottom",
"boxwhiskerOptions",
"categoryAxis",
"cellValue",
"cellValueOrNullObject",
"charts",
"colorScale",
"colorScaleOrNullObject",
"columnHierarchies",
"columns",
"conditionalFormats",
"cultureInfo",
"custom",
"customOrNullObject",
"customProperties",
"customXmlParts",
"dataBar",
"dataBarOrNullObject",
"dataConnections",
"dataHierarchies",
"dataLabel",
"dataLabels",
"dataValidation",
"datetimeFormat",
"defaultForAllPages",
"endConnectedShape",
"evenPages",
"field",
"fill",
"filter",
"filterHierarchies",
"firstPage",
"font",
"freezePanes",
"functions",
"geometricShape",
"group",
"headersFooters",
"hierarchies",
"horizontalPageBreaks",
"iconSet",
"iconSetOrNullObject",
"image",
"items",
"iterativeCalculation",
"label",
"layout",
"legend",
"legendEntries",
"line",
"lineFormat",
"majorGridlines",
"mapOptions",
"minorGridlines",
"namedSheetViews",
"names",
"negativeFormat",
"oddPages",
"pageLayout",
"parentGroup",
"pivotOptions",
"pivotStyle",
"pivotTableStyles",
"pivotTables",
"plotArea",
"points",
"positiveFormat",
"preset",
"presetOrNullObject",
"properties",
"protection",
"ranges",
"replies",
"right",
"rowHierarchies",
"rows",
"series",
"seriesAxis",
"settings",
"shape",
"shapes",
"slicerItems",
"slicerStyle",
"slicerStyles",
"slicers",
"sort",
"styles",
"tableStyle",
"tableStyles",
"tables",
"textComparison",
"textComparisonOrNullObject",
"textFrame",
"textRange",
"timelineStyles",
"topBottom",
"topBottomOrNullObject",
"trendlines",
"valueAxis",
"verticalPageBreaks",
"worksheet",
"worksheetOrNullObject",
"worksheets",
"xErrorBars",
"yErrorBars"
],
"scalar": [
"_Id",
"address",
"addressLocal",
"addresses",
"alignment",
"allowMultipleFiltersPerField",
"allowOverflow",
"allowUnderflow",
"altTextDescription",
"altTextTitle",
"areaCount",
"author",
"authorEmail",
"authorName",
"autoFormat",
"autoIndent",
"autoSave",
"autoSizeSetting",
"autoText",
"axisColor",
"axisFormat",
"axisGroup",
"backwardPeriod",
"barDirection",
"baseTimeUnit",
"beginArrowheadLength",
"beginArrowheadStyle",
"beginArrowheadWidth",
"beginConnectedSite",
"blackAndWhite",
"bold",
"borderColor",
"bottomMargin",
"bubbleScale",
"builtIn",
"calculationEngineVersion",
"calculationMode",
"calculationState",
"caption",
"category",
"categoryLabelLevel",
"categoryType",
"cellAddresses",
"cellCount",
"centerFooter",
"centerHeader",
"centerHorizontally",
"centerVertically",
"chartDataPointTrack",
"chartType",
"color",
"colorScheme",
"columnCount",
"columnHidden",
"columnIndex",
"columnWidth",
"comment",
"company",
"connectionSiteCount",
"connectorType",
"content",
"contentType",
"count",
"creationDate",
"criteria",
"customDisplayUnit",
"dashStyle",
"dateSeparator",
"decimalSeparator",
"displayBlanksAs",
"displayUnit",
"doughnutHoleSize",
"draftMode",
"emptyCellText",
"enableCalculation",
"enableDataValueEditing",
"enableEvents",
"enableFieldList",
"enableMultipleFilterItems",
"enabled",
"endArrowheadLength",
"endArrowheadStyle",
"endArrowheadWidth",
"endConnectedSite",
"endStyleCap",
"errorAlert",
"explosion",
"fillColor",
"fillEmptyCells",
"filtered",
"firstPageNumber",
"firstSliceAngle",
"footerMargin",
"foregroundColor",
"formula",
"formulaHidden",
"formulaLocal",
"formulaR1C1",
"formulas",
"formulasLocal",
"formulasR1C1",
"forwardPeriod",
"gapWidth",
"geometricShapeType",
"gradientFill",
"gradientMaximumColor",
"gradientMaximumType",
"gradientMaximumValue",
"gradientMidpointColor",
"gradientMidpointType",
"gradientMidpointValue",
"gradientMinimumColor",
"gradientMinimumType",
"gradientMinimumValue",
"gradientStyle",
"hasData",
"hasDataLabel",
"hasDataLabels",
"hasSpill",
"hasText",
"headerMargin",
"height",
"hidden",
"highlightFirstColumn",
"highlightLastColumn",
"horizontalAlignment",
"horizontalOverflow",
"hyperlink",
"id",
"ignoreBlanks",
"include",
"includeAlignment",
"includeBorder",
"includeFont",
"includeNumber",
"includePatterns",
"includeProtection",
"indentLevel",
"index",
"insideHeight",
"insideLeft",
"insideTop",
"insideWidth",
"intercept",
"invertColor",
"invertIfNegative",
"isBeginConnected",
"isBetweenCategories",
"isDataFiltered",
"isDirty",
"isEndConnected",
"isEntireColumn",
"isEntireRow",
"isExpanded",
"isFilterCleared",
"isSelected",
"italic",
"key",
"keywords",
"labelStrategy",
"lastAuthor",
"layoutType",
"leftFooter",
"leftHeader",
"leftMargin",
"legacyId",
"level",
"lineStyle",
"linkNumberFormat",
"linkedDataTypeState",
"lockAspectRatio",
"locked",
"logBase",
"longDatePattern",
"longTimePattern",
"lowerBoundRule",
"majorTickMark",
"majorTimeUnitScale",
"majorUnit",
"manager",
"markerBackgroundColor",
"markerForegroundColor",
"markerSize",
"markerStyle",
"matchCase",
"matchPositiveBorderColor",
"matchPositiveFillColor",
"maxChange",
"maxIteration",
"maximum",
"mentions",
"method",
"minimum",
"minorTickMark",
"minorTimeUnitScale",
"minorUnit",
"movingAveragePeriod",
"multiLevel",
"name",
"namespaceUri",
"numberDecimalSeparator",
"numberFormatCategories",
"numberFormatLocal",
"numberGroupSeparator",
"offset",
"options",
"orientation",
"overflowValue",
"overlap",
"overlay",
"paperSize",
"parentLabelStrategy",
"pattern",
"patternColor",
"patternTintAndShade",
"placement",
"plotBy",
"plotOrder",
"plotVisibleOnly",
"polynomialOrder",
"position",
"positionAt",
"preserveFormatting",
"previouslySaved",
"printComments",
"printErrors",
"printGridlines",
"printHeadings",
"printOrder",
"priority",
"projectionType",
"prompt",
"protected",
"quartileCalculation",
"readOnly",
"readingOrder",
"refreshOnOpen",
"removed",
"resolved",
"reverseIconOrder",
"reversePlotOrder",
"revisionNumber",
"richContent",
"rightFooter",
"rightHeader",
"rightMargin",
"rotation",
"roundedCorners",
"rowCount",
"rowHeight",
"rowHidden",
"rowIndex",
"savedAsArray",
"scaleType",
"scope",
"secondPlotSize",
"separator",
"seriesNameLevel",
"shortDatePattern",
"showAllFieldButtons",
"showAllItems",
"showAs",
"showAxisFieldButtons",
"showBandedColumns",
"showBandedRows",
"showBubbleSize",
"showCategoryName",
"showColumnGrandTotals",
"showConnectorLines",
"showDataBarOnly",
"showDataLabelsOverMaximum",
"showDisplayUnitLabel",
"showEquation",
"showFieldHeaders",
"showFilterButton",
"showGridlines",
"showHeaders",
"showHeadings",
"showIconOnly",
"showInnerPoints",
"showLeaderLines",
"showLegendFieldButtons",
"showLegendKey",
"showMeanLine",
"showMeanMarker",
"showOutlierPoints",
"showPercentage",
"showRSquared",
"showReportFilterFieldButtons",
"showRowGrandTotals",
"showSeriesName",
"showShadow",
"showTotals",
"showValue",
"showValueFieldButtons",
"shrinkToFit",
"sideIndex",
"size",
"smooth",
"sortBy",
"splitType",
"splitValue",
"standardHeight",
"standardWidth",
"state",
"stopIfTrue",
"strikethrough",
"style",
"subject",
"subscript",
"subtotalLocation",
"subtotals",
"summarizeBy",
"superscript",
"tabColor",
"text",
"textOrientation",
"thousandsSeparator",
"threeColorScale",
"tickLabelPosition",
"tickLabelSpacing",
"tickMarkSpacing",
"timeSeparator",
"tintAndShade",
"topMargin",
"transparency",
"type",
"types",
"underflowValue",
"underline",
"uniqueRemaining",
"upperBoundRule",
"useCustomSortLists",
"usePrecisionAsDisplayed",
"useSheetMargins",
"useSheetScale",
"useStandardHeight",
"useStandardWidth",
"useSystemSeparators",
"valid",
"value",
"valueTypes",
"values",
"varyByCategories",
"verticalAlignment",
"verticalOverflow",
"visibility",
"visible",
"weight",
"width",
"wrapText",
"zOrderPosition",
"zoom"
],
"ambiguous": [
"comments",
"fields",
"format",
"left",
"numberFormat",
"rule",
"title",
"top"
]
}
+3
View File
@@ -0,0 +1,3 @@
import { TSESTree } from "@typescript-eslint/utils";
export declare function isGetFunction(node: TSESTree.Node): boolean;
export declare function isGetOrNullObjectFunction(node: TSESTree.Node): boolean;
+45
View File
@@ -0,0 +1,45 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isGetFunction = isGetFunction;
exports.isGetOrNullObjectFunction = isGetOrNullObjectFunction;
const utils_1 = require("@typescript-eslint/utils");
const getJson = __importStar(require("./data/getFunctions.json"));
const getFunctions = new Set(getJson.getFunctions);
const getOrNullObjectFunctions = new Set(getJson.getOrNullObjectFunctions);
function isGetFunction(node) {
return (node.type == utils_1.TSESTree.AST_NODE_TYPES.CallExpression &&
node.callee.type === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
node.callee.property.type === utils_1.TSESTree.AST_NODE_TYPES.Identifier &&
(getFunctions.has(node.callee.property.name) ||
getOrNullObjectFunctions.has(node.callee.property.name)));
}
function isGetOrNullObjectFunction(node) {
return (node.type == utils_1.TSESTree.AST_NODE_TYPES.CallExpression &&
node.callee.type === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
node.callee.property.type === utils_1.TSESTree.AST_NODE_TYPES.Identifier &&
getOrNullObjectFunctions.has(node.callee.property.name));
}
//# sourceMappingURL=getFunction.js.map
@@ -0,0 +1 @@
{"version":3,"file":"getFunction.js","sourceRoot":"","sources":["../../src/utils/getFunction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAQA,sCAQC;AAED,8DAOC;AAzBD,oDAAoD;AACpD,kEAAoD;AAEpD,MAAM,YAAY,GAAgB,IAAI,GAAG,CAAS,OAAO,CAAC,YAAY,CAAC,CAAC;AACxE,MAAM,wBAAwB,GAAgB,IAAI,GAAG,CACnD,OAAO,CAAC,wBAAwB,CACjC,CAAC;AAEF,SAAgB,aAAa,CAAC,IAAmB;IAC/C,OAAO,CACL,IAAI,CAAC,IAAI,IAAI,gBAAQ,CAAC,cAAc,CAAC,cAAc;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,gBAAgB;QAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,UAAU;QAChE,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC1C,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED,SAAgB,yBAAyB,CAAC,IAAmB;IAC3D,OAAO,CACL,IAAI,CAAC,IAAI,IAAI,gBAAQ,CAAC,cAAc,CAAC,cAAc;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,gBAAgB;QAC7D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,UAAU;QAChE,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CACxD,CAAC;AACJ,CAAC"}
+7
View File
@@ -0,0 +1,7 @@
import { TSESTree } from "@typescript-eslint/utils";
export declare function isLoadFunction(node: TSESTree.MemberExpression): boolean;
export declare function isLoadCall(node: TSESTree.CallExpression): boolean;
export declare function isLoadReference(node: TSESTree.Identifier | TSESTree.JSXIdentifier): boolean;
export declare function isContextLoadArgumentReference(node: TSESTree.Identifier | TSESTree.JSXIdentifier): boolean;
export declare function parseLoadArguments(node: TSESTree.MemberExpression): string[];
export declare function parsePropertiesArgument(argument: TSESTree.CallExpressionArgument): string[];
+94
View File
@@ -0,0 +1,94 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isLoadFunction = isLoadFunction;
exports.isLoadCall = isLoadCall;
exports.isLoadReference = isLoadReference;
exports.isContextLoadArgumentReference = isContextLoadArgumentReference;
exports.parseLoadArguments = parseLoadArguments;
exports.parsePropertiesArgument = parsePropertiesArgument;
const utils_1 = require("@typescript-eslint/utils");
const utils_2 = require("./utils");
function isLoadFunction(node) {
const methodCall = (0, utils_2.findCallExpression)(node);
return methodCall !== undefined && isLoadCall(methodCall);
}
function isLoadCall(node) {
return (node &&
node.callee.type === utils_1.AST_NODE_TYPES.MemberExpression &&
node.callee.property.type === utils_1.AST_NODE_TYPES.Identifier &&
node.callee.property.name === "load");
}
function isLoadReference(node) {
return (node.parent &&
node.parent.type === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
isLoadFunction(node.parent));
}
function isContextLoadArgumentReference(node) {
var _a;
return (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.CallExpression &&
node.parent.callee.type === utils_1.AST_NODE_TYPES.MemberExpression &&
node.parent.callee.object.type === utils_1.AST_NODE_TYPES.Identifier &&
node.parent.callee.object.name === "context" &&
node.parent.callee.property.type === utils_1.AST_NODE_TYPES.Identifier &&
node.parent.callee.property.name === "load");
}
function parseObjectExpressionProperty(objectExpression) {
let composedProperties = [];
objectExpression.properties.forEach((property) => {
if (property.type === utils_1.AST_NODE_TYPES.Property &&
property.key.type === utils_1.AST_NODE_TYPES.Identifier) {
const propertyName = property.key.name;
if (property.value.type === utils_1.AST_NODE_TYPES.ObjectExpression) {
const composedProperty = parseObjectExpressionProperty(property.value);
if (composedProperty.length !== 0) {
composedProperties = composedProperties.concat(propertyName + "/" + composedProperty);
}
}
else if (property.value.type === utils_1.AST_NODE_TYPES.Literal &&
property.value.value // Checking if the value assigined to the property is true
) {
composedProperties = composedProperties.concat(propertyName);
}
}
});
return composedProperties;
}
function parseLoadStringArgument(argument) {
const properties = [];
argument
.replace(/\s/g, "")
.split(",")
.forEach((property) => {
properties.push(property);
});
return properties;
}
function parseLoadArguments(node) {
const methodCall = (0, utils_2.findCallExpression)(node);
if (methodCall && isLoadCall(methodCall)) {
const argument = methodCall.arguments[0];
if (!argument) {
return [];
}
return parsePropertiesArgument(argument);
}
throw new Error("error in parseLoadArgument function.");
}
function parsePropertiesArgument(argument) {
let properties = [];
if (argument.type === utils_1.AST_NODE_TYPES.ArrayExpression) {
argument.elements.forEach((element) => {
if (element != null && element.type === utils_1.TSESTree.AST_NODE_TYPES.Literal) {
properties = properties.concat(parseLoadStringArgument(element.value));
}
});
}
else if (argument.type === utils_1.TSESTree.AST_NODE_TYPES.Literal) {
properties = parseLoadStringArgument(argument.value);
}
else if (argument.type === utils_1.TSESTree.AST_NODE_TYPES.ObjectExpression) {
properties = parseObjectExpressionProperty(argument);
}
return properties;
}
//# sourceMappingURL=load.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/utils/load.ts"],"names":[],"mappings":";;AAGA,wCAGC;AAED,gCAOC;AAED,0CAQC;AAED,wEAWC;AA6CD,gDAYC;AAED,0DAmBC;AApHD,oDAAoE;AACpE,mCAA6C;AAE7C,SAAgB,cAAc,CAAC,IAA+B;IAC5D,MAAM,UAAU,GAAG,IAAA,0BAAkB,EAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;AAC5D,CAAC;AAED,SAAgB,UAAU,CAAC,IAA6B;IACtD,OAAO,CACL,IAAI;QACJ,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB;QACpD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU;QACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM,CACrC,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAC7B,IAAkD;IAElD,OAAO,CACL,IAAI,CAAC,MAAM;QACX,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,gBAAgB;QAC7D,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAC5B,CAAC;AACJ,CAAC;AAED,SAAgB,8BAA8B,CAC5C,IAAkD;;IAElD,OAAO,CACL,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,MAAK,sBAAc,CAAC,cAAc;QACnD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB;QAC3D,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CAAC;IACL,CAAC;SAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC7D,UAAU,GAAG,uBAAuB,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC;IACjE,CAAC;SAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,gBAAQ,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACtE,UAAU,GAAG,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,7 @@
export declare enum PropertyType {
navigational = 0,
scalar = 1,
ambiguous = 2,// Can be scalar or navigational. Depends of the context.
notProperty = 3
}
export declare function getPropertyType(propertyName: string): PropertyType;
+53
View File
@@ -0,0 +1,53 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PropertyType = void 0;
exports.getPropertyType = getPropertyType;
const propertiesJson = __importStar(require("./data/properties.json"));
var PropertyType;
(function (PropertyType) {
PropertyType[PropertyType["navigational"] = 0] = "navigational";
PropertyType[PropertyType["scalar"] = 1] = "scalar";
PropertyType[PropertyType["ambiguous"] = 2] = "ambiguous";
PropertyType[PropertyType["notProperty"] = 3] = "notProperty";
})(PropertyType || (exports.PropertyType = PropertyType = {}));
const navigationProperties = new Set(propertiesJson.navigational);
const scalarProperties = new Set(propertiesJson.scalar);
const ambiguousProperties = new Set(propertiesJson.ambiguous);
function getPropertyType(propertyName) {
if (navigationProperties.has(propertyName)) {
return PropertyType.navigational;
}
else if (scalarProperties.has(propertyName)) {
return PropertyType.scalar;
}
else if (ambiguousProperties.has(propertyName)) {
return PropertyType.ambiguous;
}
else {
return PropertyType.notProperty;
}
}
//# sourceMappingURL=propertiesType.js.map
@@ -0,0 +1 @@
{"version":3,"file":"propertiesType.js","sourceRoot":"","sources":["../../src/utils/propertiesType.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,0CAUC;AA3BD,uEAAyD;AAEzD,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,+DAAY,CAAA;IACZ,mDAAM,CAAA;IACN,yDAAS,CAAA;IACT,6DAAW,CAAA;AACb,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,MAAM,oBAAoB,GAAgB,IAAI,GAAG,CAC/C,cAAc,CAAC,YAAY,CAC5B,CAAC;AACF,MAAM,gBAAgB,GAAgB,IAAI,GAAG,CAAS,cAAc,CAAC,MAAM,CAAC,CAAC;AAC7E,MAAM,mBAAmB,GAAgB,IAAI,GAAG,CAC9C,cAAc,CAAC,SAAS,CACzB,CAAC;AAEF,SAAgB,eAAe,CAAC,YAAoB;IAClD,IAAI,oBAAoB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QAC3C,OAAO,YAAY,CAAC,YAAY,CAAC;IACnC,CAAC;SAAM,IAAI,gBAAgB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9C,OAAO,YAAY,CAAC,MAAM,CAAC;IAC7B,CAAC;SAAM,IAAI,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;QACjD,OAAO,YAAY,CAAC,SAAS,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAO,YAAY,CAAC,WAAW,CAAC;IAClC,CAAC;AACH,CAAC"}
+17
View File
@@ -0,0 +1,17 @@
import { TSESTree } from "@typescript-eslint/utils";
import { Reference, Scope } from "@typescript-eslint/scope-manager";
export declare function findTopMemberExpression(node: TSESTree.MemberExpression): TSESTree.MemberExpression;
export declare function findCallExpression(node: TSESTree.MemberExpression): TSESTree.CallExpression | undefined;
export type OfficeApiReference = {
/**
* Get: An OfficeJs object, which is created when calling a `get` type function
* Load: A reference to `object.load()` type call
* Method: The reference is calling a method. Ex: `object.methodCall()`
* Read: The reference value is being read and it is not a method
* Sync: A call to `context.sync()`
*/
operation: "Get" | "Load" | "Method" | "Read" | "Sync";
reference: Reference;
};
export declare function findOfficeApiReferences(scope: Scope): OfficeApiReference[];
export declare function findPropertiesRead(node: TSESTree.Node | undefined): string;
+99
View File
@@ -0,0 +1,99 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findTopMemberExpression = findTopMemberExpression;
exports.findCallExpression = findCallExpression;
exports.findOfficeApiReferences = findOfficeApiReferences;
exports.findPropertiesRead = findPropertiesRead;
const utils_1 = require("@typescript-eslint/utils");
const getFunction_1 = require("./getFunction");
const load_1 = require("./load");
function isContextSyncIdentifier(node) {
var _a, _b;
return (node.name === "context" &&
((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.MemberExpression &&
((_b = node.parent.parent) === null || _b === void 0 ? void 0 : _b.type) === utils_1.AST_NODE_TYPES.CallExpression &&
node.parent.property.type === utils_1.AST_NODE_TYPES.Identifier &&
node.parent.property.name === "sync");
}
function findTopMemberExpression(node) {
while (node.parent && node.parent.type === utils_1.AST_NODE_TYPES.MemberExpression) {
node = node.parent;
}
return node;
}
function findCallExpression(node) {
var _a;
while (node.parent && node.parent.type === utils_1.AST_NODE_TYPES.MemberExpression) {
node = node.parent;
}
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.CallExpression) {
return node.parent;
}
return undefined;
}
let proxyVariables;
let apiReferences;
function findOfficeApiReferences(scope) {
proxyVariables = new Set();
apiReferences = [];
findOfficeApiReferencesInScope(scope);
return apiReferences;
}
function findOfficeApiReferencesInScope(scope) {
scope.references.forEach((reference) => {
const node = reference.identifier;
if (reference.isWrite() &&
reference.writeExpr &&
(0, getFunction_1.isGetFunction)(reference.writeExpr) &&
reference.resolved) {
proxyVariables.add(reference.resolved);
apiReferences.push({ operation: "Get", reference: reference });
}
else if (isContextSyncIdentifier(reference.identifier)) {
apiReferences.push({ operation: "Sync", reference: reference });
}
else if (reference.isRead() &&
reference.resolved &&
proxyVariables.has(reference.resolved)) {
if ((0, load_1.isLoadReference)(node)) {
// <obj>.load(...)
apiReferences.push({ operation: "Load", reference: reference });
}
else if ((0, load_1.isContextLoadArgumentReference)(node)) {
// context.load(<obj>, ...)
apiReferences.push({ operation: "Load", reference: reference });
}
else if (isMethodReference(node)) {
apiReferences.push({ operation: "Method", reference: reference });
}
else {
apiReferences.push({ operation: "Read", reference: reference });
}
}
});
scope.childScopes.forEach(findOfficeApiReferencesInScope);
}
function isMethod(node) {
var _a;
const topExpression = findTopMemberExpression(node);
return (((_a = topExpression.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.CallExpression &&
topExpression.parent.callee === topExpression);
}
function isMethodReference(node) {
return (node.parent &&
node.parent.type === utils_1.TSESTree.AST_NODE_TYPES.MemberExpression &&
isMethod(node.parent));
}
function findPropertiesRead(node) {
let propertyName = ""; // Will be a string combined with '/' for the case of navigation properties
while (node) {
if (node.type === utils_1.AST_NODE_TYPES.MemberExpression &&
node.property.type === utils_1.AST_NODE_TYPES.Identifier &&
!isMethod(node)) {
propertyName += node.property.name + "/";
}
node = node.parent;
}
return propertyName.slice(0, -1);
}
//# sourceMappingURL=utils.js.map
+1
View File
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