@servicetitan/eslint-plugin 30.3.1 → 31.1.0

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/dist/index.js CHANGED
@@ -1,25 +1,41 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rules = void 0;
4
- const no_async_in_foreach_1 = require("./rules/no-async-in-foreach");
5
- const decorators_declare_1 = require("./rules/decorators-declare");
6
- const use_makeObservable_with_decorators_1 = require("./rules/mobx/use-makeObservable-with-decorators");
7
- const no_abstract_decorators_1 = require("./rules/mobx/no-abstract-decorators");
8
- const destructure_default_import_1 = require("./rules/react/destructure-default-import");
9
- const no_qualified_type_1 = require("./rules/react/no-qualified-type");
10
- exports.rules = {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get // eslint-disable-next-line import/no-default-export
13
+ default () {
14
+ return _default;
15
+ },
16
+ get rules () {
17
+ return rules;
18
+ }
19
+ });
20
+ const _noasyncinforeach = require("./rules/no-async-in-foreach");
21
+ const _decoratorsdeclare = require("./rules/decorators-declare");
22
+ const _usemakeObservablewithdecorators = require("./rules/mobx/use-makeObservable-with-decorators");
23
+ const _noabstractdecorators = require("./rules/mobx/no-abstract-decorators");
24
+ const _destructuredefaultimport = require("./rules/react/destructure-default-import");
25
+ const _noqualifiedtype = require("./rules/react/no-qualified-type");
26
+ const rules = {
11
27
  base: {
12
- 'no-async-in-foreach': no_async_in_foreach_1.noAsyncInForEach,
13
- 'use-declare-with-decorators': decorators_declare_1.useDeclareWithDecorators,
28
+ 'no-async-in-foreach': _noasyncinforeach.noAsyncInForEach,
29
+ 'use-declare-with-decorators': _decoratorsdeclare.useDeclareWithDecorators
14
30
  },
15
31
  mobx: {
16
- 'use-makeObservable-with-decorators': use_makeObservable_with_decorators_1.mobxUseMakeObservableWithDecorators,
17
- 'no-abstract-decorators': no_abstract_decorators_1.mobxNoAbstractDecorators,
32
+ 'use-makeObservable-with-decorators': _usemakeObservablewithdecorators.mobxUseMakeObservableWithDecorators,
33
+ 'no-abstract-decorators': _noabstractdecorators.mobxNoAbstractDecorators
18
34
  },
19
35
  react: {
20
- 'destructure-default-import': destructure_default_import_1.reactDestructureDefaultImport,
21
- 'no-qualified-type': no_qualified_type_1.reactNoQualifiedType,
22
- },
36
+ 'destructure-default-import': _destructuredefaultimport.reactDestructureDefaultImport,
37
+ 'no-qualified-type': _noqualifiedtype.reactNoQualifiedType
38
+ }
23
39
  };
24
40
  const plugin = {
25
41
  configs: {
@@ -27,23 +43,32 @@ const plugin = {
27
43
  {
28
44
  name: '@servicetitan/eslint-plugin',
29
45
  plugins: {
30
- '@servicetitan': { rules: exports.rules.base },
31
- '@servicetitan/mobx': { rules: exports.rules.mobx },
32
- '@servicetitan/react': { rules: exports.rules.react },
46
+ '@servicetitan': {
47
+ rules: rules.base
48
+ },
49
+ '@servicetitan/mobx': {
50
+ rules: rules.mobx
51
+ },
52
+ '@servicetitan/react': {
53
+ rules: rules.react
54
+ }
33
55
  },
34
- files: ['**/*.ts', '**/*.tsx'],
56
+ files: [
57
+ '**/*.ts',
58
+ '**/*.tsx'
59
+ ],
35
60
  rules: {
36
61
  '@servicetitan/mobx/no-abstract-decorators': 'error',
37
62
  '@servicetitan/mobx/use-makeObservable-with-decorators': 'error',
38
63
  '@servicetitan/react/destructure-default-import': 'error',
39
64
  '@servicetitan/react/no-qualified-type': 'error',
40
65
  '@servicetitan/no-async-in-foreach': 'error',
41
- '@servicetitan/use-declare-with-decorators': 'error',
42
- },
43
- },
44
- ],
45
- },
66
+ '@servicetitan/use-declare-with-decorators': 'error'
67
+ }
68
+ }
69
+ ]
70
+ }
46
71
  };
47
- // eslint-disable-next-line import/no-default-export
48
- exports.default = plugin;
72
+ const _default = plugin;
73
+
49
74
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAGA,qEAA+D;AAC/D,mEAAsE;AACtE,wGAAsG;AACtG,gFAA+E;AAC/E,yFAAyF;AACzF,uEAAuE;AAE1D,QAAA,KAAK,GAGd;IACA,IAAI,EAAE;QACF,qBAAqB,EAAE,sCAAgB;QACvC,6BAA6B,EAAE,6CAAwB;KAC1D;IACD,IAAI,EAAE;QACF,oCAAoC,EAAE,wEAAmC;QACzE,wBAAwB,EAAE,iDAAwB;KACrD;IACD,KAAK,EAAE;QACH,4BAA4B,EAAE,0DAA6B;QAC3D,mBAAmB,EAAE,wCAAoB;KAC5C;CACJ,CAAC;AAEF,MAAM,MAAM,GAAG;IACX,OAAO,EAAE;QACL,WAAW,EAAE;YACT;gBACI,IAAI,EAAE,6BAA6B;gBACnC,OAAO,EAAE;oBACL,eAAe,EAAE,EAAE,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;oBACtC,oBAAoB,EAAE,EAAE,KAAK,EAAE,aAAK,CAAC,IAAI,EAAE;oBAC3C,qBAAqB,EAAE,EAAE,KAAK,EAAE,aAAK,CAAC,KAAK,EAAE;iBAChD;gBACD,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;gBAC9B,KAAK,EAAE;oBACH,2CAA2C,EAAE,OAAO;oBACpD,uDAAuD,EAAE,OAAO;oBAChE,gDAAgD,EAAE,OAAO;oBACzD,uCAAuC,EAAE,OAAO;oBAChD,mCAAmC,EAAE,OAAO;oBAC5C,2CAA2C,EAAE,OAAO;iBACvD;aACa;SACrB;KACJ;CACJ,CAAC;AAEF,oDAAoD;AACpD,kBAAe,MAAM,CAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint';\nimport { Linter, Rule } from 'eslint';\n\nimport { noAsyncInForEach } from './rules/no-async-in-foreach';\nimport { useDeclareWithDecorators } from './rules/decorators-declare';\nimport { mobxUseMakeObservableWithDecorators } from './rules/mobx/use-makeObservable-with-decorators';\nimport { mobxNoAbstractDecorators } from './rules/mobx/no-abstract-decorators';\nimport { reactDestructureDefaultImport } from './rules/react/destructure-default-import';\nimport { reactNoQualifiedType } from './rules/react/no-qualified-type';\n\nexport const rules: Record<\n 'base' | 'mobx' | 'react',\n Record<string, Rule.RuleModule | AnyRuleModule>\n> = {\n base: {\n 'no-async-in-foreach': noAsyncInForEach,\n 'use-declare-with-decorators': useDeclareWithDecorators,\n },\n mobx: {\n 'use-makeObservable-with-decorators': mobxUseMakeObservableWithDecorators,\n 'no-abstract-decorators': mobxNoAbstractDecorators,\n },\n react: {\n 'destructure-default-import': reactDestructureDefaultImport,\n 'no-qualified-type': reactNoQualifiedType,\n },\n};\n\nconst plugin = {\n configs: {\n recommended: [\n {\n name: '@servicetitan/eslint-plugin',\n plugins: {\n '@servicetitan': { rules: rules.base },\n '@servicetitan/mobx': { rules: rules.mobx },\n '@servicetitan/react': { rules: rules.react },\n },\n files: ['**/*.ts', '**/*.tsx'],\n rules: {\n '@servicetitan/mobx/no-abstract-decorators': 'error',\n '@servicetitan/mobx/use-makeObservable-with-decorators': 'error',\n '@servicetitan/react/destructure-default-import': 'error',\n '@servicetitan/react/no-qualified-type': 'error',\n '@servicetitan/no-async-in-foreach': 'error',\n '@servicetitan/use-declare-with-decorators': 'error',\n },\n } as Linter.Config,\n ],\n },\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default plugin;\n"],"names":["rules","base","noAsyncInForEach","useDeclareWithDecorators","mobx","mobxUseMakeObservableWithDecorators","mobxNoAbstractDecorators","react","reactDestructureDefaultImport","reactNoQualifiedType","plugin","configs","recommended","name","plugins","files"],"mappings":";;;;;;;;;;;QAoDA,oDAAoD;IACpD;eAAA;;QA3CaA;eAAAA;;;kCAPoB;mCACQ;iDACW;sCACX;0CACK;iCACT;AAE9B,MAAMA,QAGT;IACAC,MAAM;QACF,uBAAuBC,kCAAgB;QACvC,+BAA+BC,2CAAwB;IAC3D;IACAC,MAAM;QACF,sCAAsCC,oEAAmC;QACzE,0BAA0BC,8CAAwB;IACtD;IACAC,OAAO;QACH,8BAA8BC,uDAA6B;QAC3D,qBAAqBC,qCAAoB;IAC7C;AACJ;AAEA,MAAMC,SAAS;IACXC,SAAS;QACLC,aAAa;YACT;gBACIC,MAAM;gBACNC,SAAS;oBACL,iBAAiB;wBAAEd,OAAOA,MAAMC,IAAI;oBAAC;oBACrC,sBAAsB;wBAAED,OAAOA,MAAMI,IAAI;oBAAC;oBAC1C,uBAAuB;wBAAEJ,OAAOA,MAAMO,KAAK;oBAAC;gBAChD;gBACAQ,OAAO;oBAAC;oBAAW;iBAAW;gBAC9Bf,OAAO;oBACH,6CAA6C;oBAC7C,yDAAyD;oBACzD,kDAAkD;oBAClD,yCAAyC;oBACzC,qCAAqC;oBACrC,6CAA6C;gBACjD;YACJ;SACH;IACL;AACJ;MAGA,WAAeU"}
@@ -1,8 +1,18 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stub = void 0;
4
- exports.stub = {
5
- preprocess: () => [''],
6
- postprocess: ([messages]) => messages,
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "stub", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return stub;
9
+ }
10
+ });
11
+ const stub = {
12
+ preprocess: ()=>[
13
+ ''
14
+ ],
15
+ postprocess: ([messages])=>messages
7
16
  };
17
+
8
18
  //# sourceMappingURL=stub.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stub.js","sourceRoot":"","sources":["../../src/processors/stub.ts"],"names":[],"mappings":";;;AAEa,QAAA,IAAI,GAAuB;IACpC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACtB,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ;CACxC,CAAC"}
1
+ {"version":3,"sources":["../../src/processors/stub.ts"],"sourcesContent":["import type { Linter } from 'eslint';\n\nexport const stub: Linter.LintOptions = {\n preprocess: () => [''],\n postprocess: ([messages]) => messages,\n};\n"],"names":["stub","preprocess","postprocess","messages"],"mappings":";;;;+BAEaA;;;eAAAA;;;AAAN,MAAMA,OAA2B;IACpCC,YAAY,IAAM;YAAC;SAAG;IACtBC,aAAa,CAAC,CAACC,SAAS,GAAKA;AACjC"}
@@ -0,0 +1,6 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true
4
+ },
5
+ "include": ["file.ts", "react.tsx"]
6
+ }
@@ -1,44 +1,55 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDeclareWithDecorators = void 0;
4
- const customDecorators = ['injectDependency', 'koObservableToMobx'];
5
- exports.useDeclareWithDecorators = {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useDeclareWithDecorators", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useDeclareWithDecorators;
9
+ }
10
+ });
11
+ const customDecorators = [
12
+ 'injectDependency',
13
+ 'koObservableToMobx'
14
+ ];
15
+ const useDeclareWithDecorators = {
6
16
  meta: {
7
17
  type: 'problem',
8
18
  docs: {
9
19
  description: 'Disallow custom @servicetitan class field decorators without declare',
10
20
  category: 'Possible Errors',
11
21
  recommended: false,
12
- url: 'https://github.com/servicetitan/uikit.git',
22
+ url: 'https://github.com/servicetitan/uikit.git'
13
23
  },
14
24
  messages: {
15
- decoratorsDeclare: "Use declare when decorating with '@{{name}}'",
16
- },
25
+ decoratorsDeclare: "Use declare when decorating with '@{{name}}'"
26
+ }
17
27
  },
18
- create(context) {
28
+ create (context) {
19
29
  return {
20
- ClassProperty(node) {
21
- var _a;
30
+ ClassProperty (node) {
31
+ var _node_decorators;
22
32
  if (node.declare) {
23
33
  return; // field is already defined with declare
24
34
  }
25
- if ((_a = node === null || node === void 0 ? void 0 : node.decorators) === null || _a === void 0 ? void 0 : _a.length) {
26
- node.decorators.forEach((decorator) => {
27
- var _a, _b;
28
- const name = (_b = (_a = decorator.expression) === null || _a === void 0 ? void 0 : _a.callee) === null || _b === void 0 ? void 0 : _b.name;
35
+ if (node === null || node === void 0 ? void 0 : (_node_decorators = node.decorators) === null || _node_decorators === void 0 ? void 0 : _node_decorators.length) {
36
+ node.decorators.forEach((decorator)=>{
37
+ var _decorator_expression_callee, _decorator_expression;
38
+ const name = (_decorator_expression = decorator.expression) === null || _decorator_expression === void 0 ? void 0 : (_decorator_expression_callee = _decorator_expression.callee) === null || _decorator_expression_callee === void 0 ? void 0 : _decorator_expression_callee.name;
29
39
  if (name && customDecorators.includes(name)) {
30
40
  context.report({
31
41
  node,
32
42
  messageId: 'decoratorsDeclare',
33
43
  data: {
34
- name,
35
- },
44
+ name
45
+ }
36
46
  });
37
47
  }
38
48
  });
39
49
  }
40
- },
50
+ }
41
51
  };
42
- },
52
+ }
43
53
  };
54
+
44
55
  //# sourceMappingURL=decorators-declare.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators-declare.js","sourceRoot":"","sources":["../../src/rules/decorators-declare.ts"],"names":[],"mappings":";;;AAEA,MAAM,gBAAgB,GAAG,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;AAEvD,QAAA,wBAAwB,GAAoB;IACrD,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,sEAAsE;YACnF,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,2CAA2C;SACnD;QACD,QAAQ,EAAE;YACN,iBAAiB,EAAE,8CAA8C;SACpE;KACJ;IACD,MAAM,CAAC,OAAO;QACV,OAAO;YACH,aAAa,CAAC,IAAS;;gBACnB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,OAAO,CAAC,wCAAwC;gBACpD,CAAC;gBAED,IAAI,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,0CAAE,MAAM,EAAE,CAAC;oBAC3B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAc,EAAE,EAAE;;wBACvC,MAAM,IAAI,GAAG,MAAA,MAAA,SAAS,CAAC,UAAU,0CAAE,MAAM,0CAAE,IAAI,CAAC;wBAEhD,IAAI,IAAI,IAAI,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;4BAC1C,OAAO,CAAC,MAAM,CAAC;gCACX,IAAI;gCACJ,SAAS,EAAE,mBAAmB;gCAC9B,IAAI,EAAE;oCACF,IAAI;iCACP;6BACJ,CAAC,CAAC;wBACP,CAAC;oBACL,CAAC,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/rules/decorators-declare.ts"],"sourcesContent":["import { Rule } from 'eslint';\n\nconst customDecorators = ['injectDependency', 'koObservableToMobx'];\n\nexport const useDeclareWithDecorators: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Disallow custom @servicetitan class field decorators without declare',\n category: 'Possible Errors',\n recommended: false,\n url: 'https://github.com/servicetitan/uikit.git',\n },\n messages: {\n decoratorsDeclare: \"Use declare when decorating with '@{{name}}'\",\n },\n },\n create(context) {\n return {\n ClassProperty(node: any) {\n if (node.declare) {\n return; // field is already defined with declare\n }\n\n if (node?.decorators?.length) {\n node.decorators.forEach((decorator: any) => {\n const name = decorator.expression?.callee?.name;\n\n if (name && customDecorators.includes(name)) {\n context.report({\n node,\n messageId: 'decoratorsDeclare',\n data: {\n name,\n },\n });\n }\n });\n }\n },\n };\n },\n};\n"],"names":["useDeclareWithDecorators","customDecorators","meta","type","docs","description","category","recommended","url","messages","decoratorsDeclare","create","context","ClassProperty","node","declare","decorators","length","forEach","decorator","name","expression","callee","includes","report","messageId","data"],"mappings":";;;;+BAIaA;;;eAAAA;;;AAFb,MAAMC,mBAAmB;IAAC;IAAoB;CAAqB;AAE5D,MAAMD,2BAA4C;IACrDE,MAAM;QACFC,MAAM;QACNC,MAAM;YACFC,aAAa;YACbC,UAAU;YACVC,aAAa;YACbC,KAAK;QACT;QACAC,UAAU;YACNC,mBAAmB;QACvB;IACJ;IACAC,QAAOC,OAAO;QACV,OAAO;YACHC,eAAcC,IAAS;oBAKfA;gBAJJ,IAAIA,KAAKC,OAAO,EAAE;oBACd,QAAQ,wCAAwC;gBACpD;gBAEA,IAAID,iBAAAA,4BAAAA,mBAAAA,KAAME,UAAU,cAAhBF,uCAAAA,iBAAkBG,MAAM,EAAE;oBAC1BH,KAAKE,UAAU,CAACE,OAAO,CAAC,CAACC;4BACRA,8BAAAA;wBAAb,MAAMC,QAAOD,wBAAAA,UAAUE,UAAU,cAApBF,6CAAAA,+BAAAA,sBAAsBG,MAAM,cAA5BH,mDAAAA,6BAA8BC,IAAI;wBAE/C,IAAIA,QAAQnB,iBAAiBsB,QAAQ,CAACH,OAAO;4BACzCR,QAAQY,MAAM,CAAC;gCACXV;gCACAW,WAAW;gCACXC,MAAM;oCACFN;gCACJ;4BACJ;wBACJ;oBACJ;gBACJ;YACJ;QACJ;IACJ;AACJ"}
@@ -1,35 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mobxNoAbstractDecorators = void 0;
4
- const mobxDecorators = ['observable', 'action', 'computed', 'override'];
5
- exports.mobxNoAbstractDecorators = {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "mobxNoAbstractDecorators", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return mobxNoAbstractDecorators;
9
+ }
10
+ });
11
+ const mobxDecorators = [
12
+ 'observable',
13
+ 'action',
14
+ 'computed',
15
+ 'override'
16
+ ];
17
+ const mobxNoAbstractDecorators = {
6
18
  meta: {
7
19
  type: 'problem',
8
20
  docs: {
9
21
  description: 'Disallow MobX decorators on abstract class fields',
10
22
  category: 'Possible Errors',
11
23
  recommended: false,
12
- url: 'https://github.com/servicetitan/uikit.git',
24
+ url: 'https://github.com/servicetitan/uikit.git'
13
25
  },
14
26
  messages: {
15
- noAbstractMobxDecorators: "Don't decorate abstract class fields or methods with '@{{name}}'",
16
- },
27
+ noAbstractMobxDecorators: "Don't decorate abstract class fields or methods with '@{{name}}'"
28
+ }
17
29
  },
18
- create(context) {
30
+ create (context) {
19
31
  function checkFn(node) {
20
- var _a;
21
- if ((_a = node === null || node === void 0 ? void 0 : node.decorators) === null || _a === void 0 ? void 0 : _a.length) {
22
- node.decorators.forEach((decorator) => {
23
- var _a, _b, _c;
32
+ var _node_decorators;
33
+ if (node === null || node === void 0 ? void 0 : (_node_decorators = node.decorators) === null || _node_decorators === void 0 ? void 0 : _node_decorators.length) {
34
+ node.decorators.forEach((decorator)=>{
35
+ var _decorator_expression, _decorator_expression_object, _decorator_expression1;
24
36
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
25
- const name = ((_a = decorator === null || decorator === void 0 ? void 0 : decorator.expression) === null || _a === void 0 ? void 0 : _a.name) || ((_c = (_b = decorator === null || decorator === void 0 ? void 0 : decorator.expression) === null || _b === void 0 ? void 0 : _b.object) === null || _c === void 0 ? void 0 : _c.name);
37
+ const name = (decorator === null || decorator === void 0 ? void 0 : (_decorator_expression = decorator.expression) === null || _decorator_expression === void 0 ? void 0 : _decorator_expression.name) || (decorator === null || decorator === void 0 ? void 0 : (_decorator_expression1 = decorator.expression) === null || _decorator_expression1 === void 0 ? void 0 : (_decorator_expression_object = _decorator_expression1.object) === null || _decorator_expression_object === void 0 ? void 0 : _decorator_expression_object.name);
26
38
  if (name && mobxDecorators.includes(name)) {
27
39
  context.report({
28
40
  node,
29
41
  messageId: 'noAbstractMobxDecorators',
30
42
  data: {
31
- name,
32
- },
43
+ name
44
+ }
33
45
  });
34
46
  }
35
47
  });
@@ -37,8 +49,9 @@ exports.mobxNoAbstractDecorators = {
37
49
  }
38
50
  return {
39
51
  TSAbstractClassProperty: checkFn,
40
- TSAbstractMethodDefinition: checkFn,
52
+ TSAbstractMethodDefinition: checkFn
41
53
  };
42
- },
54
+ }
43
55
  };
56
+
44
57
  //# sourceMappingURL=no-abstract-decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-abstract-decorators.js","sourceRoot":"","sources":["../../../src/rules/mobx/no-abstract-decorators.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE3D,QAAA,wBAAwB,GAAoB;IACrD,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,mDAAmD;YAChE,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,2CAA2C;SACnD;QACD,QAAQ,EAAE;YACN,wBAAwB,EACpB,kEAAkE;SACzE;KACJ;IACD,MAAM,CAAC,OAAY;QACf,SAAS,OAAO,CAAC,IAAS;;YACtB,IAAI,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,0CAAE,MAAM,EAAE,CAAC;gBAC3B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAc,EAAE,EAAE;;oBACvC,wEAAwE;oBACxE,MAAM,IAAI,GAAG,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,IAAI,MAAI,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,MAAM,0CAAE,IAAI,CAAA,CAAC;oBAEhF,IAAI,IAAI,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;wBACxC,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,0BAA0B;4BACrC,IAAI,EAAE;gCACF,IAAI;6BACP;yBACJ,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;QACL,CAAC;QAED,OAAO;YACH,uBAAuB,EAAE,OAAO;YAChC,0BAA0B,EAAE,OAAO;SACtC,CAAC;IACN,CAAC;CACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/rules/mobx/no-abstract-decorators.ts"],"sourcesContent":["import { Rule } from 'eslint';\n\nconst mobxDecorators = ['observable', 'action', 'computed', 'override'];\n\nexport const mobxNoAbstractDecorators: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Disallow MobX decorators on abstract class fields',\n category: 'Possible Errors',\n recommended: false,\n url: 'https://github.com/servicetitan/uikit.git',\n },\n messages: {\n noAbstractMobxDecorators:\n \"Don't decorate abstract class fields or methods with '@{{name}}'\",\n },\n },\n create(context: any) {\n function checkFn(node: any) {\n if (node?.decorators?.length) {\n node.decorators.forEach((decorator: any) => {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n const name = decorator?.expression?.name || decorator?.expression?.object?.name;\n\n if (name && mobxDecorators.includes(name)) {\n context.report({\n node,\n messageId: 'noAbstractMobxDecorators',\n data: {\n name,\n },\n });\n }\n });\n }\n }\n\n return {\n TSAbstractClassProperty: checkFn,\n TSAbstractMethodDefinition: checkFn,\n };\n },\n};\n"],"names":["mobxNoAbstractDecorators","mobxDecorators","meta","type","docs","description","category","recommended","url","messages","noAbstractMobxDecorators","create","context","checkFn","node","decorators","length","forEach","decorator","name","expression","object","includes","report","messageId","data","TSAbstractClassProperty","TSAbstractMethodDefinition"],"mappings":";;;;+BAIaA;;;eAAAA;;;AAFb,MAAMC,iBAAiB;IAAC;IAAc;IAAU;IAAY;CAAW;AAEhE,MAAMD,2BAA4C;IACrDE,MAAM;QACFC,MAAM;QACNC,MAAM;YACFC,aAAa;YACbC,UAAU;YACVC,aAAa;YACbC,KAAK;QACT;QACAC,UAAU;YACNC,0BACI;QACR;IACJ;IACAC,QAAOC,OAAY;QACf,SAASC,QAAQC,IAAS;gBAClBA;YAAJ,IAAIA,iBAAAA,4BAAAA,mBAAAA,KAAMC,UAAU,cAAhBD,uCAAAA,iBAAkBE,MAAM,EAAE;gBAC1BF,KAAKC,UAAU,CAACE,OAAO,CAAC,CAACC;wBAERA,uBAA+BA,8BAAAA;oBAD5C,wEAAwE;oBACxE,MAAMC,OAAOD,CAAAA,sBAAAA,iCAAAA,wBAAAA,UAAWE,UAAU,cAArBF,4CAAAA,sBAAuBC,IAAI,MAAID,sBAAAA,iCAAAA,yBAAAA,UAAWE,UAAU,cAArBF,8CAAAA,+BAAAA,uBAAuBG,MAAM,cAA7BH,mDAAAA,6BAA+BC,IAAI;oBAE/E,IAAIA,QAAQlB,eAAeqB,QAAQ,CAACH,OAAO;wBACvCP,QAAQW,MAAM,CAAC;4BACXT;4BACAU,WAAW;4BACXC,MAAM;gCACFN;4BACJ;wBACJ;oBACJ;gBACJ;YACJ;QACJ;QAEA,OAAO;YACHO,yBAAyBb;YACzBc,4BAA4Bd;QAChC;IACJ;AACJ"}
@@ -1,46 +1,56 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mobxUseMakeObservableWithDecorators = void 0;
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "mobxUseMakeObservableWithDecorators", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return mobxUseMakeObservableWithDecorators;
9
+ }
10
+ });
4
11
  // NOTE: "action" also covers "action.bound"
5
- const mobxDecorators = ['observable', 'action', 'computed', 'override'];
6
- exports.mobxUseMakeObservableWithDecorators = {
12
+ const mobxDecorators = [
13
+ 'observable',
14
+ 'action',
15
+ 'computed',
16
+ 'override'
17
+ ];
18
+ const mobxUseMakeObservableWithDecorators = {
7
19
  meta: {
8
20
  type: 'problem',
9
21
  docs: {
10
22
  description: 'Testing makeObservable used with decorators',
11
23
  category: 'Possible Errors',
12
24
  recommended: false,
13
- url: 'https://github.com/servicetitan/uikit.git',
25
+ url: 'https://github.com/servicetitan/uikit.git'
14
26
  },
15
27
  messages: {
16
28
  makeObservable: 'Use makeObservable in the constructor with MobX decorators',
17
- constructor: 'Add constructor with makeObservable when using MobX decorators',
18
- },
29
+ constructor: 'Add constructor with makeObservable when using MobX decorators'
30
+ }
19
31
  },
20
- create(context) {
32
+ create (context) {
21
33
  return {
22
- ClassDeclaration(node) {
34
+ ClassDeclaration (node) {
23
35
  let hasMobxDecorator = false;
24
36
  let hasConstructor = false;
25
37
  let hasMakeObservable = false;
26
- node.body.body.forEach((methodOrProperty) => {
27
- var _a, _b;
38
+ node.body.body.forEach((methodOrProperty)=>{
28
39
  if (methodOrProperty.decorators) {
29
- methodOrProperty.decorators.forEach((decorator) => {
30
- var _a, _b, _c;
31
- if (mobxDecorators.includes(
32
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
33
- ((_a = decorator === null || decorator === void 0 ? void 0 : decorator.expression) === null || _a === void 0 ? void 0 : _a.name) ||
34
- ((_c = (_b = decorator === null || decorator === void 0 ? void 0 : decorator.expression) === null || _b === void 0 ? void 0 : _b.object) === null || _c === void 0 ? void 0 : _c.name))) {
40
+ methodOrProperty.decorators.forEach((decorator)=>{
41
+ var // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
42
+ _decorator_expression, _decorator_expression_object, _decorator_expression1;
43
+ if (mobxDecorators.includes((decorator === null || decorator === void 0 ? void 0 : (_decorator_expression = decorator.expression) === null || _decorator_expression === void 0 ? void 0 : _decorator_expression.name) || (decorator === null || decorator === void 0 ? void 0 : (_decorator_expression1 = decorator.expression) === null || _decorator_expression1 === void 0 ? void 0 : (_decorator_expression_object = _decorator_expression1.object) === null || _decorator_expression_object === void 0 ? void 0 : _decorator_expression_object.name))) {
35
44
  hasMobxDecorator = true;
36
45
  }
37
46
  });
38
47
  }
39
48
  if (methodOrProperty.kind === 'constructor') {
49
+ var _methodOrProperty_value_body, _methodOrProperty_value;
40
50
  hasConstructor = true;
41
- (_b = (_a = methodOrProperty.value) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.body.forEach((statement) => {
42
- var _a, _b;
43
- if (((_b = (_a = statement === null || statement === void 0 ? void 0 : statement.expression) === null || _a === void 0 ? void 0 : _a.callee) === null || _b === void 0 ? void 0 : _b.name) === 'makeObservable') {
51
+ (_methodOrProperty_value = methodOrProperty.value) === null || _methodOrProperty_value === void 0 ? void 0 : (_methodOrProperty_value_body = _methodOrProperty_value.body) === null || _methodOrProperty_value_body === void 0 ? void 0 : _methodOrProperty_value_body.body.forEach((statement)=>{
52
+ var _statement_expression_callee, _statement_expression;
53
+ if ((statement === null || statement === void 0 ? void 0 : (_statement_expression = statement.expression) === null || _statement_expression === void 0 ? void 0 : (_statement_expression_callee = _statement_expression.callee) === null || _statement_expression_callee === void 0 ? void 0 : _statement_expression_callee.name) === 'makeObservable') {
44
54
  hasMakeObservable = true;
45
55
  }
46
56
  });
@@ -49,17 +59,18 @@ exports.mobxUseMakeObservableWithDecorators = {
49
59
  if (hasMobxDecorator && !hasMakeObservable && hasConstructor) {
50
60
  context.report({
51
61
  node,
52
- messageId: 'makeObservable',
62
+ messageId: 'makeObservable'
53
63
  });
54
64
  }
55
65
  if (hasMobxDecorator && !hasMakeObservable && !hasConstructor) {
56
66
  context.report({
57
67
  node,
58
- messageId: 'constructor',
68
+ messageId: 'constructor'
59
69
  });
60
70
  }
61
- },
71
+ }
62
72
  };
63
- },
73
+ }
64
74
  };
75
+
65
76
  //# sourceMappingURL=use-makeObservable-with-decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-makeObservable-with-decorators.js","sourceRoot":"","sources":["../../../src/rules/mobx/use-makeObservable-with-decorators.ts"],"names":[],"mappings":";;;AAEA,4CAA4C;AAC5C,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE3D,QAAA,mCAAmC,GAAoB;IAChE,IAAI,EAAE;QACF,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACF,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,iBAAiB;YAC3B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,2CAA2C;SACnD;QACD,QAAQ,EAAE;YACN,cAAc,EAAE,4DAA4D;YAC5E,WAAW,EAAE,gEAAgE;SAChF;KACJ;IACD,MAAM,CAAC,OAAO;QACV,OAAO;YACH,gBAAgB,CAAC,IAAI;gBACjB,IAAI,gBAAgB,GAAG,KAAK,CAAC;gBAC7B,IAAI,cAAc,GAAG,KAAK,CAAC;gBAC3B,IAAI,iBAAiB,GAAG,KAAK,CAAC;gBAE9B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,gBAAqB,EAAE,EAAE;;oBAC7C,IAAI,gBAAgB,CAAC,UAAU,EAAE,CAAC;wBAC9B,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAc,EAAE,EAAE;;4BACnD,IACI,cAAc,CAAC,QAAQ;4BACnB,wEAAwE;4BACxE,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,IAAI;iCACvB,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,MAAM,0CAAE,IAAI,CAAA,CAC1C,EACH,CAAC;gCACC,gBAAgB,GAAG,IAAI,CAAC;4BAC5B,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC;oBAED,IAAI,gBAAgB,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;wBAC1C,cAAc,GAAG,IAAI,CAAC;wBAEtB,MAAA,MAAA,gBAAgB,CAAC,KAAK,0CAAE,IAAI,0CAAE,IAAI,CAAC,OAAO,CAAC,CAAC,SAAc,EAAE,EAAE;;4BAC1D,IAAI,CAAA,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,0CAAE,MAAM,0CAAE,IAAI,MAAK,gBAAgB,EAAE,CAAC;gCAC3D,iBAAiB,GAAG,IAAI,CAAC;4BAC7B,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAI,gBAAgB,IAAI,CAAC,iBAAiB,IAAI,cAAc,EAAE,CAAC;oBAC3D,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI;wBACJ,SAAS,EAAE,gBAAgB;qBAC9B,CAAC,CAAC;gBACP,CAAC;gBAED,IAAI,gBAAgB,IAAI,CAAC,iBAAiB,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC5D,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI;wBACJ,SAAS,EAAE,aAAa;qBAC3B,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/rules/mobx/use-makeObservable-with-decorators.ts"],"sourcesContent":["import { Rule } from 'eslint';\n\n// NOTE: \"action\" also covers \"action.bound\"\nconst mobxDecorators = ['observable', 'action', 'computed', 'override'];\n\nexport const mobxUseMakeObservableWithDecorators: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Testing makeObservable used with decorators',\n category: 'Possible Errors',\n recommended: false,\n url: 'https://github.com/servicetitan/uikit.git',\n },\n messages: {\n makeObservable: 'Use makeObservable in the constructor with MobX decorators',\n constructor: 'Add constructor with makeObservable when using MobX decorators',\n },\n },\n create(context) {\n return {\n ClassDeclaration(node) {\n let hasMobxDecorator = false;\n let hasConstructor = false;\n let hasMakeObservable = false;\n\n node.body.body.forEach((methodOrProperty: any) => {\n if (methodOrProperty.decorators) {\n methodOrProperty.decorators.forEach((decorator: any) => {\n if (\n mobxDecorators.includes(\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n decorator?.expression?.name ||\n decorator?.expression?.object?.name\n )\n ) {\n hasMobxDecorator = true;\n }\n });\n }\n\n if (methodOrProperty.kind === 'constructor') {\n hasConstructor = true;\n\n methodOrProperty.value?.body?.body.forEach((statement: any) => {\n if (statement?.expression?.callee?.name === 'makeObservable') {\n hasMakeObservable = true;\n }\n });\n }\n });\n\n if (hasMobxDecorator && !hasMakeObservable && hasConstructor) {\n context.report({\n node,\n messageId: 'makeObservable',\n });\n }\n\n if (hasMobxDecorator && !hasMakeObservable && !hasConstructor) {\n context.report({\n node,\n messageId: 'constructor',\n });\n }\n },\n };\n },\n};\n"],"names":["mobxUseMakeObservableWithDecorators","mobxDecorators","meta","type","docs","description","category","recommended","url","messages","makeObservable","constructor","create","context","ClassDeclaration","node","hasMobxDecorator","hasConstructor","hasMakeObservable","body","forEach","methodOrProperty","decorators","decorator","includes","expression","name","object","kind","value","statement","callee","report","messageId"],"mappings":";;;;+BAKaA;;;eAAAA;;;AAHb,4CAA4C;AAC5C,MAAMC,iBAAiB;IAAC;IAAc;IAAU;IAAY;CAAW;AAEhE,MAAMD,sCAAuD;IAChEE,MAAM;QACFC,MAAM;QACNC,MAAM;YACFC,aAAa;YACbC,UAAU;YACVC,aAAa;YACbC,KAAK;QACT;QACAC,UAAU;YACNC,gBAAgB;YAChBC,aAAa;QACjB;IACJ;IACAC,QAAOC,OAAO;QACV,OAAO;YACHC,kBAAiBC,IAAI;gBACjB,IAAIC,mBAAmB;gBACvB,IAAIC,iBAAiB;gBACrB,IAAIC,oBAAoB;gBAExBH,KAAKI,IAAI,CAACA,IAAI,CAACC,OAAO,CAAC,CAACC;oBACpB,IAAIA,iBAAiBC,UAAU,EAAE;wBAC7BD,iBAAiBC,UAAU,CAACF,OAAO,CAAC,CAACG;gCAGzB,wEAAwE;4BACxEA,uBACIA,8BAAAA;4BAJZ,IACItB,eAAeuB,QAAQ,CAEnBD,CAAAA,sBAAAA,iCAAAA,wBAAAA,UAAWE,UAAU,cAArBF,4CAAAA,sBAAuBG,IAAI,MACvBH,sBAAAA,iCAAAA,yBAAAA,UAAWE,UAAU,cAArBF,8CAAAA,+BAAAA,uBAAuBI,MAAM,cAA7BJ,mDAAAA,6BAA+BG,IAAI,IAE7C;gCACEV,mBAAmB;4BACvB;wBACJ;oBACJ;oBAEA,IAAIK,iBAAiBO,IAAI,KAAK,eAAe;4BAGzCP,8BAAAA;wBAFAJ,iBAAiB;yBAEjBI,0BAAAA,iBAAiBQ,KAAK,cAAtBR,+CAAAA,+BAAAA,wBAAwBF,IAAI,cAA5BE,mDAAAA,6BAA8BF,IAAI,CAACC,OAAO,CAAC,CAACU;gCACpCA,8BAAAA;4BAAJ,IAAIA,CAAAA,sBAAAA,iCAAAA,wBAAAA,UAAWL,UAAU,cAArBK,6CAAAA,+BAAAA,sBAAuBC,MAAM,cAA7BD,mDAAAA,6BAA+BJ,IAAI,MAAK,kBAAkB;gCAC1DR,oBAAoB;4BACxB;wBACJ;oBACJ;gBACJ;gBAEA,IAAIF,oBAAoB,CAACE,qBAAqBD,gBAAgB;oBAC1DJ,QAAQmB,MAAM,CAAC;wBACXjB;wBACAkB,WAAW;oBACf;gBACJ;gBAEA,IAAIjB,oBAAoB,CAACE,qBAAqB,CAACD,gBAAgB;oBAC3DJ,QAAQmB,MAAM,CAAC;wBACXjB;wBACAkB,WAAW;oBACf;gBACJ;YACJ;QACJ;IACJ;AACJ"}
@@ -1,16 +1,25 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.noAsyncInForEach = void 0;
7
- const utils_1 = require("@typescript-eslint/utils");
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "noAsyncInForEach", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return noAsyncInForEach;
9
+ }
10
+ });
11
+ const _utils = require("@typescript-eslint/utils");
12
+ const _typescript = /*#__PURE__*/ _interop_require_default(require("typescript"));
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
8
18
  const { getParserServices } = require('@typescript-eslint/utils/eslint-utils');
9
19
  const { containsAllTypesByName } = require('@typescript-eslint/type-utils');
10
- const typescript_1 = __importDefault(require("typescript"));
11
- const createRule = utils_1.ESLintUtils.RuleCreator(_name => 'https://gist.github.com/joeytwiddle/37d2085425c049629b80956d3c618971');
12
- exports.noAsyncInForEach = createRule({
13
- create(context) {
20
+ const createRule = _utils.ESLintUtils.RuleCreator((_name)=>'https://gist.github.com/joeytwiddle/37d2085425c049629b80956d3c618971');
21
+ const noAsyncInForEach = createRule({
22
+ create (context) {
14
23
  const services = getParserServices(context);
15
24
  const checker = services.program.getTypeChecker();
16
25
  function checkForEachExpression(node) {
@@ -22,57 +31,63 @@ exports.noAsyncInForEach = createRule({
22
31
  if (!isArrayLike(callee.object)) {
23
32
  return;
24
33
  }
25
- context.report({ messageId: 'noAsyncInForEach', node });
34
+ context.report({
35
+ messageId: 'noAsyncInForEach',
36
+ node
37
+ });
26
38
  }
27
39
  function getSymbolAtLocation(node) {
28
40
  const symbol = services.getSymbolAtLocation(node);
29
- if (symbol && symbol.flags & typescript_1.default.SymbolFlags.Alias) {
41
+ if (symbol && symbol.flags & _typescript.default.SymbolFlags.Alias) {
30
42
  return checker.getAliasedSymbol(symbol);
31
43
  }
32
44
  return symbol;
33
45
  }
34
46
  function isArrayLike(node) {
35
47
  const nodeType = services.getTypeAtLocation(node);
36
- const types = isUnionType(nodeType) ? nodeType.types : [nodeType];
37
- return types.some(type => checker.isArrayType(type) || checker.isTupleType(type));
48
+ const types = isUnionType(nodeType) ? nodeType.types : [
49
+ nodeType
50
+ ];
51
+ return types.some((type)=>checker.isArrayType(type) || checker.isTupleType(type));
38
52
  }
39
53
  function isAsync(node) {
40
- return ((node.type === utils_1.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression && node.async) ||
41
- hasAsyncModifier(getSymbolAtLocation(node)) ||
42
- returnsPromise(node));
54
+ return node.type === _utils.TSESTree.AST_NODE_TYPES.ArrowFunctionExpression && node.async || hasAsyncModifier(getSymbolAtLocation(node)) || returnsPromise(node);
43
55
  }
44
56
  function isUnionType(type) {
45
- return (type.flags & typescript_1.default.TypeFlags.Union) !== 0;
57
+ return (type.flags & _typescript.default.TypeFlags.Union) !== 0;
46
58
  }
47
59
  function hasAsyncModifier(symbol) {
48
- var _a;
49
- return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.declarations) === null || _a === void 0 ? void 0 : _a.find((declaration) => {
50
- var _a;
51
- return (_a = declaration.modifiers) === null || _a === void 0 ? void 0 : _a.find(modifier => modifier.kind === typescript_1.default.SyntaxKind.AsyncKeyword);
60
+ var _symbol_declarations;
61
+ return !!(symbol === null || symbol === void 0 ? void 0 : (_symbol_declarations = symbol.declarations) === null || _symbol_declarations === void 0 ? void 0 : _symbol_declarations.find((declaration)=>{
62
+ var _declaration_modifiers;
63
+ return (_declaration_modifiers = declaration.modifiers) === null || _declaration_modifiers === void 0 ? void 0 : _declaration_modifiers.find((modifier)=>modifier.kind === _typescript.default.SyntaxKind.AsyncKeyword);
52
64
  }));
53
65
  }
54
66
  function returnsPromise(node) {
55
67
  const signatures = services.getTypeAtLocation(node).getCallSignatures();
56
68
  if (signatures.length) {
57
69
  const returnType = checker.getReturnTypeOfSignature(signatures[0]);
58
- return containsAllTypesByName(returnType, true, new Set(['Promise']));
70
+ return containsAllTypesByName(returnType, true, new Set([
71
+ 'Promise'
72
+ ]));
59
73
  }
60
74
  }
61
75
  return {
62
- "CallExpression[arguments.length=1] > MemberExpression[property.name='forEach']": checkForEachExpression,
76
+ "CallExpression[arguments.length=1] > MemberExpression[property.name='forEach']": checkForEachExpression
63
77
  };
64
78
  },
65
79
  name: 'no-async-in-foreach',
66
80
  meta: {
67
81
  docs: {
68
- description: 'Disallow passing asynchronous callback to Array.forEach',
82
+ description: 'Disallow passing asynchronous callback to Array.forEach'
69
83
  },
70
84
  messages: {
71
- noAsyncInForEach: 'Async callback passed to Array.forEach',
85
+ noAsyncInForEach: 'Async callback passed to Array.forEach'
72
86
  },
73
87
  type: 'problem',
74
- schema: [],
88
+ schema: []
75
89
  },
76
- defaultOptions: [],
90
+ defaultOptions: []
77
91
  });
92
+
78
93
  //# sourceMappingURL=no-async-in-foreach.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-async-in-foreach.js","sourceRoot":"","sources":["../../src/rules/no-async-in-foreach.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"sources":["../../src/rules/no-async-in-foreach.ts"],"sourcesContent":["import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';\nconst { getParserServices } = require('@typescript-eslint/utils/eslint-utils');\nconst { containsAllTypesByName } = require('@typescript-eslint/type-utils');\nimport ts, { ParameterDeclaration, TypeChecker } from 'typescript';\n\nconst createRule = ESLintUtils.RuleCreator(\n _name => 'https://gist.github.com/joeytwiddle/37d2085425c049629b80956d3c618971'\n);\n\nexport const noAsyncInForEach = createRule({\n create(context) {\n const services = getParserServices(context);\n const checker = services.program.getTypeChecker() as TypeChecker & {\n // Type declarations aren't in 4.x. See https://github.com/microsoft/TypeScript/pull/52467\n isArrayType: (type: ts.Type) => boolean;\n isTupleType: (type: ts.Type) => boolean;\n };\n\n function checkForEachExpression(node: TSESTree.MemberExpression) {\n const callExpression = node.parent as TSESTree.CallExpression;\n if (!isAsync(callExpression.arguments[0])) {\n return;\n }\n\n const callee = callExpression.callee as TSESTree.MemberExpression;\n if (!isArrayLike(callee.object)) {\n return;\n }\n\n context.report({ messageId: 'noAsyncInForEach', node });\n }\n\n function getSymbolAtLocation(node: TSESTree.Node) {\n const symbol = services.getSymbolAtLocation(node);\n if (symbol && symbol.flags & ts.SymbolFlags.Alias) {\n return checker.getAliasedSymbol(symbol);\n }\n return symbol;\n }\n\n function isArrayLike(node: TSESTree.Node) {\n const nodeType = services.getTypeAtLocation(node);\n const types = isUnionType(nodeType) ? nodeType.types : [nodeType];\n return types.some(type => checker.isArrayType(type) || checker.isTupleType(type));\n }\n\n function isAsync(node: TSESTree.Node) {\n return (\n (node.type === TSESTree.AST_NODE_TYPES.ArrowFunctionExpression && node.async) ||\n hasAsyncModifier(getSymbolAtLocation(node)) ||\n returnsPromise(node)\n );\n }\n\n function isUnionType(type: ts.Type): type is ts.UnionType {\n return (type.flags & ts.TypeFlags.Union) !== 0;\n }\n\n function hasAsyncModifier(symbol?: ts.Symbol) {\n return !!symbol?.declarations?.find((declaration: ParameterDeclaration) =>\n declaration.modifiers?.find(\n modifier => modifier.kind === ts.SyntaxKind.AsyncKeyword\n )\n );\n }\n\n function returnsPromise(node: TSESTree.Node) {\n const signatures = services.getTypeAtLocation(node).getCallSignatures();\n if (signatures.length) {\n const returnType = checker.getReturnTypeOfSignature(signatures[0]);\n return containsAllTypesByName(returnType, true, new Set(['Promise']));\n }\n }\n\n return {\n \"CallExpression[arguments.length=1] > MemberExpression[property.name='forEach']\":\n checkForEachExpression,\n };\n },\n name: 'no-async-in-foreach',\n meta: {\n docs: {\n description: 'Disallow passing asynchronous callback to Array.forEach',\n },\n messages: {\n noAsyncInForEach: 'Async callback passed to Array.forEach',\n },\n type: 'problem',\n schema: [],\n },\n defaultOptions: [],\n});\n"],"names":["noAsyncInForEach","getParserServices","require","containsAllTypesByName","createRule","ESLintUtils","RuleCreator","_name","create","context","services","checker","program","getTypeChecker","checkForEachExpression","node","callExpression","parent","isAsync","arguments","callee","isArrayLike","object","report","messageId","getSymbolAtLocation","symbol","flags","ts","SymbolFlags","Alias","getAliasedSymbol","nodeType","getTypeAtLocation","types","isUnionType","some","type","isArrayType","isTupleType","TSESTree","AST_NODE_TYPES","ArrowFunctionExpression","async","hasAsyncModifier","returnsPromise","TypeFlags","Union","declarations","find","declaration","modifiers","modifier","kind","SyntaxKind","AsyncKeyword","signatures","getCallSignatures","length","returnType","getReturnTypeOfSignature","Set","name","meta","docs","description","messages","schema","defaultOptions"],"mappings":";;;;+BASaA;;;eAAAA;;;uBATyB;mEAGgB;;;;;;AAFtD,MAAM,EAAEC,iBAAiB,EAAE,GAAGC,QAAQ;AACtC,MAAM,EAAEC,sBAAsB,EAAE,GAAGD,QAAQ;AAG3C,MAAME,aAAaC,kBAAW,CAACC,WAAW,CACtCC,CAAAA,QAAS;AAGN,MAAMP,mBAAmBI,WAAW;IACvCI,QAAOC,OAAO;QACV,MAAMC,WAAWT,kBAAkBQ;QACnC,MAAME,UAAUD,SAASE,OAAO,CAACC,cAAc;QAM/C,SAASC,uBAAuBC,IAA+B;YAC3D,MAAMC,iBAAiBD,KAAKE,MAAM;YAClC,IAAI,CAACC,QAAQF,eAAeG,SAAS,CAAC,EAAE,GAAG;gBACvC;YACJ;YAEA,MAAMC,SAASJ,eAAeI,MAAM;YACpC,IAAI,CAACC,YAAYD,OAAOE,MAAM,GAAG;gBAC7B;YACJ;YAEAb,QAAQc,MAAM,CAAC;gBAAEC,WAAW;gBAAoBT;YAAK;QACzD;QAEA,SAASU,oBAAoBV,IAAmB;YAC5C,MAAMW,SAAShB,SAASe,mBAAmB,CAACV;YAC5C,IAAIW,UAAUA,OAAOC,KAAK,GAAGC,mBAAE,CAACC,WAAW,CAACC,KAAK,EAAE;gBAC/C,OAAOnB,QAAQoB,gBAAgB,CAACL;YACpC;YACA,OAAOA;QACX;QAEA,SAASL,YAAYN,IAAmB;YACpC,MAAMiB,WAAWtB,SAASuB,iBAAiB,CAAClB;YAC5C,MAAMmB,QAAQC,YAAYH,YAAYA,SAASE,KAAK,GAAG;gBAACF;aAAS;YACjE,OAAOE,MAAME,IAAI,CAACC,CAAAA,OAAQ1B,QAAQ2B,WAAW,CAACD,SAAS1B,QAAQ4B,WAAW,CAACF;QAC/E;QAEA,SAASnB,QAAQH,IAAmB;YAChC,OACI,AAACA,KAAKsB,IAAI,KAAKG,eAAQ,CAACC,cAAc,CAACC,uBAAuB,IAAI3B,KAAK4B,KAAK,IAC5EC,iBAAiBnB,oBAAoBV,UACrC8B,eAAe9B;QAEvB;QAEA,SAASoB,YAAYE,IAAa;YAC9B,OAAO,AAACA,CAAAA,KAAKV,KAAK,GAAGC,mBAAE,CAACkB,SAAS,CAACC,KAAK,AAAD,MAAO;QACjD;QAEA,SAASH,iBAAiBlB,MAAkB;gBAC/BA;YAAT,OAAO,CAAC,EAACA,mBAAAA,8BAAAA,uBAAAA,OAAQsB,YAAY,cAApBtB,2CAAAA,qBAAsBuB,IAAI,CAAC,CAACC;oBACjCA;wBAAAA,yBAAAA,YAAYC,SAAS,cAArBD,6CAAAA,uBAAuBD,IAAI,CACvBG,CAAAA,WAAYA,SAASC,IAAI,KAAKzB,mBAAE,CAAC0B,UAAU,CAACC,YAAY;;QAGpE;QAEA,SAASV,eAAe9B,IAAmB;YACvC,MAAMyC,aAAa9C,SAASuB,iBAAiB,CAAClB,MAAM0C,iBAAiB;YACrE,IAAID,WAAWE,MAAM,EAAE;gBACnB,MAAMC,aAAahD,QAAQiD,wBAAwB,CAACJ,UAAU,CAAC,EAAE;gBACjE,OAAOrD,uBAAuBwD,YAAY,MAAM,IAAIE,IAAI;oBAAC;iBAAU;YACvE;QACJ;QAEA,OAAO;YACH,kFACI/C;QACR;IACJ;IACAgD,MAAM;IACNC,MAAM;QACFC,MAAM;YACFC,aAAa;QACjB;QACAC,UAAU;YACNlE,kBAAkB;QACtB;QACAqC,MAAM;QACN8B,QAAQ,EAAE;IACd;IACAC,gBAAgB,EAAE;AACtB"}
@@ -1,36 +1,43 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reactDestructureDefaultImport = void 0;
4
- exports.reactDestructureDefaultImport = {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "reactDestructureDefaultImport", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return reactDestructureDefaultImport;
9
+ }
10
+ });
11
+ const reactDestructureDefaultImport = {
5
12
  meta: {
6
13
  type: 'suggestion',
7
14
  docs: {
8
15
  description: "Disallow importing React's default export",
9
16
  category: 'Best Practices',
10
17
  recommended: false,
11
- url: 'https://github.com/servicetitan/uikit.git',
18
+ url: 'https://github.com/servicetitan/uikit.git'
12
19
  },
13
20
  messages: {
14
- importDefault: 'Avoid importing React default export',
15
- },
21
+ importDefault: 'Avoid importing React default export'
22
+ }
16
23
  },
17
- create(context) {
24
+ create (context) {
18
25
  return {
19
- ImportDeclaration(node) {
26
+ ImportDeclaration (node) {
20
27
  if (node.source.value !== 'react') {
21
28
  return;
22
29
  }
23
- node.specifiers.forEach(specifier => {
24
- if (specifier.type === 'ImportDefaultSpecifier' ||
25
- specifier.type === 'ImportNamespaceSpecifier') {
30
+ node.specifiers.forEach((specifier)=>{
31
+ if (specifier.type === 'ImportDefaultSpecifier' || specifier.type === 'ImportNamespaceSpecifier') {
26
32
  context.report({
27
33
  node,
28
- messageId: 'importDefault',
34
+ messageId: 'importDefault'
29
35
  });
30
36
  }
31
37
  });
32
- },
38
+ }
33
39
  };
34
- },
40
+ }
35
41
  };
42
+
36
43
  //# sourceMappingURL=destructure-default-import.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"destructure-default-import.js","sourceRoot":"","sources":["../../../src/rules/react/destructure-default-import.ts"],"names":[],"mappings":";;;AAEa,QAAA,6BAA6B,GAAoB;IAC1D,IAAI,EAAE;QACF,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACF,WAAW,EAAE,2CAA2C;YACxD,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,2CAA2C;SACnD;QACD,QAAQ,EAAE;YACN,aAAa,EAAE,sCAAsC;SACxD;KACJ;IACD,MAAM,CAAC,OAAO;QACV,OAAO;YACH,iBAAiB,CAAC,IAAI;gBAClB,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;oBAChC,OAAO;gBACX,CAAC;gBAED,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;oBAChC,IACI,SAAS,CAAC,IAAI,KAAK,wBAAwB;wBAC3C,SAAS,CAAC,IAAI,KAAK,0BAA0B,EAC/C,CAAC;wBACC,OAAO,CAAC,MAAM,CAAC;4BACX,IAAI;4BACJ,SAAS,EAAE,eAAe;yBAC7B,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/rules/react/destructure-default-import.ts"],"sourcesContent":["import { Rule } from 'eslint';\n\nexport const reactDestructureDefaultImport: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n docs: {\n description: \"Disallow importing React's default export\",\n category: 'Best Practices',\n recommended: false,\n url: 'https://github.com/servicetitan/uikit.git',\n },\n messages: {\n importDefault: 'Avoid importing React default export',\n },\n },\n create(context) {\n return {\n ImportDeclaration(node) {\n if (node.source.value !== 'react') {\n return;\n }\n\n node.specifiers.forEach(specifier => {\n if (\n specifier.type === 'ImportDefaultSpecifier' ||\n specifier.type === 'ImportNamespaceSpecifier'\n ) {\n context.report({\n node,\n messageId: 'importDefault',\n });\n }\n });\n },\n };\n },\n};\n"],"names":["reactDestructureDefaultImport","meta","type","docs","description","category","recommended","url","messages","importDefault","create","context","ImportDeclaration","node","source","value","specifiers","forEach","specifier","report","messageId"],"mappings":";;;;+BAEaA;;;eAAAA;;;AAAN,MAAMA,gCAAiD;IAC1DC,MAAM;QACFC,MAAM;QACNC,MAAM;YACFC,aAAa;YACbC,UAAU;YACVC,aAAa;YACbC,KAAK;QACT;QACAC,UAAU;YACNC,eAAe;QACnB;IACJ;IACAC,QAAOC,OAAO;QACV,OAAO;YACHC,mBAAkBC,IAAI;gBAClB,IAAIA,KAAKC,MAAM,CAACC,KAAK,KAAK,SAAS;oBAC/B;gBACJ;gBAEAF,KAAKG,UAAU,CAACC,OAAO,CAACC,CAAAA;oBACpB,IACIA,UAAUhB,IAAI,KAAK,4BACnBgB,UAAUhB,IAAI,KAAK,4BACrB;wBACES,QAAQQ,MAAM,CAAC;4BACXN;4BACAO,WAAW;wBACf;oBACJ;gBACJ;YACJ;QACJ;IACJ;AACJ"}
@@ -1,33 +1,41 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reactNoQualifiedType = void 0;
4
- exports.reactNoQualifiedType = {
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "reactNoQualifiedType", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return reactNoQualifiedType;
9
+ }
10
+ });
11
+ const reactNoQualifiedType = {
5
12
  meta: {
6
13
  type: 'suggestion',
7
14
  docs: {
8
15
  description: 'Disallow using React types from default export',
9
16
  category: 'Best Practices',
10
17
  recommended: false,
11
- url: 'https://github.com/servicetitan/uikit.git',
18
+ url: 'https://github.com/servicetitan/uikit.git'
12
19
  },
13
20
  messages: {
14
- importDefault: "Import {{right}} from 'react' instead of using React.{{right}}",
15
- },
21
+ importDefault: "Import {{right}} from 'react' instead of using React.{{right}}"
22
+ }
16
23
  },
17
- create(context) {
24
+ create (context) {
18
25
  return {
19
- TSQualifiedName(node) {
26
+ TSQualifiedName (node) {
20
27
  if (node.left && node.left.name === 'React') {
21
28
  context.report({
22
29
  node,
23
30
  messageId: 'importDefault',
24
31
  data: {
25
- right: node.right.name,
26
- },
32
+ right: node.right.name
33
+ }
27
34
  });
28
35
  }
29
- },
36
+ }
30
37
  };
31
- },
38
+ }
32
39
  };
40
+
33
41
  //# sourceMappingURL=no-qualified-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-qualified-type.js","sourceRoot":"","sources":["../../../src/rules/react/no-qualified-type.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAoB;IACjD,IAAI,EAAE;QACF,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACF,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,2CAA2C;SACnD;QACD,QAAQ,EAAE;YACN,aAAa,EAAE,gEAAgE;SAClF;KACJ;IACD,MAAM,CAAC,OAAO;QACV,OAAO;YACH,eAAe,CAAC,IAAS;gBACrB,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC1C,OAAO,CAAC,MAAM,CAAC;wBACX,IAAI;wBACJ,SAAS,EAAE,eAAe;wBAC1B,IAAI,EAAE;4BACF,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;yBACzB;qBACJ,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CACJ,CAAC"}
1
+ {"version":3,"sources":["../../../src/rules/react/no-qualified-type.ts"],"sourcesContent":["import { Rule } from 'eslint';\n\nexport const reactNoQualifiedType: Rule.RuleModule = {\n meta: {\n type: 'suggestion',\n docs: {\n description: 'Disallow using React types from default export',\n category: 'Best Practices',\n recommended: false,\n url: 'https://github.com/servicetitan/uikit.git',\n },\n messages: {\n importDefault: \"Import {{right}} from 'react' instead of using React.{{right}}\",\n },\n },\n create(context) {\n return {\n TSQualifiedName(node: any) {\n if (node.left && node.left.name === 'React') {\n context.report({\n node,\n messageId: 'importDefault',\n data: {\n right: node.right.name,\n },\n });\n }\n },\n };\n },\n};\n"],"names":["reactNoQualifiedType","meta","type","docs","description","category","recommended","url","messages","importDefault","create","context","TSQualifiedName","node","left","name","report","messageId","data","right"],"mappings":";;;;+BAEaA;;;eAAAA;;;AAAN,MAAMA,uBAAwC;IACjDC,MAAM;QACFC,MAAM;QACNC,MAAM;YACFC,aAAa;YACbC,UAAU;YACVC,aAAa;YACbC,KAAK;QACT;QACAC,UAAU;YACNC,eAAe;QACnB;IACJ;IACAC,QAAOC,OAAO;QACV,OAAO;YACHC,iBAAgBC,IAAS;gBACrB,IAAIA,KAAKC,IAAI,IAAID,KAAKC,IAAI,CAACC,IAAI,KAAK,SAAS;oBACzCJ,QAAQK,MAAM,CAAC;wBACXH;wBACAI,WAAW;wBACXC,MAAM;4BACFC,OAAON,KAAKM,KAAK,CAACJ,IAAI;wBAC1B;oBACJ;gBACJ;YACJ;QACJ;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@servicetitan/eslint-plugin",
3
- "version": "30.3.1",
3
+ "version": "31.1.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/servicetitan/uikit.git",
8
8
  "directory": "packages/eslint-plugin"
9
9
  },
10
+ "sideEffects": false,
10
11
  "main": "./dist/index.js",
11
12
  "typings": "./dist/index.d.ts",
12
13
  "files": [
@@ -19,10 +20,10 @@
19
20
  "devDependencies": {
20
21
  "@types/eslint": "~9.6.1",
21
22
  "@typescript-eslint/rule-tester": "~8.32.1",
22
- "eslint": "~9.27.0"
23
+ "eslint": "~9.30.1"
23
24
  },
24
25
  "peerDependencies": {
25
- "eslint": "~9.27.0",
26
+ "eslint": "~9.30.1",
26
27
  "typescript": ">=5.8.3"
27
28
  },
28
29
  "publishConfig": {
@@ -31,5 +32,5 @@
31
32
  "cli": {
32
33
  "webpack": false
33
34
  },
34
- "gitHead": "4d7f01d86d64fc00160d63a2e2a3448f28aa7a2d"
35
+ "gitHead": "d01cfe32c50461245ce52c911710e8eb879290e9"
35
36
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../src/rules/__mocks__/fixture/file.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * This file is required to test type-aware rules.
5
- * See https://typescript-eslint.io/packages/rule-tester/#type-aware-testing
6
- */
7
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../../../src/rules/__mocks__/fixture/file.ts"],"names":[],"mappings":";;AAAA;;;GAGG"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=react.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/rules/__mocks__/fixture/react.tsx"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * This file is required to test type-aware rules.
5
- * See https://typescript-eslint.io/packages/rule-tester/#type-aware-testing
6
- */
7
- //# sourceMappingURL=react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../src/rules/__mocks__/fixture/react.tsx"],"names":[],"mappings":";;AAAA;;;GAGG"}