eslint-plugin-cvsdk-rules 18.0.1-preview.2 → 18.0.1
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/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,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,GAAG,UAAU,CAAC;IAC3B,MAAM,CAAC,OAAO,EAAE;QACZ,MAAM,cAAc,GAAG,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAE9D,SAAS,iBAAiB,CAAC,IAAmB,EAAE;YAC5C,IAAI,IAAI,CAAC,MAAO,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;gBAC7C,MAAM,QAAQ,GAAG,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACxD,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC;oBAChE,OAAO,CAAC,MAAM,CAAC;wBACX,SAAS,EAAE,uBAAuB;wBAClC,IAAI;wBACJ,GAAG,EAAE,UAAU,KAAK,EAAE;4BAClB,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;wBAAA,CAC1C;qBACJ,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;QAAA,CACJ;QAED,OAAO;YACH,2BAA2B,EAAE,iBAAiB;SACjD,CAAC;IAAA,CACL;IACD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE;QACF,IAAI,EAAE;YACF,WAAW,EAAE,yBAAyB;SACzC;QACD,QAAQ,EAAE;YACN,qBAAqB,EAAE,0GAA0G;SACpI;QACD,MAAM,EAAE,EAAE,EAAE,aAAa;QACzB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,MAAM;KAClB;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefer-txml-over-domparser.d.ts","sourceRoot":"","sources":["../../../src/rules/prefer-txml-over-domparser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,IAAI,0FAuBf,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
|
+
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"}
|