eslint-plugin-cvsdk-rules 18.0.0 → 19.0.0-alpha.5
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/index.d.ts +7 -7
- package/build/rules/no-device-type-imports.d.ts +1 -1
- package/build/rules/no-device-type-imports.d.ts.map +1 -1
- package/build/rules/no-device-type-imports.js +2 -2
- package/build/rules/no-device-type-imports.js.map +1 -1
- package/build/rules/no-object-from-entries.d.ts +1 -1
- package/build/rules/no-object-from-entries.d.ts.map +1 -1
- package/build/rules/no-object-from-entries.js.map +1 -1
- package/build/rules/prefer-makeRequest-over-fetch.d.ts +1 -1
- package/build/rules/prefer-makeRequest-over-fetch.d.ts.map +1 -1
- package/build/rules/prefer-makeRequest-over-fetch.js.map +1 -1
- package/build/rules/prefer-no-lodash-clone-deep.d.ts +1 -1
- package/build/rules/prefer-no-lodash-clone-deep.d.ts.map +1 -1
- package/build/rules/prefer-private-exposables.d.ts +1 -1
- package/build/rules/prefer-private-exposables.d.ts.map +1 -1
- package/build/rules/prefer-self-over-window.d.ts +1 -1
- package/build/rules/prefer-self-over-window.d.ts.map +1 -1
- package/build/rules/prefer-self-over-window.js +1 -1
- package/build/rules/prefer-self-over-window.js.map +1 -1
- package/build/rules/prefer-txml-over-domparser.d.ts +1 -1
- package/build/rules/prefer-txml-over-domparser.d.ts.map +1 -1
- package/build/rules/prefer-txml-over-domparser.js.map +1 -1
- package/package.json +2 -2
- package/src/rules/no-device-type-imports.spec.ts +60 -0
- package/src/rules/no-device-type-imports.ts +2 -2
package/build/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
declare const plugin: {
|
|
2
2
|
rules: {
|
|
3
|
-
'prefer-no-lodash-cloneDeep': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenCloneDeepUsage",
|
|
4
|
-
'prefer-self-over-window': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenWindowAccess",
|
|
5
|
-
'prefer-txml-over-domparser': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenDomParserUsage",
|
|
6
|
-
'no-device-type-imports': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenDeviceTypeUsage" | "forbiddenDeviceTypeUtilUsage",
|
|
7
|
-
'prefer-private-exposables': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"preferPrivateExposable",
|
|
8
|
-
'prefer-makeRequest-over-fetch': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"preferMakeRequest",
|
|
9
|
-
'no-object-from-entries': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"noObjectFromEntries",
|
|
3
|
+
'prefer-no-lodash-cloneDeep': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenCloneDeepUsage", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
4
|
+
'prefer-self-over-window': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenWindowAccess", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
5
|
+
'prefer-txml-over-domparser': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenDomParserUsage", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
6
|
+
'no-device-type-imports': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"forbiddenDeviceTypeUsage" | "forbiddenDeviceTypeUtilUsage", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
7
|
+
'prefer-private-exposables': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"preferPrivateExposable", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
8
|
+
'prefer-makeRequest-over-fetch': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"preferMakeRequest", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
9
|
+
'no-object-from-entries': import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleModule<"noObjectFromEntries", [], unknown, import("@typescript-eslint/utils/dist/ts-eslint/Rule.js").RuleListener>;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
export { plugin };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"forbiddenDeviceTypeUsage" | "forbiddenDeviceTypeUtilUsage",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"forbiddenDeviceTypeUsage" | "forbiddenDeviceTypeUtilUsage", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=no-device-type-imports.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -3,7 +3,7 @@ const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
|
3
3
|
export const rule = createRule({
|
|
4
4
|
create(context) {
|
|
5
5
|
return {
|
|
6
|
-
"
|
|
6
|
+
"ImportDeclaration[source.value='@sky-uk-ott/client-lib-js-device'] > ImportSpecifier[imported.name=DeviceType]": (node) => {
|
|
7
7
|
context.report({
|
|
8
8
|
node,
|
|
9
9
|
messageId: 'forbiddenDeviceTypeUsage',
|
|
@@ -11,7 +11,7 @@ export const rule = createRule({
|
|
|
11
11
|
},
|
|
12
12
|
// Note the unicode character here is required to match a forward slash in the import path
|
|
13
13
|
// See https://eslint.org/docs/latest/extend/selectors#known-issues
|
|
14
|
-
'
|
|
14
|
+
'ImportDeclaration[source.value=/.*\\u002Fdevice-type/]': (node) => {
|
|
15
15
|
context.report({
|
|
16
16
|
node,
|
|
17
17
|
messageId: 'forbiddenDeviceTypeUtilUsage',
|
|
@@ -1 +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;QACV,OAAO;YACH,
|
|
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;QACV,OAAO;YACH,gHAAgH,EAAE,CAC9G,IAAoC,EACtC,EAAE;gBACA,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,0BAA0B;iBACxC,CAAC,CAAC;YACP,CAAC;YACD,0FAA0F;YAC1F,mEAAmE;YACnE,wDAAwD,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC/D,OAAO,CAAC,MAAM,CAAC;oBACX,IAAI;oBACJ,SAAS,EAAE,8BAA8B;iBAC5C,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"noObjectFromEntries",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"noObjectFromEntries", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=no-object-from-entries.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +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,EAA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SACJ,CAAC;IACN,CAAC;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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"preferMakeRequest",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"preferMakeRequest", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=prefer-makeRequest-over-fetch.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +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;QACV,OAAO;YACH,cAAc,CAAC,IAAI;gBACf,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE;
|
|
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;QACV,OAAO;YACH,cAAc,CAAC,IAAI;gBACf,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;YACL,CAAC;SACJ,CAAC;IACN,CAAC;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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"forbiddenCloneDeepUsage",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"forbiddenCloneDeepUsage", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=prefer-no-lodash-clone-deep.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"preferPrivateExposable",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"preferPrivateExposable", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=prefer-private-exposables.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"forbiddenWindowAccess",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"forbiddenWindowAccess", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=prefer-self-over-window.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -29,7 +29,7 @@ export const rule = createRule({
|
|
|
29
29
|
messages: {
|
|
30
30
|
forbiddenWindowAccess: '`window` cannot be accessed inside some containers, we prefer using `self` as it has more compatibility.',
|
|
31
31
|
},
|
|
32
|
-
schema: [],
|
|
32
|
+
schema: [], // no options
|
|
33
33
|
type: 'problem',
|
|
34
34
|
fixable: 'code',
|
|
35
35
|
},
|
|
@@ -1 +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;QACV,MAAM,cAAc,GAAG,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAE9D,SAAS,iBAAiB,CAAC,IAAm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OAAO,EAAE,MAAM;KAClB;IACD,cAAc,EAAE,EAAE;CACrB,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const rule: ESLintUtils.RuleModule<"forbiddenDomParserUsage",
|
|
2
|
+
export declare const rule: ESLintUtils.RuleModule<"forbiddenDomParserUsage", [], unknown, ESLintUtils.RuleListener>;
|
|
3
3
|
//# sourceMappingURL=prefer-txml-over-domparser.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -1 +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;QACV,OAAO;YACH,UAAU,CAAC,IAAI;gBACX,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,eAAe,EAAE;
|
|
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;QACV,OAAO;YACH,UAAU,CAAC,IAAI;gBACX,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;YACL,CAAC;SACJ,CAAC;IACN,CAAC;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-cvsdk-rules",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0-alpha.5",
|
|
4
4
|
"main": "./build/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"console-fail-test": "^0.5.0",
|
|
17
17
|
"eslint": "^9.25.0",
|
|
18
18
|
"eslint-plugin-eslint-plugin": "6.2.0",
|
|
19
|
-
"typescript": "5.
|
|
19
|
+
"typescript": "5.9.3"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "jest",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { RuleTester } from '@typescript-eslint/rule-tester';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { rule } from '../../build/rules/no-device-type-imports.js';
|
|
5
|
+
|
|
6
|
+
// https://typescript-eslint.io/packages/rule-tester/#type-aware-testing
|
|
7
|
+
const ruleTester = new RuleTester({
|
|
8
|
+
languageOptions: {
|
|
9
|
+
parser: tseslint.parser,
|
|
10
|
+
parserOptions: {
|
|
11
|
+
projectService: {
|
|
12
|
+
allowDefaultProject: ['*.ts*'],
|
|
13
|
+
defaultProject: 'tsconfig.json',
|
|
14
|
+
},
|
|
15
|
+
tsconfigRootDir: path.join(__dirname, '../..'),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe('no-device-type-imports', () => {
|
|
21
|
+
describe('forbiddenDeviceTypeUsage', () => {
|
|
22
|
+
ruleTester.run('no-device-type-imports', rule, {
|
|
23
|
+
invalid: [
|
|
24
|
+
{
|
|
25
|
+
code: "import { DeviceType } from '@sky-uk-ott/client-lib-js-device';",
|
|
26
|
+
errors: [{ messageId: 'forbiddenDeviceTypeUsage' }],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
code: "import { DeviceType, SomeOtherType } from '@sky-uk-ott/client-lib-js-device';",
|
|
30
|
+
errors: [{ messageId: 'forbiddenDeviceTypeUsage' }],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
valid: [
|
|
34
|
+
"import { SomeOtherType } from '@sky-uk-ott/client-lib-js-device';",
|
|
35
|
+
"import { DeviceType } from 'some-other-package';",
|
|
36
|
+
'const x = 1;',
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('forbiddenDeviceTypeUtilUsage', () => {
|
|
42
|
+
ruleTester.run('no-device-type-imports', rule, {
|
|
43
|
+
invalid: [
|
|
44
|
+
{
|
|
45
|
+
code: "import { something } from '../utils/device-type';",
|
|
46
|
+
errors: [{ messageId: 'forbiddenDeviceTypeUtilUsage' }],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
code: "import { something } from './device-type';",
|
|
50
|
+
errors: [{ messageId: 'forbiddenDeviceTypeUtilUsage' }],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
code: "import { something } from '../../device-type/index';",
|
|
54
|
+
errors: [{ messageId: 'forbiddenDeviceTypeUtilUsage' }],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
valid: ["import { something } from '../utils/device-info';", "import { something } from 'some-package';", 'const x = 1;'],
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -5,7 +5,7 @@ const createRule = ESLintUtils.RuleCreator((name) => name);
|
|
|
5
5
|
export const rule = createRule({
|
|
6
6
|
create(context) {
|
|
7
7
|
return {
|
|
8
|
-
"
|
|
8
|
+
"ImportDeclaration[source.value='@sky-uk-ott/client-lib-js-device'] > ImportSpecifier[imported.name=DeviceType]": (
|
|
9
9
|
node: TSESTree.Node | TSESTree.Token
|
|
10
10
|
) => {
|
|
11
11
|
context.report({
|
|
@@ -15,7 +15,7 @@ export const rule = createRule({
|
|
|
15
15
|
},
|
|
16
16
|
// Note the unicode character here is required to match a forward slash in the import path
|
|
17
17
|
// See https://eslint.org/docs/latest/extend/selectors#known-issues
|
|
18
|
-
'
|
|
18
|
+
'ImportDeclaration[source.value=/.*\\u002Fdevice-type/]': (node) => {
|
|
19
19
|
context.report({
|
|
20
20
|
node,
|
|
21
21
|
messageId: 'forbiddenDeviceTypeUtilUsage',
|