@amazon-devices/eslint-plugin-kepler 0.1.8 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -11
- package/dist/formatters/default.js +8 -189
- package/dist/formatters/default.js.LICENSE.txt +1 -0
- package/dist/index.js +1 -107
- package/package.json +1 -1
- package/dist/formatters/KeplerReport.js +0 -40
- package/dist/metrics/Metrics.js +0 -69
- package/dist/metrics/TelemetryService.js +0 -48
- package/dist/rules/apiPrivileges/ApiPrivilegeStateCheck.js +0 -102
- package/dist/rules/apiPrivileges/ApiPrivilegesCheck.js +0 -67
- package/dist/rules/apiPrivileges/apiPermissionsNeeded.js +0 -58
- package/dist/rules/apiPrivileges/manifestHelper.js +0 -44
- package/dist/rules/backwardCompatibility/BackwardCompatibility.js +0 -119
- package/dist/rules/backwardCompatibility/BackwardCompatibilityCopyOnPack.js +0 -101
- package/dist/rules/backwardCompatibility/BackwardCompatibilitySysconfCheck.js +0 -73
- package/dist/rules/performance/Animated.js +0 -64
- package/dist/rules/performance/CheckSubscription.js +0 -150
- package/dist/rules/performance/DetectSplashScreen.js +0 -62
- package/dist/rules/performance/DetectUseReportFullyDrawn.js +0 -50
- package/dist/rules/performance/FlatList.js +0 -39
- package/dist/rules/systemDistributedLibs/SDLPackageVersionCheck.js +0 -136
- package/dist/rules/systemDistributedLibs/SDLPackageVersionCheckImports.js +0 -58
- package/dist/rules/systemDistributedLibs/sdlHelpers.js +0 -232
- package/dist/rules/systemDistributedLibs/sdlRuleMessages.js +0 -25
- package/dist/state/KeplerESLintPluginStateManager.js +0 -94
- package/dist/utils/Constants.js +0 -40
- package/dist/utils/PackageUtils.js +0 -50
- package/dist/utils/RuleUtils.js +0 -128
package/dist/utils/Constants.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.VEGA_DOC_BASE_URL = exports.VEGA_BEST_PRACTICE_URL = exports.UNKNOWN = exports.REACT_DOC_BASE_URL = exports.PROJECT_DIR_PATH = exports.KeplerESLintRuleIds = exports.KEPLER_ESLINT_RULE_PREFIX = exports.KEPLER_ESLINT_OUTPUT_DIR_PATH = exports.ICON_WARN = exports.ICON_ERROR = exports.ESLintRuleSeverity = exports.DOC_BASE_URL = void 0;
|
|
7
|
-
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
-
// Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
10
|
-
// AMAZON PROPRIETARY/CONFIDENTIAL
|
|
11
|
-
// You may not use this file except in compliance with the terms and conditions
|
|
12
|
-
// set forth in the accompanying LICENSE.TXT file.
|
|
13
|
-
// THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
14
|
-
// DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
15
|
-
// IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
16
|
-
// FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
17
|
-
let KeplerESLintRuleIds = exports.KeplerESLintRuleIds = /*#__PURE__*/function (KeplerESLintRuleIds) {
|
|
18
|
-
KeplerESLintRuleIds["FlatList"] = "@amazon-devices/kepler/flat-list";
|
|
19
|
-
KeplerESLintRuleIds["Animated"] = "@amazon-devices/kepler/animated";
|
|
20
|
-
KeplerESLintRuleIds["NoComplexScrollView"] = "@amazon-devices/kepler/no-complex-scroll-view";
|
|
21
|
-
KeplerESLintRuleIds["DetectReportFullyDrawn"] = "@amazon-devices/kepler/detect-report-fully-drawn";
|
|
22
|
-
KeplerESLintRuleIds["DetectSplashScreen"] = "@amazon-devices/kepler/detect-splash-screen";
|
|
23
|
-
return KeplerESLintRuleIds;
|
|
24
|
-
}({});
|
|
25
|
-
let ESLintRuleSeverity = exports.ESLintRuleSeverity = /*#__PURE__*/function (ESLintRuleSeverity) {
|
|
26
|
-
ESLintRuleSeverity[ESLintRuleSeverity["OFF"] = 0] = "OFF";
|
|
27
|
-
ESLintRuleSeverity[ESLintRuleSeverity["WARNING"] = 1] = "WARNING";
|
|
28
|
-
ESLintRuleSeverity[ESLintRuleSeverity["ERROR"] = 2] = "ERROR";
|
|
29
|
-
return ESLintRuleSeverity;
|
|
30
|
-
}({});
|
|
31
|
-
const PROJECT_DIR_PATH = exports.PROJECT_DIR_PATH = process.cwd();
|
|
32
|
-
const KEPLER_ESLINT_OUTPUT_DIR_PATH = exports.KEPLER_ESLINT_OUTPUT_DIR_PATH = path.join(PROJECT_DIR_PATH, 'generated', 'eslint-plugin-kepler');
|
|
33
|
-
const ICON_WARN = exports.ICON_WARN = '⚠️';
|
|
34
|
-
const ICON_ERROR = exports.ICON_ERROR = '❌';
|
|
35
|
-
const KEPLER_ESLINT_RULE_PREFIX = exports.KEPLER_ESLINT_RULE_PREFIX = '@amazon-devices/kepler';
|
|
36
|
-
const UNKNOWN = exports.UNKNOWN = 'UNKNOWN';
|
|
37
|
-
const DOC_BASE_URL = exports.DOC_BASE_URL = 'https://developer.amazon.com/docs';
|
|
38
|
-
const REACT_DOC_BASE_URL = exports.REACT_DOC_BASE_URL = `${DOC_BASE_URL}/react-native-vega/0.72`;
|
|
39
|
-
const VEGA_DOC_BASE_URL = exports.VEGA_DOC_BASE_URL = `${DOC_BASE_URL}/vega/0.21`;
|
|
40
|
-
const VEGA_BEST_PRACTICE_URL = exports.VEGA_BEST_PRACTICE_URL = `${VEGA_DOC_BASE_URL}/best_practices.html`;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getAppManifest = getAppManifest;
|
|
7
|
-
exports.getKeplerESLintPackageJson = getKeplerESLintPackageJson;
|
|
8
|
-
var fs = _interopRequireWildcard(require("fs"));
|
|
9
|
-
var path = _interopRequireWildcard(require("path"));
|
|
10
|
-
var toml = _interopRequireWildcard(require("toml"));
|
|
11
|
-
var package_json = _interopRequireWildcard(require("../../package.json"));
|
|
12
|
-
var _Constants = require("./Constants");
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
-
// Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
16
|
-
// AMAZON PROPRIETARY/CONFIDENTIAL
|
|
17
|
-
// You may not use this file except in compliance with the terms and conditions
|
|
18
|
-
// set forth in the accompanying LICENSE.TXT file.
|
|
19
|
-
// THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
20
|
-
// DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
21
|
-
// IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
// FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
23
|
-
|
|
24
|
-
let PROJECT_MANIFEST_JSON = undefined;
|
|
25
|
-
const MANIFEST_TOML = 'manifest.toml';
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Returns the manifest.toml of the project on which eslint is executed.
|
|
29
|
-
* @returns manifest.toml file as a JSON object
|
|
30
|
-
*/
|
|
31
|
-
function getAppManifest() {
|
|
32
|
-
if (PROJECT_MANIFEST_JSON) {
|
|
33
|
-
return PROJECT_MANIFEST_JSON;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const fileData = fs.readFileSync(path.join(_Constants.PROJECT_DIR_PATH, MANIFEST_TOML), 'utf8');
|
|
37
|
-
PROJECT_MANIFEST_JSON = toml.parse(fileData);
|
|
38
|
-
} catch (err) {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
return PROJECT_MANIFEST_JSON;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Returns the package.json of eslint-plugin-kepler.
|
|
46
|
-
* @returns package.json file as a JSON object
|
|
47
|
-
*/
|
|
48
|
-
function getKeplerESLintPackageJson() {
|
|
49
|
-
return package_json;
|
|
50
|
-
}
|
package/dist/utils/RuleUtils.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isAliasCall = isAliasCall;
|
|
7
|
-
exports.isBrazilRepo = void 0;
|
|
8
|
-
exports.isDirectCall = isDirectCall;
|
|
9
|
-
exports.isFunctionAssignedToVariable = isFunctionAssignedToVariable;
|
|
10
|
-
exports.isModuleFunctionAssignedToVariable = isModuleFunctionAssignedToVariable;
|
|
11
|
-
exports.isNamespacedCall = isNamespacedCall;
|
|
12
|
-
exports.isSDLProject = void 0;
|
|
13
|
-
var fs = _interopRequireWildcard(require("fs"));
|
|
14
|
-
var path = _interopRequireWildcard(require("path"));
|
|
15
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
-
// Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
17
|
-
// AMAZON PROPRIETARY/CONFIDENTIAL
|
|
18
|
-
// You may not use this file except in compliance with the terms and conditions
|
|
19
|
-
// set forth in the accompanying LICENSE.TXT file.
|
|
20
|
-
// THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
21
|
-
// DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
22
|
-
// IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
// FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
24
|
-
|
|
25
|
-
const NODE_TYPE_IDENTIFIER = 'Identifier';
|
|
26
|
-
const NODE_TYPE_MEMBER_EXPRESSION = 'MemberExpression';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns true if the provided function is assigned to a variable.
|
|
30
|
-
* e.g.
|
|
31
|
-
* import { useReportFullyDrawn } from '@amazon-devices/kepler-performance-api';
|
|
32
|
-
* const reportFullyDrawn = useReportFullyDrawn;
|
|
33
|
-
* @param node
|
|
34
|
-
* @param functionName
|
|
35
|
-
* @returns
|
|
36
|
-
*/
|
|
37
|
-
function isFunctionAssignedToVariable(node, functionName) {
|
|
38
|
-
if (node.init?.type === NODE_TYPE_IDENTIFIER && node.init.name === functionName) {
|
|
39
|
-
if (node.id.type === NODE_TYPE_IDENTIFIER) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Returns true if the provided function accessed through module, is assigned to a variable
|
|
48
|
-
* e.g.
|
|
49
|
-
* import * as keplerPerfModule from '@amazon-devices/kepler-performance-api';
|
|
50
|
-
* const reportFullyDrawn = keplerPerfModule.useReportFullyDrawn;
|
|
51
|
-
* @param node
|
|
52
|
-
* @param functionName
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
function isModuleFunctionAssignedToVariable(node, functionName) {
|
|
56
|
-
if (node.init?.type === NODE_TYPE_MEMBER_EXPRESSION && node.init.property.type === NODE_TYPE_IDENTIFIER && node.init.property.name === functionName) {
|
|
57
|
-
if (node.id.type === NODE_TYPE_IDENTIFIER) {
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Checks if a function call is a direct call to the function.
|
|
66
|
-
* e.g.
|
|
67
|
-
* import { useReportFullyDrawn } from '@amazon-devices/kepler-performance-api';
|
|
68
|
-
* useReportFullyDrawn();
|
|
69
|
-
* @param node
|
|
70
|
-
* @param functionName
|
|
71
|
-
* @returns
|
|
72
|
-
*/
|
|
73
|
-
function isDirectCall(node, functionName) {
|
|
74
|
-
return node.callee.type === NODE_TYPE_IDENTIFIER && node.callee.name === functionName;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Checks if a function call is an alias call to the function.
|
|
79
|
-
* e.g.
|
|
80
|
-
* a)
|
|
81
|
-
* import { useReportFullyDrawn } from '@amazon-devices/kepler-performance-api';
|
|
82
|
-
* const reportFullyDrawn = useReportFullyDrawn;
|
|
83
|
-
* reportFullyDrawn();
|
|
84
|
-
*
|
|
85
|
-
* b)
|
|
86
|
-
* import * as keplerPerfModule from '@amazon-devices/kepler-performance-api';
|
|
87
|
-
* const reportFullyDrawn = keplerPerfModule.useReportFullyDrawn;
|
|
88
|
-
* reportFullyDrawn();
|
|
89
|
-
*
|
|
90
|
-
* @param node
|
|
91
|
-
* @param functionName
|
|
92
|
-
* @param aliases
|
|
93
|
-
* @returns
|
|
94
|
-
*/
|
|
95
|
-
function isAliasCall(node, functionName, aliases) {
|
|
96
|
-
return node.callee.type === NODE_TYPE_IDENTIFIER && aliases.has(node.callee.name);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Checks if a function call is a namespaced call to the function.
|
|
101
|
-
* e.g.
|
|
102
|
-
* import * as keplerPerfModule from '@amazon-devices/kepler-performance-api';
|
|
103
|
-
* keplerPerfModule.useReportFullyDrawn();
|
|
104
|
-
* @param node
|
|
105
|
-
* @param functionName
|
|
106
|
-
* @returns
|
|
107
|
-
*/
|
|
108
|
-
function isNamespacedCall(node, functionName) {
|
|
109
|
-
return node.callee.type === NODE_TYPE_MEMBER_EXPRESSION && node.callee.property.type === NODE_TYPE_IDENTIFIER && node.callee.property.name === functionName;
|
|
110
|
-
}
|
|
111
|
-
const fileExists = (fileName, projectRoot = process.cwd()) => {
|
|
112
|
-
const configPath = path.join(projectRoot, fileName);
|
|
113
|
-
return fs.existsSync(configPath);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Checks if the current repository is a Brazil repository by looking for a Config file in the root folder.
|
|
118
|
-
* @returns true if Config file exists in root, false otherwise
|
|
119
|
-
*/
|
|
120
|
-
const isBrazilRepo = () => fileExists('Config');
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Checks if the current repository is a Vega SDL project by looking for kepler-system-conf.toml file in the root folder.
|
|
124
|
-
* @returns true if kepler-system-conf.toml file exists in root, false otherwise
|
|
125
|
-
*/
|
|
126
|
-
exports.isBrazilRepo = isBrazilRepo;
|
|
127
|
-
const isSDLProject = () => fileExists('kepler-system-conf.toml');
|
|
128
|
-
exports.isSDLProject = isSDLProject;
|