eslint-plugin-cvsdk-rules 19.2.1 → 19.2.2-ion-memory
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/build/rules/no-platform-globals-outside-device.d.ts +8 -0
- package/build/rules/no-platform-globals-outside-device.d.ts.map +1 -0
- package/build/rules/no-platform-globals-outside-device.js +102 -0
- package/build/rules/no-platform-globals-outside-device.js.map +1 -0
- package/build/src/index.d.ts +13 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +21 -0
- package/build/src/index.js.map +1 -0
- package/build/src/rules/no-device-type-imports.d.ts +3 -0
- package/build/src/rules/no-device-type-imports.d.ts.map +1 -0
- package/build/src/rules/no-device-type-imports.js +36 -0
- package/build/src/rules/no-device-type-imports.js.map +1 -0
- package/build/src/rules/no-object-from-entries.d.ts +3 -0
- package/build/src/rules/no-object-from-entries.d.ts.map +1 -0
- package/build/src/rules/no-object-from-entries.js +34 -0
- package/build/src/rules/no-object-from-entries.js.map +1 -0
- package/build/src/rules/prefer-makeRequest-over-fetch.d.ts +3 -0
- package/build/src/rules/prefer-makeRequest-over-fetch.d.ts.map +1 -0
- package/build/src/rules/prefer-makeRequest-over-fetch.js +30 -0
- package/build/src/rules/prefer-makeRequest-over-fetch.js.map +1 -0
- package/build/src/rules/prefer-no-lodash-clone-deep.d.ts +3 -0
- package/build/src/rules/prefer-no-lodash-clone-deep.d.ts.map +1 -0
- package/build/src/rules/prefer-no-lodash-clone-deep.js +27 -0
- package/build/src/rules/prefer-no-lodash-clone-deep.js.map +1 -0
- package/build/src/rules/prefer-private-exposables.d.ts +3 -0
- package/build/src/rules/prefer-private-exposables.d.ts.map +1 -0
- package/build/src/rules/prefer-private-exposables.js +29 -0
- package/build/src/rules/prefer-private-exposables.js.map +1 -0
- package/build/src/rules/prefer-self-over-window.d.ts +3 -0
- package/build/src/rules/prefer-self-over-window.d.ts.map +1 -0
- package/build/src/rules/prefer-self-over-window.js +38 -0
- package/build/src/rules/prefer-self-over-window.js.map +1 -0
- package/build/src/rules/prefer-txml-over-domparser.d.ts +3 -0
- package/build/src/rules/prefer-txml-over-domparser.d.ts.map +1 -0
- package/build/src/rules/prefer-txml-over-domparser.js +27 -0
- package/build/src/rules/prefer-txml-over-domparser.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
type Options = [{
|
|
3
|
+
checkUserAgent?: boolean;
|
|
4
|
+
}];
|
|
5
|
+
type MessageIds = 'forbiddenPlatformGlobal' | 'forbiddenUserAgent';
|
|
6
|
+
export declare const rule: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=no-platform-globals-outside-device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-platform-globals-outside-device.d.ts","sourceRoot":"","sources":["../../src/rules/no-platform-globals-outside-device.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAgC,MAAM,0BAA0B,CAAC;AAQrG,KAAK,OAAO,GAAG,CAAC;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAC9C,KAAK,UAAU,GAAG,yBAAyB,GAAG,oBAAoB,CAAC;AAsEnE,eAAO,MAAM,IAAI,gFAuCf,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// cspell:words OSTV hbbtv
|
|
2
|
+
import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils';
|
|
3
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
4
|
+
const PLATFORM_GLOBALS = ['tizen', 'webOS', 'webOSTV', 'cast', 'Hisense', 'hbbtv', 'Android', 'ion'];
|
|
5
|
+
const GLOBAL_OBJECTS = ['self', 'globalThis'];
|
|
6
|
+
const PLATFORM_GLOBALS_PATTERN = `/^(${PLATFORM_GLOBALS.join('|')})$/`;
|
|
7
|
+
function isAmbientDefinition(definition) {
|
|
8
|
+
const declaration = definition.parent ?? definition.node;
|
|
9
|
+
return 'declare' in declaration && declaration.declare;
|
|
10
|
+
}
|
|
11
|
+
/** `declare const tizen: ...` still refers to the platform global, so only real declarations count as local. */
|
|
12
|
+
function isDeclaredLocally(scope, name) {
|
|
13
|
+
for (let current = scope; current; current = current.upper) {
|
|
14
|
+
const variable = current.set.get(name);
|
|
15
|
+
if (variable) {
|
|
16
|
+
return variable.defs.some((definition) => !isAmbientDefinition(definition));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
function unwrapTypeExpressions(node) {
|
|
22
|
+
let current = node;
|
|
23
|
+
while (current.type === AST_NODE_TYPES.TSAsExpression ||
|
|
24
|
+
current.type === AST_NODE_TYPES.TSNonNullExpression ||
|
|
25
|
+
current.type === AST_NODE_TYPES.TSSatisfiesExpression ||
|
|
26
|
+
current.type === AST_NODE_TYPES.TSTypeAssertion) {
|
|
27
|
+
current = current.expression;
|
|
28
|
+
}
|
|
29
|
+
return current;
|
|
30
|
+
}
|
|
31
|
+
function isGlobalObject(node) {
|
|
32
|
+
const object = unwrapTypeExpressions(node);
|
|
33
|
+
return object.type === AST_NODE_TYPES.Identifier && GLOBAL_OBJECTS.includes(object.name);
|
|
34
|
+
}
|
|
35
|
+
function reportIfGlobal(context, node) {
|
|
36
|
+
if (node.type === AST_NODE_TYPES.Identifier && !isDeclaredLocally(context.sourceCode.getScope(node), node.name)) {
|
|
37
|
+
context.report({ node, messageId: 'forbiddenPlatformGlobal', data: { name: node.name } });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Resolves `obj.name`, `obj['name']` and `` obj[`name`] `` alike so bracket notation cannot bypass the rule. */
|
|
41
|
+
function getStaticPropertyName(node) {
|
|
42
|
+
const { property } = node;
|
|
43
|
+
if (!node.computed && property.type === AST_NODE_TYPES.Identifier) {
|
|
44
|
+
return property.name;
|
|
45
|
+
}
|
|
46
|
+
if (property.type === AST_NODE_TYPES.Literal && typeof property.value === 'string') {
|
|
47
|
+
return property.value;
|
|
48
|
+
}
|
|
49
|
+
if (property.type === AST_NODE_TYPES.TemplateLiteral && property.expressions.length === 0) {
|
|
50
|
+
return property.quasis[0]?.value.cooked ?? undefined;
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
function checkPropertyAccess(context, node, checkUserAgent) {
|
|
55
|
+
const name = getStaticPropertyName(node);
|
|
56
|
+
if (name === undefined) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (PLATFORM_GLOBALS.includes(name) && isGlobalObject(node.object)) {
|
|
60
|
+
context.report({ node: node.property, messageId: 'forbiddenPlatformGlobal', data: { name } });
|
|
61
|
+
}
|
|
62
|
+
else if (checkUserAgent && name === 'userAgent') {
|
|
63
|
+
context.report({ node: node.property, messageId: 'forbiddenUserAgent' });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const rule = createRule({
|
|
67
|
+
create(context, [{ checkUserAgent = false }]) {
|
|
68
|
+
return {
|
|
69
|
+
[`MemberExpression[object.type='Identifier'][object.name=${PLATFORM_GLOBALS_PATTERN}]`]: (node) => {
|
|
70
|
+
reportIfGlobal(context, node.object);
|
|
71
|
+
},
|
|
72
|
+
[`UnaryExpression[operator='typeof'][argument.type='Identifier'][argument.name=${PLATFORM_GLOBALS_PATTERN}]`]: (node) => {
|
|
73
|
+
reportIfGlobal(context, node.argument);
|
|
74
|
+
},
|
|
75
|
+
MemberExpression: (node) => {
|
|
76
|
+
checkPropertyAccess(context, node, checkUserAgent);
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
name: 'no-platform-globals-outside-device',
|
|
81
|
+
meta: {
|
|
82
|
+
docs: {
|
|
83
|
+
description: 'Detect device runtime globals and user-agent sniffing in device agnostic parts of the CVSDK',
|
|
84
|
+
},
|
|
85
|
+
messages: {
|
|
86
|
+
forbiddenPlatformGlobal: 'This portion of the CVSDK is device agnostic. Please do not access the `{{name}}` platform global here; keep it in device or proposition code and expose the behaviour through config or capabilities.',
|
|
87
|
+
forbiddenUserAgent: 'This portion of the CVSDK is device agnostic. Please do not read `userAgent` here; use device info, capabilities or config instead of user-agent sniffing.',
|
|
88
|
+
},
|
|
89
|
+
schema: [
|
|
90
|
+
{
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {
|
|
93
|
+
checkUserAgent: { type: 'boolean' },
|
|
94
|
+
},
|
|
95
|
+
additionalProperties: false,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
type: 'problem',
|
|
99
|
+
},
|
|
100
|
+
defaultOptions: [{ checkUserAgent: false }],
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=no-platform-globals-outside-device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-platform-globals-outside-device.js","sourceRoot":"","sources":["../../src/rules/no-platform-globals-outside-device.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAgC,MAAM,0BAA0B,CAAC;AAErG,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AACrG,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAC9C,MAAM,wBAAwB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;AAMvE,SAAS,mBAAmB,CAAC,UAAqC;IAC9D,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC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;QACD,IAAI,EAAE,SAAS;KAClB;IACD,cAAc,EAAE,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;CAC9C,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const plugin: {
|
|
2
|
+
rules: {
|
|
3
|
+
'prefer-no-lodash-cloneDeep': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forbiddenCloneDeepUsage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
4
|
+
'prefer-self-over-window': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forbiddenWindowAccess", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
'prefer-txml-over-domparser': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forbiddenDomParserUsage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
6
|
+
'no-device-type-imports': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forbiddenDeviceTypeUsage" | "forbiddenDeviceTypeUtilUsage", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
|
+
'prefer-private-exposables': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferPrivateExposable", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
|
+
'prefer-makeRequest-over-fetch': import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferMakeRequest", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
+
'no-object-from-entries': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noObjectFromEntries", [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export { plugin };
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,MAAM;;;;;;;;;;CAEX,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { rule as preferSelfOverWindow } from './rules/prefer-self-over-window.js';
|
|
2
|
+
import { rule as preferTxmlOverDomParser } from './rules/prefer-txml-over-domparser.js';
|
|
3
|
+
import { rule as preferNoLodashCloneDeep } from './rules/prefer-no-lodash-clone-deep.js';
|
|
4
|
+
import { rule as noDeviceTypeImports } from './rules/no-device-type-imports.js';
|
|
5
|
+
import { rule as preferPrivateExposables } from './rules/prefer-private-exposables.js';
|
|
6
|
+
import { rule as preferMakeRequestOverFetch } from './rules/prefer-makeRequest-over-fetch.js';
|
|
7
|
+
import { rule as noObjectFromEntries } from './rules/no-object-from-entries.js';
|
|
8
|
+
const rules = {
|
|
9
|
+
'prefer-no-lodash-cloneDeep': preferNoLodashCloneDeep,
|
|
10
|
+
'prefer-self-over-window': preferSelfOverWindow,
|
|
11
|
+
'prefer-txml-over-domparser': preferTxmlOverDomParser,
|
|
12
|
+
'no-device-type-imports': noDeviceTypeImports,
|
|
13
|
+
'prefer-private-exposables': preferPrivateExposables,
|
|
14
|
+
'prefer-makeRequest-over-fetch': preferMakeRequestOverFetch,
|
|
15
|
+
'no-object-from-entries': noObjectFromEntries,
|
|
16
|
+
};
|
|
17
|
+
const plugin = {
|
|
18
|
+
rules,
|
|
19
|
+
};
|
|
20
|
+
export { plugin };
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,IAAI,IAAI,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,IAAI,IAAI,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,IAAI,IAAI,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,IAAI,IAAI,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,IAAI,IAAI,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,IAAI,IAAI,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,MAAM,KAAK,GAAG;IACV,4BAA4B,EAAE,uBAAuB;IACrD,yBAAyB,EAAE,oBAAoB;IAC/C,4BAA4B,EAAE,uBAAuB;IACrD,wBAAwB,EAAE,mBAAmB;IAC7C,2BAA2B,EAAE,uBAAuB;IACpD,+BAA+B,EAAE,0BAA0B;IAC3D,wBAAwB,EAAE,mBAAmB;CAChD,CAAC;AAEF,MAAM,MAAM,GAAG;IACX,KAAK;CACR,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-device-type-imports.d.ts","sourceRoot":"","sources":["../../../src/rules/no-device-type-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAItE,eAAO,MAAM,IAAI,4HAoCf,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
return {
|
|
6
|
+
"Program:has(ImportDeclaration[source.value='@sky-uk-ott/client-lib-js-device'] > ImportSpecifier[imported.name=DeviceType])": (node) => {
|
|
7
|
+
context.report({
|
|
8
|
+
node,
|
|
9
|
+
messageId: 'forbiddenDeviceTypeUsage',
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
// Note the unicode character here is required to match a forward slash in the import path
|
|
13
|
+
// See https://eslint.org/docs/latest/extend/selectors#known-issues
|
|
14
|
+
'Program:has(ImportDeclaration[source.value=/.*\\u002Fdevice-type/])': (node) => {
|
|
15
|
+
context.report({
|
|
16
|
+
node,
|
|
17
|
+
messageId: 'forbiddenDeviceTypeUtilUsage',
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
name: 'no-device-type-imports',
|
|
23
|
+
meta: {
|
|
24
|
+
docs: {
|
|
25
|
+
description: 'Detect DeviceType usage in the CVSDK',
|
|
26
|
+
},
|
|
27
|
+
messages: {
|
|
28
|
+
forbiddenDeviceTypeUsage: 'This portion of the CVSDK is device agnostic. Please do not directly use DeviceType for device specific functionality.',
|
|
29
|
+
forbiddenDeviceTypeUtilUsage: 'This portion of the CVSDK is device agnostic. Please do not directly use the utils/device-type module for device specific functionality.',
|
|
30
|
+
},
|
|
31
|
+
schema: [],
|
|
32
|
+
type: 'problem',
|
|
33
|
+
},
|
|
34
|
+
defaultOptions: [],
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=no-device-type-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-device-type-imports.js","sourceRoot":"","sources":["../../../src/rules/no-device-type-imports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAEtE,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,OAAO;YACH,6HAA6H,EAAE,CAC3H,IAAoC,EACtC,EAAE,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,0BAA0B;iBACxC,CAAC,CAAC;YAAA,CACN;YACD,0FAA0F;YAC1F,mEAAmE;YACnE,qEAAqE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC7E,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,8BAA8B;iBAC5C,CAAC,CAAC;YAAA,CACN;SACJ,CAAC;IAAA,CACL;IACD,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EAAE,sCAAsC;SACtD;QACD,QAAQ,EAAE;YACN,wBAAwB,EACpB,wHAAwH;YAC5H,4BAA4B,EACxB,0IAA0I;SACjJ;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-object-from-entries.d.ts","sourceRoot":"","sources":["../../../src/rules/no-object-from-entries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,IAAI,sFAgCf,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
return {
|
|
6
|
+
CallExpression(node) {
|
|
7
|
+
if (node.callee.type === 'MemberExpression' &&
|
|
8
|
+
node.callee.object.type === 'Identifier' &&
|
|
9
|
+
node.callee.object.name === 'Object' &&
|
|
10
|
+
node.callee.property.type === 'Identifier' &&
|
|
11
|
+
node.callee.property.name === 'fromEntries') {
|
|
12
|
+
context.report({
|
|
13
|
+
node,
|
|
14
|
+
messageId: 'noObjectFromEntries',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
name: 'no-object-from-entries',
|
|
21
|
+
meta: {
|
|
22
|
+
type: 'problem',
|
|
23
|
+
fixable: 'code',
|
|
24
|
+
docs: {
|
|
25
|
+
description: 'Prevent use of Object.fromEntries',
|
|
26
|
+
},
|
|
27
|
+
messages: {
|
|
28
|
+
noObjectFromEntries: 'Do not use Object.fromEntries, it is not supported on all devices.',
|
|
29
|
+
},
|
|
30
|
+
schema: [],
|
|
31
|
+
},
|
|
32
|
+
defaultOptions: [],
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=no-object-from-entries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-object-from-entries.js","sourceRoot":"","sources":["../../../src/rules/no-object-from-entries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,OAAO;YACH,cAAc,CAAC,IAAI,EAAE;gBACjB,IACI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;oBACvC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;oBACxC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ;oBACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;oBAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,aAAa,EAC7C,CAAC;oBACC,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI;wBACJ,SAAS,EAAE,qBAAqB;qBACnC,CAAC,CAAC;gBACP,CAAC;YAAA,CACJ;SACJ,CAAC;IAAA,CACL;IACD,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;QACf,IAAI,EAAE;YACF,WAAW,EAAE,mCAAmC;SACnD;QACD,QAAQ,EAAE;YACN,mBAAmB,EAAE,oEAAoE;SAC5F;QACD,MAAM,EAAE,EAAE;KACb;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-makeRequest-over-fetch.d.ts","sourceRoot":"","sources":["../../../src/rules/prefer-makeRequest-over-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,IAAI,oFA0Bf,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
return {
|
|
6
|
+
CallExpression(node) {
|
|
7
|
+
if (node.callee.type === 'Identifier' && node.callee.name === 'fetch') {
|
|
8
|
+
context.report({
|
|
9
|
+
node,
|
|
10
|
+
messageId: 'preferMakeRequest',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
name: 'prefer-makeRequest-over-fetch',
|
|
17
|
+
meta: {
|
|
18
|
+
type: 'problem',
|
|
19
|
+
fixable: 'code',
|
|
20
|
+
docs: {
|
|
21
|
+
description: 'Suggest using makeRequest instead of fetch',
|
|
22
|
+
},
|
|
23
|
+
messages: {
|
|
24
|
+
preferMakeRequest: 'Use makeRequest instead of fetch.',
|
|
25
|
+
},
|
|
26
|
+
schema: [],
|
|
27
|
+
},
|
|
28
|
+
defaultOptions: [],
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=prefer-makeRequest-over-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-makeRequest-over-fetch.js","sourceRoot":"","sources":["../../../src/rules/prefer-makeRequest-over-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,OAAO;YACH,cAAc,CAAC,IAAI,EAAE;gBACjB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBACpE,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI;wBACJ,SAAS,EAAE,mBAAmB;qBACjC,CAAC,CAAC;gBACP,CAAC;YAAA,CACJ;SACJ,CAAC;IAAA,CACL;IACD,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;QACf,IAAI,EAAE;YACF,WAAW,EAAE,4CAA4C;SAC5D;QACD,QAAQ,EAAE;YACN,iBAAiB,EAAE,mCAAmC;SACzD;QACD,MAAM,EAAE,EAAE;KACb;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-no-lodash-clone-deep.d.ts","sourceRoot":"","sources":["../../../src/rules/prefer-no-lodash-clone-deep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,IAAI,0FAwBf,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
return {
|
|
6
|
+
"Program:has(ImportDeclaration[source.value='lodash'] > ImportSpecifier[imported.name=cloneDeep]) CallExpression[callee.name=cloneDeep]": (node) => {
|
|
7
|
+
context.report({
|
|
8
|
+
node,
|
|
9
|
+
messageId: 'forbiddenCloneDeepUsage',
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
name: 'prefer-no-lodash-cloneDeep',
|
|
15
|
+
meta: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: 'Detect usage of Lodash cloneDeep',
|
|
18
|
+
},
|
|
19
|
+
messages: {
|
|
20
|
+
forbiddenCloneDeepUsage: `Prefer using rfdc over lodash.cloneDeep as it cost a lot in performance`,
|
|
21
|
+
},
|
|
22
|
+
schema: [],
|
|
23
|
+
type: 'problem',
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: [],
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=prefer-no-lodash-clone-deep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-no-lodash-clone-deep.js","sourceRoot":"","sources":["../../../src/rules/prefer-no-lodash-clone-deep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,OAAO;YACH,wIAAwI,EACpI,CAAC,IAAI,EAAE,EAAE,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,yBAAyB;iBACvC,CAAC,CAAC;YAAA,CACN;SACR,CAAC;IAAA,CACL;IACD,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EAAE,kCAAkC;SAClD;QACD,QAAQ,EAAE;YACN,uBAAuB,EAAE,yEAAyE;SACrG;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-private-exposables.d.ts","sourceRoot":"","sources":["../../../src/rules/prefer-private-exposables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAItE,eAAO,MAAM,IAAI,yFAyBf,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
const publicExposableNames = ['Ad', 'AdBreak', 'AdPosition', 'Track'];
|
|
6
|
+
const selector = publicExposableNames.map((name) => `ImportSpecifier[imported.name=${name}]`).join(', ');
|
|
7
|
+
return {
|
|
8
|
+
[`Program:has(${selector})`]: (node) => {
|
|
9
|
+
context.report({
|
|
10
|
+
node,
|
|
11
|
+
messageId: 'preferPrivateExposable',
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
name: 'prefer-private-exposables',
|
|
17
|
+
meta: {
|
|
18
|
+
docs: {
|
|
19
|
+
description: 'Prefer private versions of exposables within CVSDK core',
|
|
20
|
+
},
|
|
21
|
+
messages: {
|
|
22
|
+
preferPrivateExposable: 'Please use Internal variant of public data type (eg. AdBreakInternal instead of AdBreak) inside the core',
|
|
23
|
+
},
|
|
24
|
+
schema: [],
|
|
25
|
+
type: 'problem',
|
|
26
|
+
},
|
|
27
|
+
defaultOptions: [],
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=prefer-private-exposables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-private-exposables.js","sourceRoot":"","sources":["../../../src/rules/prefer-private-exposables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAEtE,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACtE,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzG,OAAO;YACH,CAAC,eAAe,QAAQ,GAAG,CAAC,EAAE,CAAC,IAAoC,EAAE,EAAE,CAAC;gBACpE,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,wBAAwB;iBACtC,CAAC,CAAC;YAAA,CACN;SACJ,CAAC;IAAA,CACL;IACD,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EAAE,yDAAyD;SACzE;QACD,QAAQ,EAAE;YACN,sBAAsB,EAAE,0GAA0G;SACrI;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-self-over-window.d.ts","sourceRoot":"","sources":["../../../src/rules/prefer-self-over-window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAItE,eAAO,MAAM,IAAI,wFAoCf,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
const parserServices = ESLintUtils.getParserServices(context);
|
|
6
|
+
function reportWindowError(node) {
|
|
7
|
+
if (node.parent.type !== 'VariableDeclarator') {
|
|
8
|
+
const nodeType = parserServices.getTypeAtLocation(node);
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(nodeType, 'aliasSymbol')) {
|
|
10
|
+
context.report({
|
|
11
|
+
messageId: 'forbiddenWindowAccess',
|
|
12
|
+
node,
|
|
13
|
+
fix: function (fixer) {
|
|
14
|
+
return fixer.replaceText(node, 'self');
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
"Identifier[name='window']": reportWindowError,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
name: 'uppercase-first-declarations',
|
|
25
|
+
meta: {
|
|
26
|
+
docs: {
|
|
27
|
+
description: 'Disallow window access.',
|
|
28
|
+
},
|
|
29
|
+
messages: {
|
|
30
|
+
forbiddenWindowAccess: '`window` cannot be accessed inside some containers, we prefer using `self` as it has more compatibility.',
|
|
31
|
+
},
|
|
32
|
+
schema: [], // no options
|
|
33
|
+
type: 'problem',
|
|
34
|
+
fixable: 'code',
|
|
35
|
+
},
|
|
36
|
+
defaultOptions: [],
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=prefer-self-over-window.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-self-over-window.js","sourceRoot":"","sources":["../../../src/rules/prefer-self-over-window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,0BAA0B,CAAC;AAEtE,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI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
1
|
+
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
+
const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
3
|
+
export const rule = createRule({
|
|
4
|
+
create(context) {
|
|
5
|
+
return {
|
|
6
|
+
Identifier(node) {
|
|
7
|
+
if (node.type === 'Identifier' && node.name === 'DOMParser' && node.parent.type === 'NewExpression') {
|
|
8
|
+
context.report({
|
|
9
|
+
node,
|
|
10
|
+
messageId: 'forbiddenDomParserUsage',
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
name: 'prefer-txml-over-domparser',
|
|
17
|
+
meta: {
|
|
18
|
+
docs: { description: 'Disallow DOMParser usage.' },
|
|
19
|
+
messages: {
|
|
20
|
+
forbiddenDomParserUsage: `Prefer using txml (https://www.npmjs.com/package/txml) over DOMParser as DOMParser isn't supported on ION.`,
|
|
21
|
+
},
|
|
22
|
+
schema: [],
|
|
23
|
+
type: 'problem',
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: [],
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=prefer-txml-over-domparser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-txml-over-domparser.js","sourceRoot":"","sources":["../../../src/rules/prefer-txml-over-domparser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,OAAO;YACH,UAAU,CAAC,IAAI,EAAE;gBACb,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;oBAClG,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI;wBACJ,SAAS,EAAE,yBAAyB;qBACvC,CAAC,CAAC;gBACP,CAAC;YAAA,CACJ;SACJ,CAAC;IAAA,CACL;IACD,IAAI,EAAE,4BAA4B;IAClC,IAAI,EAAE;QACF,IAAI,EAAE,EAAE,WAAW,EAAE,2BAA2B,EAAE;QAClD,QAAQ,EAAE;YACN,uBAAuB,EAAE,4GAA4G;SACxI;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAClB;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|