@servicetitan/eslint-plugin 29.0.0 → 30.0.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.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint';
2
- import { Rule } from 'eslint';
3
- export declare const rules: Record<string, Rule.RuleModule | AnyRuleModule>;
4
- export declare const processors: {
5
- stub: import("eslint").Linter.LintOptions;
2
+ import { Linter, Rule } from 'eslint';
3
+ export declare const rules: Record<'base' | 'mobx' | 'react', Record<string, Rule.RuleModule | AnyRuleModule>>;
4
+ declare const plugin: {
5
+ configs: {
6
+ recommended: Linter.Config<Linter.RulesRecord>[];
7
+ };
6
8
  };
9
+ export default plugin;
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAS9B,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,GAAG,aAAa,CAOjE,CAAC;AAEF,eAAO,MAAM,UAAU;;CAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAStC,eAAO,MAAM,KAAK,EAAE,MAAM,CACtB,MAAM,GAAG,MAAM,GAAG,OAAO,EACzB,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,CAclD,CAAC;AAEF,QAAA,MAAM,MAAM;;;;CAsBX,CAAC;AAGF,eAAe,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processors = exports.rules = void 0;
3
+ exports.rules = void 0;
4
4
  const no_async_in_foreach_1 = require("./rules/no-async-in-foreach");
5
5
  const decorators_declare_1 = require("./rules/decorators-declare");
6
6
  const use_makeObservable_with_decorators_1 = require("./rules/mobx/use-makeObservable-with-decorators");
7
7
  const no_abstract_decorators_1 = require("./rules/mobx/no-abstract-decorators");
8
8
  const destructure_default_import_1 = require("./rules/react/destructure-default-import");
9
9
  const no_qualified_type_1 = require("./rules/react/no-qualified-type");
10
- const stub_1 = require("./processors/stub");
11
10
  exports.rules = {
12
- 'mobx/use-makeObservable-with-decorators': use_makeObservable_with_decorators_1.mobxUseMakeObservableWithDecorators,
13
- 'mobx/no-abstract-decorators': no_abstract_decorators_1.mobxNoAbstractDecorators,
14
- 'react/destructure-default-import': destructure_default_import_1.reactDestructureDefaultImport,
15
- 'react/no-qualified-type': no_qualified_type_1.reactNoQualifiedType,
16
- 'no-async-in-foreach': no_async_in_foreach_1.noAsyncInForEach,
17
- 'use-declare-with-decorators': decorators_declare_1.useDeclareWithDecorators,
11
+ base: {
12
+ 'no-async-in-foreach': no_async_in_foreach_1.noAsyncInForEach,
13
+ 'use-declare-with-decorators': decorators_declare_1.useDeclareWithDecorators,
14
+ },
15
+ mobx: {
16
+ 'use-makeObservable-with-decorators': use_makeObservable_with_decorators_1.mobxUseMakeObservableWithDecorators,
17
+ 'no-abstract-decorators': no_abstract_decorators_1.mobxNoAbstractDecorators,
18
+ },
19
+ react: {
20
+ 'destructure-default-import': destructure_default_import_1.reactDestructureDefaultImport,
21
+ 'no-qualified-type': no_qualified_type_1.reactNoQualifiedType,
22
+ },
18
23
  };
19
- exports.processors = { stub: stub_1.stub };
24
+ const plugin = {
25
+ configs: {
26
+ recommended: [
27
+ {
28
+ name: '@servicetitan/eslint-plugin',
29
+ plugins: {
30
+ '@servicetitan': { rules: exports.rules.base },
31
+ '@servicetitan/mobx': { rules: exports.rules.mobx },
32
+ '@servicetitan/react': { rules: exports.rules.react },
33
+ },
34
+ files: ['**/*.ts', '**/*.tsx'],
35
+ rules: {
36
+ '@servicetitan/mobx/no-abstract-decorators': 'error',
37
+ '@servicetitan/mobx/use-makeObservable-with-decorators': 'error',
38
+ '@servicetitan/react/destructure-default-import': 'error',
39
+ '@servicetitan/react/no-qualified-type': 'error',
40
+ '@servicetitan/no-async-in-foreach': 'error',
41
+ '@servicetitan/use-declare-with-decorators': 'error',
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ };
47
+ // eslint-disable-next-line import/no-default-export
48
+ exports.default = plugin;
20
49
  //# 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":";;;AAEA,qEAA+D;AAC/D,mEAAsE;AACtE,wGAAsG;AACtG,gFAA+E;AAC/E,yFAAyF;AACzF,uEAAuE;AACvE,4CAAyC;AAE5B,QAAA,KAAK,GAAoD;IAClE,yCAAyC,EAAE,wEAAmC;IAC9E,6BAA6B,EAAE,iDAAwB;IACvD,kCAAkC,EAAE,0DAA6B;IACjE,yBAAyB,EAAE,wCAAoB;IAC/C,qBAAqB,EAAE,sCAAgB;IACvC,6BAA6B,EAAE,6CAAwB;CAC1D,CAAC;AAEW,QAAA,UAAU,GAAG,EAAE,IAAI,EAAJ,WAAI,EAAE,CAAC"}
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,3 +1,3 @@
1
- import { Linter } from 'eslint';
1
+ import type { Linter } from 'eslint';
2
2
  export declare const stub: Linter.LintOptions;
3
3
  //# sourceMappingURL=stub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../src/processors/stub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,WAGzB,CAAC"}
1
+ {"version":3,"file":"stub.d.ts","sourceRoot":"","sources":["../../src/processors/stub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,WAGzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"no-abstract-decorators.d.ts","sourceRoot":"","sources":["../../../src/rules/mobx/no-abstract-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,eAAO,MAAM,wBAAwB,EAAE,IAAI,CAAC,UAsC3C,CAAC"}
1
+ {"version":3,"file":"no-abstract-decorators.d.ts","sourceRoot":"","sources":["../../../src/rules/mobx/no-abstract-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,eAAO,MAAM,wBAAwB,EAAE,IAAI,CAAC,UAuC3C,CAAC"}
@@ -21,6 +21,7 @@ exports.mobxNoAbstractDecorators = {
21
21
  if ((_a = node === null || node === void 0 ? void 0 : node.decorators) === null || _a === void 0 ? void 0 : _a.length) {
22
22
  node.decorators.forEach((decorator) => {
23
23
  var _a, _b, _c;
24
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
24
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);
25
26
  if (name && mobxDecorators.includes(name)) {
26
27
  context.report({
@@ -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,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,"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 +1 @@
1
- {"version":3,"file":"use-makeObservable-with-decorators.d.ts","sourceRoot":"","sources":["../../../src/rules/mobx/use-makeObservable-with-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAK9B,eAAO,MAAM,mCAAmC,EAAE,IAAI,CAAC,UA8DtD,CAAC"}
1
+ {"version":3,"file":"use-makeObservable-with-decorators.d.ts","sourceRoot":"","sources":["../../../src/rules/mobx/use-makeObservable-with-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAK9B,eAAO,MAAM,mCAAmC,EAAE,IAAI,CAAC,UA+DtD,CAAC"}
@@ -28,7 +28,9 @@ exports.mobxUseMakeObservableWithDecorators = {
28
28
  if (methodOrProperty.decorators) {
29
29
  methodOrProperty.decorators.forEach((decorator) => {
30
30
  var _a, _b, _c;
31
- if (mobxDecorators.includes(((_a = decorator === null || decorator === void 0 ? void 0 : decorator.expression) === null || _a === void 0 ? void 0 : _a.name) ||
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) ||
32
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))) {
33
35
  hasMobxDecorator = true;
34
36
  }
@@ -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,CACnB,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,"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,3 +1,3 @@
1
1
  import { ESLintUtils } from '@typescript-eslint/utils';
2
- export declare const noAsyncInForEach: ESLintUtils.RuleModule<"noAsyncInForEach", [], ESLintUtils.RuleListener>;
2
+ export declare const noAsyncInForEach: ESLintUtils.RuleModule<"noAsyncInForEach", [], unknown, ESLintUtils.RuleListener>;
3
3
  //# sourceMappingURL=no-async-in-foreach.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-async-in-foreach.d.ts","sourceRoot":"","sources":["../../src/rules/no-async-in-foreach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,0BAA0B,CAAC;AASjE,eAAO,MAAM,gBAAgB,0EAkF3B,CAAC"}
1
+ {"version":3,"file":"no-async-in-foreach.d.ts","sourceRoot":"","sources":["../../src/rules/no-async-in-foreach.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAY,MAAM,0BAA0B,CAAC;AASjE,eAAO,MAAM,gBAAgB,mFAkF3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/eslint-plugin",
3
- "version": "29.0.0",
3
+ "version": "30.0.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,17 +14,15 @@
14
14
  "src"
15
15
  ],
16
16
  "dependencies": {
17
- "@typescript-eslint/parser": "~7.15.0",
18
- "@typescript-eslint/type-utils": "^7.15.0",
19
- "@typescript-eslint/utils": "~7.15.0"
17
+ "typescript-eslint": "~8.26.1"
20
18
  },
21
19
  "devDependencies": {
22
- "@types/eslint": "~8.56.3",
23
- "@typescript-eslint/rule-tester": "~7.15.0",
24
- "eslint": "~8.57.0"
20
+ "@types/eslint": "~9.6.1",
21
+ "@typescript-eslint/rule-tester": "~8.26.1",
22
+ "eslint": "~9.23.0"
25
23
  },
26
24
  "peerDependencies": {
27
- "eslint": "~8.57.0",
25
+ "eslint": "~9.23.0",
28
26
  "typescript": ">=5.8.2"
29
27
  },
30
28
  "publishConfig": {
@@ -33,5 +31,5 @@
33
31
  "cli": {
34
32
  "webpack": false
35
33
  },
36
- "gitHead": "67b2763ad7c21532ea47c920974f87e8de433d32"
34
+ "gitHead": "e182cbb85cf66d62f235a9ca172fc04dc705fd0a"
37
35
  }
package/src/index.ts CHANGED
@@ -1,20 +1,54 @@
1
1
  import { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint';
2
- import { Rule } from 'eslint';
2
+ import { Linter, Rule } from 'eslint';
3
+
3
4
  import { noAsyncInForEach } from './rules/no-async-in-foreach';
4
5
  import { useDeclareWithDecorators } from './rules/decorators-declare';
5
6
  import { mobxUseMakeObservableWithDecorators } from './rules/mobx/use-makeObservable-with-decorators';
6
7
  import { mobxNoAbstractDecorators } from './rules/mobx/no-abstract-decorators';
7
8
  import { reactDestructureDefaultImport } from './rules/react/destructure-default-import';
8
9
  import { reactNoQualifiedType } from './rules/react/no-qualified-type';
9
- import { stub } from './processors/stub';
10
10
 
11
- export const rules: Record<string, Rule.RuleModule | AnyRuleModule> = {
12
- 'mobx/use-makeObservable-with-decorators': mobxUseMakeObservableWithDecorators,
13
- 'mobx/no-abstract-decorators': mobxNoAbstractDecorators,
14
- 'react/destructure-default-import': reactDestructureDefaultImport,
15
- 'react/no-qualified-type': reactNoQualifiedType,
16
- 'no-async-in-foreach': noAsyncInForEach,
17
- 'use-declare-with-decorators': useDeclareWithDecorators,
11
+ export const rules: Record<
12
+ 'base' | 'mobx' | 'react',
13
+ Record<string, Rule.RuleModule | AnyRuleModule>
14
+ > = {
15
+ base: {
16
+ 'no-async-in-foreach': noAsyncInForEach,
17
+ 'use-declare-with-decorators': useDeclareWithDecorators,
18
+ },
19
+ mobx: {
20
+ 'use-makeObservable-with-decorators': mobxUseMakeObservableWithDecorators,
21
+ 'no-abstract-decorators': mobxNoAbstractDecorators,
22
+ },
23
+ react: {
24
+ 'destructure-default-import': reactDestructureDefaultImport,
25
+ 'no-qualified-type': reactNoQualifiedType,
26
+ },
27
+ };
28
+
29
+ const plugin = {
30
+ configs: {
31
+ recommended: [
32
+ {
33
+ name: '@servicetitan/eslint-plugin',
34
+ plugins: {
35
+ '@servicetitan': { rules: rules.base },
36
+ '@servicetitan/mobx': { rules: rules.mobx },
37
+ '@servicetitan/react': { rules: rules.react },
38
+ },
39
+ files: ['**/*.ts', '**/*.tsx'],
40
+ rules: {
41
+ '@servicetitan/mobx/no-abstract-decorators': 'error',
42
+ '@servicetitan/mobx/use-makeObservable-with-decorators': 'error',
43
+ '@servicetitan/react/destructure-default-import': 'error',
44
+ '@servicetitan/react/no-qualified-type': 'error',
45
+ '@servicetitan/no-async-in-foreach': 'error',
46
+ '@servicetitan/use-declare-with-decorators': 'error',
47
+ },
48
+ } as Linter.Config,
49
+ ],
50
+ },
18
51
  };
19
52
 
20
- export const processors = { stub };
53
+ // eslint-disable-next-line import/no-default-export
54
+ export default plugin;
@@ -1,4 +1,4 @@
1
- import { Linter } from 'eslint';
1
+ import type { Linter } from 'eslint';
2
2
 
3
3
  export const stub: Linter.LintOptions = {
4
4
  preprocess: () => [''],
@@ -1,12 +1,20 @@
1
+ import { RuleTester } from '@typescript-eslint/rule-tester';
2
+ import typescriptEslintParser from '@typescript-eslint/parser';
1
3
  import path from 'path';
2
- const { RuleTester } = require('@typescript-eslint/rule-tester');
4
+
3
5
  import { noAsyncInForEach } from '../no-async-in-foreach';
4
6
 
7
+ if (!globalThis.structuredClone) {
8
+ globalThis.structuredClone = val => JSON.parse(JSON.stringify(val));
9
+ }
10
+
5
11
  const ruleTester = new RuleTester({
6
- parser: '@typescript-eslint/parser',
7
- parserOptions: {
8
- project: './tsconfig.json',
9
- tsconfigRootDir: path.resolve(__dirname, '../__mocks__/fixture'),
12
+ languageOptions: {
13
+ parser: typescriptEslintParser,
14
+ parserOptions: {
15
+ project: './tsconfig.json',
16
+ tsconfigRootDir: path.resolve(__dirname, '../__mocks__/fixture'),
17
+ },
10
18
  },
11
19
  });
12
20
 
@@ -20,6 +20,7 @@ export const mobxNoAbstractDecorators: Rule.RuleModule = {
20
20
  function checkFn(node: any) {
21
21
  if (node?.decorators?.length) {
22
22
  node.decorators.forEach((decorator: any) => {
23
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
23
24
  const name = decorator?.expression?.name || decorator?.expression?.object?.name;
24
25
 
25
26
  if (name && mobxDecorators.includes(name)) {
@@ -29,6 +29,7 @@ export const mobxUseMakeObservableWithDecorators: Rule.RuleModule = {
29
29
  methodOrProperty.decorators.forEach((decorator: any) => {
30
30
  if (
31
31
  mobxDecorators.includes(
32
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
32
33
  decorator?.expression?.name ||
33
34
  decorator?.expression?.object?.name
34
35
  )