@trackunit/eslint-plugin-trackunit 0.4.64 → 0.4.65

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +38 -27
  3. package/package.json +1 -1
  4. package/src/index.js.map +1 -0
  5. package/src/lib/config/fragments/ignores.js.map +1 -0
  6. package/src/lib/config/fragments/import-rules.js.map +1 -0
  7. package/src/lib/config/fragments/jest-overrides.js.map +1 -0
  8. package/src/lib/config/fragments/jsdoc-rules.js.map +1 -0
  9. package/src/lib/config/fragments/module-boundaries.js.map +1 -0
  10. package/src/lib/config/fragments/react-rules.js.map +1 -0
  11. package/src/lib/config/fragments/restricted-imports.js.map +1 -0
  12. package/src/lib/config/fragments/testing-library.js.map +1 -0
  13. package/src/lib/config/fragments/typescript-rules.js.map +1 -0
  14. package/src/lib/config/index.js.map +1 -0
  15. package/src/lib/config/plugins.js.map +1 -0
  16. package/src/lib/config/presets/base.js.map +1 -0
  17. package/src/lib/config/presets/e2e.js.map +1 -0
  18. package/src/lib/config/presets/react.js.map +1 -0
  19. package/src/lib/config/presets/server.js.map +1 -0
  20. package/src/lib/config/utils.js.map +1 -0
  21. package/src/lib/config-helpers/create-skip-when.js.map +1 -0
  22. package/src/lib/rules/cva-merge-base-classes-as-array/cva-merge-base-classes-as-array.js.map +1 -0
  23. package/src/lib/rules/design-guideline-button-icon-size-match/design-guideline-button-icon-size-match.js.map +1 -0
  24. package/src/lib/rules/no-internal-barrel-files/no-internal-barrel-files.js.map +1 -0
  25. package/src/lib/rules/no-internal-graphql-when-tagged-with-gql-public/no-internal-graphql-when-tagged-with-gql-public.js.map +1 -0
  26. package/src/lib/rules/no-jest-mock-trackunit-react-core-hooks/no-jest-mock-trackunit-react-core-hooks.js.map +1 -0
  27. package/src/lib/rules/no-template-strings-in-classname-prop/no-template-strings-in-classname-prop.js.map +1 -0
  28. package/src/lib/rules/no-typescript-assertion/no-typescript-assertion.js.map +1 -0
  29. package/src/lib/rules/prefer-destructured-imports/prefer-destructured-imports.js.map +1 -0
  30. package/src/lib/rules/prefer-event-specific-callback-naming/name-suggestion-strategies.js.map +1 -0
  31. package/src/lib/rules/prefer-event-specific-callback-naming/prefer-event-specific-callback-naming.js.map +1 -0
  32. package/src/lib/rules/prefer-event-specific-callback-naming/strategies/string-based.js.map +1 -0
  33. package/src/lib/rules/prefer-event-specific-callback-naming/strategies/type-based.js.map +1 -0
  34. package/src/lib/rules/prefer-event-specific-callback-naming/utils.js.map +1 -0
  35. package/src/lib/rules/prefer-field-components/prefer-field-components.js.map +1 -0
  36. package/src/lib/rules/prefer-mouse-event-handler-in-react-props/prefer-mouse-event-handler-in-react-props.js.map +1 -0
  37. package/src/lib/rules/require-classname-alternatives/require-classname-alternatives.js.map +1 -0
  38. package/src/lib/rules/require-list-item-virtualization-props/require-list-item-virtualization-props.js.map +1 -0
  39. package/src/lib/rules/require-optional-prop-initialization/require-optional-prop-initialization.js.map +1 -0
  40. package/src/lib/rules/require-optional-prop-initialization/suggestion-utils.js.map +1 -0
  41. package/src/lib/rules-map.js.map +1 -0
  42. package/src/lib/utils/ast-utils.js.map +1 -0
  43. package/src/lib/utils/classname-utils.js.map +1 -0
  44. package/src/lib/utils/file-utils.js.map +1 -0
  45. package/src/lib/utils/import-utils.js.map +1 -0
  46. package/src/lib/utils/nx-utils.js.map +1 -0
  47. package/src/lib/utils/package-utils.js.map +1 -0
  48. package/src/lib/utils/typescript-utils.js.map +1 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.65 (2026-05-01)
2
+
3
+ This was a version bump only for eslint-plugin-trackunit to align it with other projects, there were no code changes.
4
+
1
5
  ## 0.4.64 (2026-04-30)
2
6
 
3
7
  ### 🧱 Updated Dependencies
package/README.md CHANGED
@@ -18,10 +18,12 @@ module.exports = [...configs.base, ...configs.react];
18
18
 
19
19
  ## Presets
20
20
 
21
- | Preset | Purpose | Includes |
22
- |--------|---------|----------|
23
- | `configs.base` | Foundation for every project | TypeScript, import, module-boundary, JSDoc, and custom Trackunit rules |
24
- | `configs.react` | React / browser applications | React, React Hooks, Storybook, Jest + Testing Library overrides |
21
+
22
+ | Preset | Purpose | Includes |
23
+ | --------------- | ---------------------------- | ---------------------------------------------------------------------- |
24
+ | `configs.base` | Foundation for every project | TypeScript, import, module-boundary, JSDoc, and custom Trackunit rules |
25
+ | `configs.react` | React / browser applications | React, React Hooks, Storybook, Jest + Testing Library overrides |
26
+
25
27
 
26
28
  ### Combining Presets
27
29
 
@@ -40,37 +42,45 @@ All custom rules are enabled automatically through the presets under the `@track
40
42
 
41
43
  ### Code Quality
42
44
 
43
- | Rule | Severity | Auto-fix | Description |
44
- |------|----------|----------|-------------|
45
- | `@trackunit/no-typescript-assertion` | warn | | Disallows `as`, angle-bracket, and `!` type assertions. `as const` and `as unknown` are allowed. |
46
- | `@trackunit/no-internal-barrel-files` | error | — | Prevents internal `index.ts` barrel files that are not at the library root. |
47
- | `@trackunit/prefer-destructured-imports` | — | yes | Converts namespace imports (`import * as Foo`) to named imports for configured packages. |
45
+
46
+ | Rule | Severity | Auto-fix | Description |
47
+ | ---------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------ |
48
+ | `@trackunit/no-typescript-assertion` | warn | — | Disallows `as`, angle-bracket, and `!` type assertions. `as const` and `as unknown` are allowed. |
49
+ | `@trackunit/no-internal-barrel-files` | error | — | Prevents internal `index.ts` barrel files that are not at the library root. |
50
+ | `@trackunit/prefer-destructured-imports` | — | yes | Converts namespace imports (`import * as Foo`) to named imports for configured packages. |
51
+
48
52
 
49
53
  ### React & JSX
50
54
 
51
- | Rule | Severity | Auto-fix | Description |
52
- |------|----------|----------|-------------|
53
- | `@trackunit/no-template-strings-in-classname-prop` | | | Disallows template literals in `className`. Use `twMerge()` or `cvaMerge()` instead. |
54
- | `@trackunit/require-classname-alternatives` | — | yes | Replaces banned class names with approved alternatives. |
55
- | `@trackunit/cva-merge-base-classes-as-array` | — | yes | Enforces array syntax for `cvaMerge` base classes when more than one class is used. |
56
- | `@trackunit/design-guideline-button-icon-size-match` | — | yes | Ensures `Icon` inside `Button` uses the correct `size` prop. |
57
- | `@trackunit/prefer-field-components` | — | yes | Prefers `SelectField`/`TextField` over manually combining `Label` + base input components. |
58
- | `@trackunit/prefer-mouse-event-handler-in-react-props` | — | | Enforces `MouseEventHandler<T>` typing for `onClick*` props. |
59
- | `@trackunit/prefer-event-specific-callback-naming` | — | — | Enforces event-specific naming (e.g. `onClickClose` over `onClose`) for click handlers. |
60
- | `@trackunit/require-optional-prop-initialization` | — | — | Requires optional component props to be initialized inside the component. |
61
- | `@trackunit/require-list-item-virtualization-props` | — | — | Requires `VirtualizationListItemProps` on list items inside `<List>`. |
55
+
56
+ | Rule | Severity | Auto-fix | Description |
57
+ | ------------------------------------------------------ | -------- | -------- | ------------------------------------------------------------------------------------------ |
58
+ | `@trackunit/no-template-strings-in-classname-prop` | | — | Disallows template literals in `className`. Use `twMerge()` or `cvaMerge()` instead. |
59
+ | `@trackunit/require-classname-alternatives` | — | yes | Replaces banned class names with approved alternatives. |
60
+ | `@trackunit/cva-merge-base-classes-as-array` | — | yes | Enforces array syntax for `cvaMerge` base classes when more than one class is used. |
61
+ | `@trackunit/design-guideline-button-icon-size-match` | — | yes | Ensures `Icon` inside `Button` uses the correct `size` prop. |
62
+ | `@trackunit/prefer-field-components` | — | yes | Prefers `SelectField`/`TextField` over manually combining `Label` + base input components. |
63
+ | `@trackunit/prefer-mouse-event-handler-in-react-props` | — | — | Enforces `MouseEventHandler<T>` typing for `onClick*` props. |
64
+ | `@trackunit/prefer-event-specific-callback-naming` | — | — | Enforces event-specific naming (e.g. `onClickClose` over `onClose`) for click handlers. |
65
+ | `@trackunit/require-optional-prop-initialization` | — | — | Requires optional component props to be initialized inside the component. |
66
+ | `@trackunit/require-list-item-virtualization-props` | — | — | Requires `VirtualizationListItemProps` on list items inside `<List>`. |
67
+
62
68
 
63
69
  ### Testing
64
70
 
65
- | Rule | Severity | Auto-fix | Description |
66
- |------|----------|----------|-------------|
67
- | `@trackunit/no-jest-mock-trackunit-react-core-hooks` | | | Disallows `jest.mock("@trackunit/react-core-hooks")`. Use `trackunitProviders()` mock builders instead. |
71
+
72
+ | Rule | Severity | Auto-fix | Description |
73
+ | ---------------------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------- |
74
+ | `@trackunit/no-jest-mock-trackunit-react-core-hooks` | — | — | Disallows `jest.mock("@trackunit/react-core-hooks")`. Use `trackunitProviders()` mock builders instead. |
75
+
68
76
 
69
77
  ### NX / Monorepo
70
78
 
71
- | Rule | Severity | Auto-fix | Description |
72
- |------|----------|----------|-------------|
73
- | `@trackunit/no-internal-graphql-when-tagged-with-gql-public` | error | | Prevents internal GraphQL usage in projects tagged with `gql-public`. Applied to `project.json` files. |
79
+
80
+ | Rule | Severity | Auto-fix | Description |
81
+ | ------------------------------------------------------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------ |
82
+ | `@trackunit/no-internal-graphql-when-tagged-with-gql-public` | error | — | Prevents internal GraphQL usage in projects tagged with `gql-public`. Applied to `project.json` files. |
83
+
74
84
 
75
85
  ## Utilities
76
86
 
@@ -111,7 +121,8 @@ const root = findMonorepoRoot();
111
121
  For more info and a full guide on Iris App SDK Development, please visit our [Developer Hub](https://developers.trackunit.com/).
112
122
 
113
123
  ## Trackunit
124
+
114
125
  This package was developed by Trackunit ApS.
115
126
  Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
116
127
 
117
- ![The Trackunit logo](https://trackunit.com/wp-content/uploads/2022/03/top-logo.svg)
128
+ ![The Trackunit logo](https://trackunit.com/wp-content/uploads/2022/03/top-logo.svg)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/eslint-plugin-trackunit",
3
- "version": "0.4.64",
3
+ "version": "0.4.65",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/eslint/plugin-trackunit/src/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,kBAAe,oBAAQ,CAAC;AAExB,uCAAuC;AAA9B,iGAAA,OAAO,OAAA;AAChB,0EAAuE;AAA9D,kHAAA,cAAc,OAAA;AACvB,4CAAsD;AAA7C,yGAAA,gBAAgB,OAAA;AAGzB,kEAAsE;AAA7D,+GAAA,gBAAgB,OAAA;AACzB,gDAAgF;AAAvE,kGAAA,OAAO,OAAA;AAAE,gGAAA,KAAK,OAAA;AAAE,6FAAA,EAAE,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,mGAAA,QAAQ,OAAA","sourcesContent":["import { rulesMap } from \"./lib/rules-map\";\n\nexport default rulesMap;\n\nexport { configs } from \"./lib/config\";\nexport { createSkipWhen } from \"./lib/config-helpers/create-skip-when\";\nexport { findMonorepoRoot } from \"./lib/config/utils\";\nexport type { MatchCriteria, ProjectMetadata } from \"./lib/utils/nx-utils\";\n\nexport { strictJsdocRules } from \"./lib/config/fragments/jsdoc-rules\";\nexport { globals, jsdoc, nx, reactHooks, tsParser } from \"./lib/config/plugins\";\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignores.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/ignores.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAkB;IAC1C,OAAO,EAAE;QACP,oBAAoB;QACpB,qBAAqB;QACrB,kBAAkB;QAClB,sBAAsB;QACtB,kBAAkB;QAClB,iBAAiB;QACjB,4BAA4B;QAC5B,uBAAuB;QACvB,cAAc;QACd,eAAe;KAChB;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\n\nexport const globalIgnores: Linter.Config = {\n ignores: [\n \"**/src/gql-api.tsx\",\n \"**/src/typings/**/*\",\n \"**/testUtils.tsx\",\n \"**/webpack.config.js\",\n \"**/jest.config.*\",\n \"**/jest.setup.*\",\n \"**/src/**/generated/**/*.*\",\n \"**/src/**/generated.*\",\n \"**/dist/**/*\",\n \"**/*.docs.mdx\",\n ],\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-rules.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/import-rules.ts"],"names":[],"mappings":";;;AACA,4EAAuE;AACvE,wCAA0C;AAE7B,QAAA,WAAW,GAAuB;IAC7C,mBAAmB,EAAE;QACnB,OAAO;QACP;YACE,cAAc,EAAE,IAAI;SACrB;KACF;IACD,gBAAgB,EAAE,KAAK;CACxB,CAAC;AAEK,MAAM,wCAAwC,GAAG,CAAC,OAAe,EAAiB,EAAE,CACzF,IAAA,iCAAc,EAAC;IACb,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE;IAC9B,OAAO,EAAE;QACP,UAAU,EAAE,sBAAY;KACzB;IACD,KAAK,EAAE;QACL,qCAAqC,EAAE;YACrC,OAAO;YACP;gBACE,UAAU,EAAE,OAAO;gBACnB,eAAe,EAAE;oBACf,kBAAkB;oBAClB,eAAe;oBACf,oBAAoB;oBACpB,oBAAoB;oBACpB,iBAAiB;oBACjB,YAAY;oBACZ,aAAa;oBACb,eAAe;oBACf,kBAAkB;oBAClB,kBAAkB;oBAClB,iBAAiB;oBACjB,iBAAiB;oBACjB,mBAAmB;oBACnB,0BAA0B;oBAC1B,uBAAuB;oBACvB,4BAA4B;oBAC5B,kBAAkB;oBAClB,eAAe;oBACf,aAAa;oBACb,6BAA6B;oBAC7B,oBAAoB;oBACpB,6CAA6C;oBAC7C,4BAA4B;iBAC7B;gBACD,oBAAoB,EAAE,KAAK;gBAC3B,gBAAgB,EAAE,IAAI;gBACtB,mBAAmB,EAAE,IAAI;aAC1B;SACF;KACF;CACF,CAAC,CAAC;AA1CQ,QAAA,wCAAwC,4CA0ChD","sourcesContent":["import type { Linter } from \"eslint\";\nimport { createSkipWhen } from \"../../config-helpers/create-skip-when\";\nimport { importPlugin } from \"../plugins\";\n\nexport const importRules: Linter.RulesRecord = {\n \"import-x/no-cycle\": [\n \"error\",\n {\n ignoreExternal: true,\n },\n ],\n \"import-x/first\": \"off\",\n};\n\nexport const createImportExtraneousDependenciesConfig = (rootDir: string): Linter.Config =>\n createSkipWhen({\n when: { tags: [\"scope:tool\"] },\n plugins: {\n \"import-x\": importPlugin,\n },\n rules: {\n \"import-x/no-extraneous-dependencies\": [\n \"error\",\n {\n packageDir: rootDir,\n devDependencies: [\n \"**/*.cy.{ts,tsx}\",\n \"**/cypress/**\",\n \"**/*.spec.{ts,tsx}\",\n \"**/*.test.{ts,tsx}\",\n \"**/jest.setup.*\",\n \"**/test/**\",\n \"**/tests/**\",\n \"**/testing/**\",\n \"**/test-setup/**\",\n \"**/test-utils/**\",\n \"**/__tests__/**\",\n \"**/__mocks__/**\",\n \"**/mocks.{ts,tsx}\",\n \"**/core-contexts-test/**\",\n \"**/*.stories.{ts,tsx}\",\n \"**/storybookUtils.{ts,tsx}\",\n \"**/.storybook/**\",\n \"**/scripts/**\",\n \"**/tools/**\",\n \"**/*.config.{ts,js,cjs,mjs}\",\n \"**/css/tailwind/**\",\n \"**/css/tailwind-custom-properties-plugin/**\",\n \"**/css/component-tokens/**\",\n ],\n optionalDependencies: false,\n peerDependencies: true,\n bundledDependencies: true,\n },\n ],\n },\n });\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest-overrides.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/jest-overrides.ts"],"names":[],"mappings":";;;AACA,wCAAkD;AAErC,QAAA,iBAAiB,GAAkB;IAC9C,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;IACxC,eAAe,EAAE;QACf,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE;YACb,OAAO,EAAE,CAAC,oBAAoB,CAAC;SAChC;KACF;IAED,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;QACJ,iBAAiB,EAAE,wBAAc;KAClC;IAED,KAAK,EAAE;QACL,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;QACjC,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK;QAC3B,oCAAoC,EAAE,KAAK;QAC3C,sCAAsC,EAAE,KAAK;QAC7C,0CAA0C,EAAE,KAAK;QACjD,oCAAoC,EAAE,KAAK;QAC3C,oDAAoD,EAAE,OAAO;QAC7D,YAAY,EAAE,KAAK;QACnB,+CAA+C,EAAE,KAAK;KACvD;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\nimport { jest, testingLibrary } from \"../plugins\";\n\nexport const baseJestOverrides: Linter.Config = {\n files: [\"**/*.spec.ts\", \"**/*.spec.tsx\"],\n languageOptions: {\n ecmaVersion: 5,\n sourceType: \"script\",\n parserOptions: {\n project: [\"./tsconfig.*?.json\"],\n },\n },\n\n plugins: {\n jest,\n \"testing-library\": testingLibrary,\n },\n\n rules: {\n ...jest.configs.recommended.rules,\n ...jest.configs.style.rules,\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n \"@trackunit/no-typescript-assertion\": \"off\",\n \"@trackunit/no-jest-mock-trackunit-react-core-hooks\": \"error\",\n \"no-console\": \"off\",\n \"@typescript-eslint/strict-boolean-expressions\": \"off\",\n },\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsdoc-rules.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/jsdoc-rules.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAuB;IACjD,iBAAiB,EAAE;QACjB,OAAO;QACP,OAAO;QACP;YACE,UAAU,EAAE,CAAC;S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"eslint\";\n\nexport const basicJsdocRules: Linter.RulesRecord = {\n \"jsdoc/tag-lines\": [\n \"error\",\n \"never\",\n {\n startLines: 1,\n },\n ],\n \"jsdoc/check-alignment\": \"error\",\n \"prefer-arrow-functions\": \"off\",\n \"jsdoc/check-indentation\": \"off\",\n \"jsdoc/no-restricted-syntax\": [\n \"error\",\n {\n contexts: [\n {\n comment: \"JsdocBlock:has(JsdocTag[tag=/type/])\",\n context: \"any\",\n message: \"Projects should not use @type annotation in JSDocs.\",\n },\n ],\n },\n ],\n};\n\nexport const strictJsdocRules: Linter.RulesRecord = {\n \"jsdoc/require-jsdoc\": [\n \"error\",\n {\n publicOnly: true,\n\n require: {\n ArrowFunctionExpression: true,\n ClassDeclaration: true,\n FunctionDeclaration: true,\n FunctionExpression: true,\n MethodDefinition: true,\n },\n },\n ],\n\n \"jsdoc/no-undefined-types\": [\n \"error\",\n {\n definedTypes: [\"JSX\"],\n },\n ],\n\n \"jsdoc/check-param-names\": \"error\",\n \"jsdoc/require-returns-type\": \"error\",\n \"jsdoc/valid-types\": \"error\",\n \"jsdoc/require-param-description\": \"error\",\n \"jsdoc/check-access\": \"error\",\n \"jsdoc/check-property-names\": \"error\",\n \"jsdoc/check-tag-names\": \"error\",\n \"jsdoc/check-types\": \"error\",\n \"jsdoc/check-values\": \"error\",\n \"jsdoc/check-alignment\": \"error\",\n \"jsdoc/empty-tags\": \"error\",\n \"jsdoc/implements-on-classes\": \"error\",\n \"jsdoc/multiline-blocks\": \"error\",\n \"jsdoc/no-multi-asterisks\": \"error\",\n \"jsdoc/require-property\": \"error\",\n \"jsdoc/require-property-description\": \"error\",\n \"jsdoc/require-property-name\": \"error\",\n \"jsdoc/require-property-type\": \"error\",\n \"jsdoc/require-returns-check\": \"error\",\n \"jsdoc/require-returns-description\": \"error\",\n \"jsdoc/require-yields\": \"error\",\n \"jsdoc/require-yields-check\": \"error\",\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-boundaries.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/module-boundaries.ts"],"names":[],"mappings":";;;AAEa,QAAA,mBAAmB,GAAuB;IACrD,+BAA+B,EAAE;QAC/B,OAAO;QACP;YACE,KAAK,EAAE,EAAE;YAET,cAAc,EAAE;gBACd;oBACE,SAAS,EAAE,UAAU;oBACrB,wBAAwB,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAE,cAAc,CAAC;oBAC1E,qBAAqB,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;iBACpD;gBACD;oBACE,SAAS,EAAE,gBAAgB;oBAC3B,wBAAwB,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;oBACxD,qBAAqB,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;iBACpD;gBACD;oBACE,SAAS,EAAE,YAAY;oBACvB,wBAAwB,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;oBACxD,qBAAqB,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC;iBACpD;gBACD;oBACE,SAAS,EAAE,cAAc;oBACzB,wBAAwB,EAAE,CAAC,cAAc,CAAC;oBAC1C,qBAAqB,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;iBAC7C;gBACD;oBACE,SAAS,EAAE,WAAW;oBACtB,wBAAwB,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC;iBAC3D;gBACD;oBACE,SAAS,EAAE,cAAc;oBACzB,wBAAwB,EAAE,CAAC,cAAc,CAAC;iBAC3C;gBACD;oBACE,SAAS,EAAE,YAAY;oBACvB,wBAAwB,EAAE,CAAC,YAAY,CAAC;iBACzC;gBACD;oBACE,SAAS,EAAE,cAAc;oBACzB,wBAAwB,EAAE,CAAC,cAAc,CAAC;iBAC3C;gBACD;oBACE,SAAS,EAAE,iBAAiB;oBAC5B,wBAAwB,EAAE,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;iBACnE;gBACD;oBACE,SAAS,EAAE,qBAAqB;oBAChC,wBAAwB,EAAE,CAAC,qBAAqB,EAAE,mBAAmB,CAAC;iBACvE;gBACD;oBACE,SAAS,EAAE,mBAAmB;oBAC9B,wBAAwB,EAAE,CAAC,mBAAmB,CAAC;iBAChD;gBACD;oBACE,SAAS,EAAE,4BAA4B;oBACvC,uBAAuB,EAAE,CAAC,YAAY,CAAC;iBACxC;gBACD;oBACE,SAAS,EAAE,cAAc;iBAC1B;gBACD;oBACE,SAAS,EAAE,YAAY;iBACxB;gBACD;oBACE,SAAS,EAAE,OAAO;iBACnB;gBACD;oBACE,SAAS,EAAE,OAAO;iBACnB;gBACD;oBACE,SAAS,EAAE,OAAO;iBACnB;gBACD;oBACE,SAAS,EAAE,OAAO;iBACnB;gBACD;oBACE,SAAS,EAAE,aAAa;oBACxB,wBAAwB,EAAE,CAAC,aAAa,CAAC;oBACzC,qBAAqB,EAAE,CAAC,WAAW,CAAC;oBACpC,uBAAuB,EAAE,CAAC,YAAY,CAAC;iBACxC;aACF;YAED,6BAA6B,EAAE,IAAI;YACnC,yBAAyB,EAAE,IAAI;SAChC;KACF;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\n\nexport const moduleBoundaryRules: Linter.RulesRecord = {\n \"@nx/enforce-module-boundaries\": [\n \"error\",\n {\n allow: [],\n\n depConstraints: [\n {\n sourceTag: \"type:app\",\n onlyDependOnLibsWithTags: [\"type:extension\", \"type:react\", \"type:vanilla\"],\n bannedExternalImports: [\"i18next\", \"react-i18next\"],\n },\n {\n sourceTag: \"type:extension\",\n onlyDependOnLibsWithTags: [\"type:react\", \"type:vanilla\"],\n bannedExternalImports: [\"i18next\", \"react-i18next\"],\n },\n {\n sourceTag: \"type:react\",\n onlyDependOnLibsWithTags: [\"type:react\", \"type:vanilla\"],\n bannedExternalImports: [\"i18next\", \"react-i18next\"],\n },\n {\n sourceTag: \"type:vanilla\",\n onlyDependOnLibsWithTags: [\"type:vanilla\"],\n bannedExternalImports: [\"i18next\", \"react*\"],\n },\n {\n sourceTag: \"scope:app\",\n onlyDependOnLibsWithTags: [\"scope:client\", \"scope:server\"],\n },\n {\n sourceTag: \"scope:client\",\n onlyDependOnLibsWithTags: [\"scope:client\"],\n },\n {\n sourceTag: \"scope:tool\",\n onlyDependOnLibsWithTags: [\"scope:tool\"],\n },\n {\n sourceTag: \"scope:server\",\n onlyDependOnLibsWithTags: [\"scope:server\"],\n },\n {\n sourceTag: \"visibility:host\",\n onlyDependOnLibsWithTags: [\"visibility:host\", \"visibility:shared\"],\n },\n {\n sourceTag: \"visibility:iris-app\",\n onlyDependOnLibsWithTags: [\"visibility:iris-app\", \"visibility:shared\"],\n },\n {\n sourceTag: \"visibility:shared\",\n onlyDependOnLibsWithTags: [\"visibility:shared\"],\n },\n {\n sourceTag: \"dependencies:no-deprecated\",\n notDependOnLibsWithTags: [\"deprecated\"],\n },\n {\n sourceTag: \"gql:internal\",\n },\n {\n sourceTag: \"gql:public\",\n },\n {\n sourceTag: \"tier1\",\n },\n {\n sourceTag: \"tier2\",\n },\n {\n sourceTag: \"tier3\",\n },\n {\n sourceTag: \"tier4\",\n },\n {\n sourceTag: \"publish:npm\",\n onlyDependOnLibsWithTags: [\"publish:npm\"],\n bannedExternalImports: [\"@sentry/*\"],\n notDependOnLibsWithTags: [\"deprecated\"],\n },\n ],\n\n enforceBuildableLibDependency: true,\n banTransitiveDependencies: true,\n },\n ],\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-rules.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/react-rules.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAuB;IAC5C,4BAA4B,EAAE,OAAO;IACrC,6BAA6B,EAAE,OAAO;IAEtC,oBAAoB,EAAE,OAAO;IAC7B,8BAA8B,EAAE,OAAO;IACvC,sCAAsC,EAAE,OAAO;IAC/C,oBAAoB,EAAE,OAAO;IAC7B,qBAAqB,EAAE,OAAO;IAC9B,iCAAiC,EAAE,OAAO;IAC1C,sBAAsB,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,kBAAkB,CAAC;IAC9C,KAAK,EAAE;QACL,qBAAqB,EAAE,KAAK;QAC5B,YAAY,EAAE,KAAK;QACnB,sCAAsC,EAAE,KAAK;KAC9C;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\n\nexport const reactRules: Linter.RulesRecord = {\n \"react-hooks/rules-of-hooks\": \"error\",\n \"react-hooks/exhaustive-deps\": \"error\",\n\n \"react-hooks/config\": \"error\",\n \"react-hooks/error-boundaries\": \"error\",\n \"react-hooks/component-hook-factories\": \"error\",\n \"react-hooks/gating\": \"error\",\n \"react-hooks/globals\": \"error\",\n \"react-hooks/set-state-in-render\": \"error\",\n \"react-hooks/use-memo\": \"error\",\n \"react/self-closing-comp\": \"error\",\n \"react-hooks/unsupported-syntax\": \"error\",\n \"react-hooks/static-components\": \"error\",\n \"react-hooks/purity\": \"error\",\n\n \"react-hooks/immutability\": \"warn\",\n \"react/no-unstable-nested-components\": \"warn\",\n \"react-hooks/refs\": \"warn\",\n \"react-hooks/set-state-in-effect\": \"warn\",\n \"react-hooks/preserve-manual-memoization\": \"warn\",\n \"react-hooks/incompatible-library\": \"warn\",\n\n \"react/jsx-curly-brace-presence\": [\n \"error\",\n {\n children: \"never\",\n propElementValues: \"always\",\n props: \"never\",\n },\n ],\n\n \"react/jsx-key\": \"error\",\n \"react/jsx-no-leaked-render\": \"error\",\n \"react/jsx-uses-react\": \"error\",\n \"react/jsx-uses-vars\": \"error\",\n \"react/no-danger\": \"error\",\n \"react/no-unused-prop-types\": \"error\",\n \"react/jsx-sort-props\": \"error\",\n\n \"react/no-children-prop\": [\n \"error\",\n {\n allowFunctions: false,\n },\n ],\n};\n\nexport const reactCustomRules: Linter.RulesRecord = {\n \"@trackunit/no-template-strings-in-classname-prop\": \"error\",\n \"@trackunit/require-classname-alternatives\": [\n \"error\",\n {\n alternatives: {\n slate: [\"neutral\"],\n gray: [\"neutral\"],\n zinc: [\"neutral\"],\n stone: [\"neutral\"],\n teal: [\"cyan\"],\n purple: [\"violet\"],\n fuchsia: [\"pink\"],\n red: [\"danger\"],\n yellow: [\"warning\"],\n green: [\"success\"],\n emerald: [\"success\"],\n amber: [\"warning\", \"low\", \"idle\"],\n sky: [\"primary\", \"info\"],\n blue: [\"primary\", \"info\", \"working\", \"utilized\"],\n indigo: [\"primary\", \"violet\"],\n rose: [\"danger\", \"pink\"],\n },\n prefixes: [\n \"bg\",\n \"text\",\n \"border\",\n \"border-t\",\n \"border-r\",\n \"border-b\",\n \"border-l\",\n \"border-x\",\n \"border-y\",\n \"ring\",\n \"ring-offset\",\n \"outline\",\n \"divide\",\n \"shadow\",\n \"accent\",\n \"caret\",\n \"fill\",\n \"stroke\",\n \"decoration\",\n \"placeholder\",\n \"from\",\n \"via\",\n \"to\",\n ],\n },\n ],\n \"@trackunit/require-list-item-virtualization-props\": \"error\",\n \"@trackunit/cva-merge-base-classes-as-array\": \"error\",\n \"@trackunit/design-guideline-button-icon-size-match\": \"error\",\n \"@trackunit/prefer-destructured-imports\": [\n \"error\",\n {\n packages: {\n react: \"React\",\n },\n },\n ],\n \"@trackunit/require-optional-prop-initialization\": \"error\",\n \"@trackunit/prefer-event-specific-callback-naming\": [\n \"error\",\n {\n events: [\"onClick\", \"onSubmit\", \"onDoubleClick\"],\n },\n ],\n \"@trackunit/prefer-mouse-event-handler-in-react-props\": [\n \"error\",\n {\n allowedNames: [\"onClickClose\"],\n },\n ],\n \"@trackunit/prefer-field-components\": \"error\",\n};\n\nexport const reactTestingLibraryOverrides: Linter.Config = {\n files: [\"**/*.spec.ts\", \"**/*.spec.tsx\"],\n rules: {\n \"jest/no-commented-out-tests\": \"error\",\n \"jest/expect-expect\": \"error\",\n },\n};\n\nexport const reactStoryOverrides: Linter.Config = {\n files: [\"**/*.stories.ts\", \"**/*.stories.tsx\"],\n rules: {\n \"jsdoc/require-jsdoc\": \"off\",\n \"no-console\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n },\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restricted-imports.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/restricted-imports.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAuB;IACvD,uBAAuB,EAAE;QACvB,OAAO;QACP;YACE,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,sBAAsB;oBAC5B,OAAO,EAAE,2DAA2D;iBACrE;gBACD;oBACE,IAAI,EAAE,eAAe;oBACrB,WAAW,EAAE,CAAC,gBAAgB,CAAC;oBAC/B,OAAO,EAAE,gFAAgF;iBAC1F;gBACD;oBACE,IAAI,EAAE,eAAe;oBACrB,WAAW,EAAE,CAAC,OAAO,CAAC;oBACtB,OAAO,EAAE,uEAAuE;iBACjF;gBACD;oBACE,IAAI,EAAE,gBAAgB;oBACtB,WAAW,EAAE,CAAC,UAAU,EAAE,cAAc,CAAC;oBACzC,OAAO,EACL,mHAAmH;iBACtH;gBACD;oBACE,IAAI,EAAE,oBAAoB;oBAC1B,OAAO,EAAE,+EAA+E;iBACzF;gBACD;oBACE,IAAI,EAAE,2BAA2B;oBACjC,OAAO,EAAE,8DAA8D;iBACxE;gBACD;oBACE,IAAI,EAAE,6BAA6B;oBACnC,OAAO,EAAE,8DAA8D;iBACxE;gBACD;oBACE,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EACL,0HAA0H;iBAC7H;aACF;YAED,QAAQ,EAAE;gBACR;oBACE,KAAK,EAAE,CAAC,WAAW,CAAC;oBACpB,OAAO,EAAE,sFAAsF;iBAChG;gBACD;oBACE,KAAK,EAAE,CAAC,cAAc,CAAC;oBACvB,OAAO,EAAE,sFAAsF;iBAChG;aACF;SACF;KACF;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\n\nexport const restrictedImportRules: Linter.RulesRecord = {\n \"no-restricted-imports\": [\n \"error\",\n {\n paths: [\n {\n name: \"react-dom/test-utils\",\n message: \"Please use 'act' from the @testing-library/react instead.\",\n },\n {\n name: \"react-i18next\",\n importNames: [\"useTranslation\"],\n message: \"Please import useTranslation from @trackunit/i18n-manager-translation instead.\",\n },\n {\n name: \"react-i18next\",\n importNames: [\"Trans\"],\n message: \"Please import Trans from @trackunit/i18n-manager-translation instead.\",\n },\n {\n name: \"@apollo/client\",\n importNames: [\"useQuery\", \"useLazyQuery\"],\n message:\n \"Please import the same from @trackunit/react-graphql-hooks instead, to ensure loading state is handled correctly.\",\n },\n {\n name: \"@nx/plugin/testing\",\n message: \"Please import it from @trackunit/nx-utils instead or expose it from that lib.\",\n },\n {\n name: \"@heroicons/react/20/solid\",\n message: \"Please use the Icon component from react-components instead.\",\n },\n {\n name: \"@heroicons/react/24/outline\",\n message: \"Please use the Icon component from react-components instead.\",\n },\n {\n name: \"class-variance-authority\",\n message:\n \"Import our wrappers from, @trackunit/css-class-variance-utilities or twMerge instead. [cva -> cvaMerge], [cx -> twMerge]\",\n },\n ],\n\n patterns: [\n {\n group: [\"date-fns*\"],\n message: \"Please use @trackunit/date-and-time-utils or @trackunit/date-and-time-hooks instead.\",\n },\n {\n group: [\"date-fns-tz*\"],\n message: \"Please use @trackunit/date-and-time-utils or @trackunit/date-and-time-hooks instead.\",\n },\n ],\n },\n ],\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing-library.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/testing-library.ts"],"names":[],"mappings":";;;AACA,wCAA4C;AAE5C,MAAM,WAAW,GAAG,wBAAc,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;AAEhD,QAAA,wBAAwB,GAAuB,MAAM,CAAC,WAAW,CAC5E,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAuC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAC3G,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\nimport { testingLibrary } from \"../plugins\";\n\nconst configRules = testingLibrary.configs.react.rules ?? {};\n\nexport const reactTestingLibraryRules: Linter.RulesRecord = Object.fromEntries(\n Object.entries(configRules).filter((entry): entry is [string, Linter.RuleEntry] => entry[1] !== undefined)\n);\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-rules.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/typescript-rules.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAuB;IACjD,oCAAoC,EAAE,OAAO;IAC7C,wCAAwC,EAAE,OAAO;IACjD,uCAAuC,EAAE,OAAO;IAChD,6CAA6C,EAAE,OAAO;IACtD,gBAAgB,EAAE,KAAK;IACvB,mCAAmC,EAAE;QACnC,MAAM;QACN;YACE,IAAI,EAAE,KAAK;YACX,iBAAiB,EAAE,IAAI;YACvB,YAAY,EAAE,KAAK;YACnB,yBAAyB,EAAE,IAAI;YAC/B,8BAA8B,EAAE,IAAI;YACpC,iBAAiB,EAAE,IAAI;YACvB,kBAAkB,EAAE,IAAI;SACzB;KACF;IACD,+BAA+B,EAAE;QAC/B,OAAO;QACP;YACE,OAAO,EAAE,SAAS;SACnB;KACF;IACD,iCAAiC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IACvE,8BAA8B,EAAE;QAC9B,OAAO;QACP;YACE,KAAK,EAAE,KAAK;SACb;KACF;IACD,+CAA+C,EAAE;QAC/C,MAAM;QACN;YACE,oBAAoB,EAAE,IAAI;YAC1B,mBAAmB,EAAE,IAAI;SAC1B;KACF;IACD,sCAAsC,EAAE;QACtC,OAAO;QACP;YACE,QAAQ,EAAE,WAAW;YACrB,MAAM,EAAE,CAAC,YAAY,CAAC;YAEtB,MAAM,EAAE;gBACN,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,KAAK;aACb;SACF;QACD;YACE,QAAQ,EAAE,eAAe;YACzB,MAAM,EAAE,CAAC,YAAY,CAAC;YAEtB,MAAM,EAAE;gBACN,KAAK,EAAE,2BAA2B;gBAClC,KAAK,EAAE,IAAI;aACZ;SACF;KACF;IACD,0CAA0C,EAAE,MAAM;IAClD,sCAAsC,EAAE,OAAO;IAC/C,0CAA0C,EAAE,OAAO;IACnD,iCAAiC,EAAE,OAAO;IAC1C,mCAAmC,EAAE,MAAM;IAC3C,mCAAmC,EAAE,MAAM;IAC3C,oCAAoC,EAAE,OAAO;IAC7C,yCAAyC,EAAE,OAAO;IAClD,yCAAyC,EAAE,OAAO;IAClD,kDAAkD,EAAE;QAClD,OAAO;QACP;YACE,aAAa,EAAE,UAAU;YACzB,SAAS,EAAE;gBACT,SAAS,EAAE,UAAU;gBACrB,YAAY,EAAE,UAAU;gBACxB,mBAAmB,EAAE,UAAU;aAChC;SACF;KACF;IACD,kDAAkD,EAAE,OAAO;IAC3D,uCAAuC,EAAE,MAAM;IAC/C,wCAAwC,EAAE;QACxC,OAAO;QACP;YACE,KAAK,EAAE;gBACL,UAAU,EAAE;oBACV,OAAO,EAAE,6CAA6C;iBACvD;gBAED,EAAE,EAAE;oBACF,OAAO,EAAE,6CAA6C;iBACvD;aACF;SACF;KACF;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\n\nexport const typescriptRules: Linter.RulesRecord = {\n \"@typescript-eslint/no-explicit-any\": \"error\",\n \"@typescript-eslint/no-inferrable-types\": \"error\",\n \"@typescript-eslint/unified-signatures\": \"error\",\n \"@typescript-eslint/no-unnecessary-condition\": \"error\",\n \"no-unused-vars\": \"off\",\n \"@typescript-eslint/no-unused-vars\": [\n \"warn\",\n {\n args: \"all\",\n argsIgnorePattern: \"^_\",\n caughtErrors: \"all\",\n caughtErrorsIgnorePattern: \"^_\",\n destructuredArrayIgnorePattern: \"^_\",\n varsIgnorePattern: \"^_\",\n ignoreRestSiblings: true,\n },\n ],\n \"@typescript-eslint/array-type\": [\n \"error\",\n {\n default: \"generic\",\n },\n ],\n \"@typescript-eslint/no-redeclare\": [\"error\", { builtinGlobals: false }],\n \"@typescript-eslint/no-shadow\": [\n \"error\",\n {\n hoist: \"all\",\n },\n ],\n \"@typescript-eslint/strict-boolean-expressions\": [\n \"warn\",\n {\n allowNullableBoolean: true,\n allowNullableString: true,\n },\n ],\n \"@typescript-eslint/naming-convention\": [\n \"error\",\n {\n selector: \"interface\",\n format: [\"PascalCase\"],\n\n custom: {\n regex: \"^I[A-Z]\",\n match: false,\n },\n },\n {\n selector: \"typeParameter\",\n format: [\"PascalCase\"],\n\n custom: {\n regex: \"^(T|Keys?)[A-Z][a-zA-Z]+$\",\n match: true,\n },\n },\n ],\n \"@typescript-eslint/no-non-null-assertion\": \"warn\",\n \"@typescript-eslint/no-empty-function\": \"error\",\n \"@typescript-eslint/no-unused-expressions\": \"error\",\n \"@typescript-eslint/dot-notation\": \"error\",\n \"@typescript-eslint/await-thenable\": \"warn\",\n \"@typescript-eslint/ban-ts-comment\": \"warn\",\n \"@typescript-eslint/member-ordering\": \"error\",\n \"@typescript-eslint/no-empty-object-type\": \"error\",\n \"@typescript-eslint/no-floating-promises\": \"error\",\n \"@typescript-eslint/explicit-member-accessibility\": [\n \"error\",\n {\n accessibility: \"explicit\",\n overrides: {\n accessors: \"explicit\",\n constructors: \"explicit\",\n parameterProperties: \"explicit\",\n },\n },\n ],\n \"@typescript-eslint/no-unnecessary-type-assertion\": \"error\",\n \"@typescript-eslint/no-require-imports\": \"warn\",\n \"@typescript-eslint/no-restricted-types\": [\n \"error\",\n {\n types: {\n \"React.FC\": {\n message: \"Please use props interface or type instead.\",\n },\n\n FC: {\n message: \"Please use props interface or type instead.\",\n },\n },\n },\n ],\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/index.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,2CAA8C;AAEjC,QAAA,OAAO,GAAG;IACrB,IAAI,EAAJ,WAAI;IACJ,KAAK,EAAE,mBAAW;CACnB,CAAC","sourcesContent":["import { base } from \"./presets/base\";\nimport { reactPreset } from \"./presets/react\";\n\nexport const configs = {\n base,\n react: reactPreset,\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/plugins.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;GAQG;AACH,8DAAwC;AAwBtC,gBAAE;AAvBJ,2FAAqE;AA4BnE,4CAAgB;AA3BlB,4EAAsD;AA0BpD,4BAAQ;AAzBV,+EAA+D;AAc7D,+BAdK,cAAoB,CAcL;AAbtB,2EAAqD;AAenD,oCAAY;AAdd,iEAA2C;AAezC,oBAAI;AAdN,mEAA6C;AAe3C,sBAAK;AAdP,sEAAgD;AAgB9C,wBAAM;AAfR,mEAA6C;AAiB3C,sBAAK;AAhBP,8EAAwD;AAiBtD,gCAAU;AAhBZ,sFAAgE;AAiB9D,wCAAc;AAhBhB,yDAAmC;AAOjC,0BAAO;AANT,yEAAmD;AAUjD,kCAAW;AATb,4CAAwC;AAE3B,QAAA,gBAAgB,GAAG,EAAE,KAAK,EAAE,oBAAQ,EAAE,CAAC","sourcesContent":["/**\n * Shared plugin instances for ESLint flat config.\n *\n * ESLint flat config requires that the same plugin name always maps to the same\n * object reference. With TypeScript's __importStar() helper (from esModuleInterop),\n * each file that does `import * as foo from \"pkg\"` gets its own wrapper object.\n * By importing all plugins once here and re-exporting, all presets share the same\n * object references.\n */\nimport * as nx from \"@nx/eslint-plugin\";\nimport * as typescriptEslint from \"@typescript-eslint/eslint-plugin\";\nimport * as tsParser from \"@typescript-eslint/parser\";\nimport eslintConfigPrettier from \"eslint-config-prettier/flat\";\nimport * as importPlugin from \"eslint-plugin-import\";\nimport * as jest from \"eslint-plugin-jest\";\nimport * as jsdoc from \"eslint-plugin-jsdoc\";\nimport * as noNull from \"eslint-plugin-no-null\";\nimport * as react from \"eslint-plugin-react\";\nimport * as reactHooks from \"eslint-plugin-react-hooks\";\nimport * as testingLibrary from \"eslint-plugin-testing-library\";\nimport * as globals from \"globals\";\nimport * as jsoncParser from \"jsonc-eslint-parser\";\nimport { rulesMap } from \"../rules-map\";\n\nexport const localRulesPlugin = { rules: rulesMap };\nexport {\n eslintConfigPrettier,\n globals,\n importPlugin,\n jest,\n jsdoc,\n jsoncParser,\n noNull,\n nx,\n react,\n reactHooks,\n testingLibrary,\n tsParser,\n typescriptEslint,\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/presets/base.ts"],"names":[],"mappings":";;;AAAA,4EAAuE;AAEvE,kDAAqD;AACrD,4DAAwD;AACxD,gEAAgE;AAChE,0DAA2D;AAC3D,sEAAqE;AACrE,wEAAwE;AACxE,oEAAgE;AAChE,wCAUoB;AACpB,oCAA4C;AAE/B,QAAA,IAAI,GAAG;IAClB,uBAAa;IACb;QACE,OAAO,EAAE;YACP,KAAK,EAAE,YAAE;YACT,YAAY,EAAE,0BAAgB;YAC9B,oBAAoB,EAAE,0BAAgB;YACtC,SAAS,EAAE,gBAAM;YACjB,UAAU,EAAE,sBAAY;YACxB,KAAK,EAAL,eAAK;SACN;QAED,KAAK,EAAE;YACL,GAAG,uCAAmB;YACtB,GAAG,0CAAqB;SACzB;KACF;IACD,IAAA,iCAAc,EAAC;QACb,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE;QAC9B,OAAO,EAAE;YACP,UAAU,EAAE,sBAAY;SACzB;QACD,KAAK,EAAE;YACL,qCAAqC,EAAE;gBACrC,OAAO;gBACP;oBACE,UAAU,EAAE,IAAA,wBAAgB,GAAE;oBAC9B,eAAe,EAAE;wBACf,kBAAkB;wBAClB,eAAe;wBACf,oBAAoB;wBACpB,oBAAoB;wBACpB,iBAAiB;wBACjB,YAAY;wBACZ,aAAa;wBACb,eAAe;wBACf,kBAAkB;wBAClB,kBAAkB;wBAClB,iBAAiB;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AEd,GAAG,kCAAe;SACnB;KACF;IACD;QACE,KAAK,EAAE,CAAC,iBAAiB,CAAC;QAC1B,eAAe,EAAE;YACf,MAAM,EAAE,qBAAW;SACpB;QACD,OAAO,EAAE;YACP,YAAY,EAAE,0BAAgB;SAC/B;QACD,KAAK,EAAE;YACL,4DAA4D,EAAE,OAAO;SACtE;KACF;IACD,kCAAiB;IACjB;QACE,KAAK,EAAE;YACL,sBAAsB;YACtB,yBAAyB;YACzB,qBAAqB;YACrB,qBAAqB;YACrB,sBAAsB;SACvB;QACD,KAAK,EAAE;YACL,uCAAuC,EAAE,KAAK;SAC/C;KACF;IACD;QACE,KAAK,EAAE,CAAC,sBAAsB,CAAC;QAC/B,KAAK,EAAE;YACL,+BAA+B,EAAE,KAAK;SACvC;KACF;IACD,8BAAoB;IACpB;QACE,KAAK,EAAE,CAAC,8BAA8B,EAAE,2BAA2B,CAAC;QACpE,KAAK,EAAE;YACL,+BAA+B,EAAE,KAAK;SACvC;KACF;CACF,CAAC","sourcesContent":["import { createSkipWhen } from \"../../config-helpers/create-skip-when\";\n\nimport { globalIgnores } from \"../fragments/ignores\";\nimport { importRules } from \"../fragments/import-rules\";\nimport { baseJestOverrides } from \"../fragments/jest-overrides\";\nimport { basicJsdocRules } from \"../fragments/jsdoc-rules\";\nimport { moduleBoundaryRules } from \"../fragments/module-boundaries\";\nimport { restrictedImportRules } from \"../fragments/restricted-imports\";\nimport { typescriptRules } from \"../fragments/typescript-rules\";\nimport {\n eslintConfigPrettier,\n importPlugin,\n jsdoc,\n jsoncParser,\n localRulesPlugin,\n noNull,\n nx,\n tsParser,\n typescriptEslint,\n} from \"../plugins\";\nimport { findMonorepoRoot } from \"../utils\";\n\nexport const base = [\n globalIgnores,\n {\n plugins: {\n \"@nx\": nx,\n \"@trackunit\": localRulesPlugin,\n \"@typescript-eslint\": typescriptEslint,\n \"no-null\": noNull,\n \"import-x\": importPlugin,\n jsdoc,\n },\n\n rules: {\n ...moduleBoundaryRules,\n ...restrictedImportRules,\n },\n },\n createSkipWhen({\n when: { tags: [\"scope:tool\"] },\n plugins: {\n \"import-x\": importPlugin,\n },\n rules: {\n \"import-x/no-extraneous-dependencies\": [\n \"error\",\n {\n packageDir: findMonorepoRoot(),\n devDependencies: [\n \"**/*.cy.{ts,tsx}\",\n \"**/cypress/**\",\n \"**/*.spec.{ts,tsx}\",\n \"**/*.test.{ts,tsx}\",\n \"**/jest.setup.*\",\n \"**/test/**\",\n \"**/tests/**\",\n \"**/testing/**\",\n \"**/test-setup/**\",\n \"**/test-utils/**\",\n \"**/__tests__/**\",\n \"**/__mocks__/**\",\n \"**/mocks.{ts,tsx}\",\n \"**/core-contexts-test/**\",\n \"**/*.stories.{ts,tsx}\",\n \"**/storybookUtils.{ts,tsx}\",\n \"**/.storybook/**\",\n \"**/scripts/**\",\n \"**/tools/**\",\n \"**/*.config.{ts,js,cjs,mjs}\",\n \"**/css/tailwind/**\",\n \"**/css/tailwind-custom-properties-plugin/**\",\n \"**/css/component-tokens/**\",\n ],\n optionalDependencies: false,\n peerDependencies: true,\n bundledDependencies: true,\n },\n ],\n },\n }),\n {\n files: [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\"],\n\n languageOptions: {\n ecmaVersion: 5,\n sourceType: \"script\",\n parser: tsParser,\n parserOptions: {\n project: [\"./tsconfig.*?.json\"],\n },\n },\n rules: {\n \"constructor-super\": \"error\",\n curly: \"error\",\n \"default-case\": \"error\",\n \"id-match\": \"error\",\n \"no-caller\": \"error\",\n \"no-debugger\": \"error\",\n \"no-duplicate-imports\": \"error\",\n \"no-empty\": \"error\",\n \"no-eval\": \"error\",\n \"no-console\": \"error\",\n \"no-var\": \"error\",\n \"prefer-const\": \"error\",\n \"no-template-curly-in-string\": \"error\",\n eqeqeq: [\"error\", \"always\"],\n \"no-undef-init\": \"error\",\n \"no-invalid-this\": \"off\",\n \"no-null/no-null\": \"off\",\n \"no-underscore-dangle\": \"off\",\n \"no-redeclare\": \"off\",\n \"no-empty-function\": \"off\",\n \"no-unused-expressions\": \"off\",\n \"no-shadow\": \"off\",\n\n ...basicJsdocRules,\n\n \"@trackunit/no-internal-barrel-files\": \"error\",\n \"@trackunit/no-typescript-assertion\": \"warn\",\n\n ...importRules,\n\n ...typescriptRules,\n },\n },\n {\n files: [\"**/project.json\"],\n languageOptions: {\n parser: jsoncParser,\n },\n plugins: {\n \"@trackunit\": localRulesPlugin,\n },\n rules: {\n \"@trackunit/no-internal-graphql-when-tagged-with-gql-public\": \"error\",\n },\n },\n baseJestOverrides,\n {\n files: [\n \"**/eslint.config.cjs\",\n \"**/iris-app-manifest.ts\",\n \"**/rspack.config.ts\",\n \"**/rspack.config.js\",\n \"**/webpack.config.ts\",\n ],\n rules: {\n \"@typescript-eslint/no-require-imports\": \"off\",\n },\n },\n {\n files: [\"**/eslint.config.cjs\"],\n rules: {\n \"@nx/enforce-module-boundaries\": \"off\",\n },\n },\n eslintConfigPrettier,\n {\n files: [\"**/*.stories.{ts,tsx,js,jsx}\", \"**/*.demo.{ts,tsx,js,jsx}\"],\n rules: {\n \"@nx/enforce-module-boundaries\": \"off\",\n },\n },\n];\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/presets/e2e.ts"],"names":[],"mappings":";;;;AAAA,4EAAsD;AAEzC,QAAA,GAAG,GAAG;IACjB,OAAO,CAAC,OAAO,CAAC,WAAW;IAC3B;QACE,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC;QAErD,eAAe,EAAE;YACf,WAAW,EAAE,CAAC;YACd,UAAU,EAAE,QAAQ;YAEpB,aAAa,EAAE;gBACb,OAAO,EAAE,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,yBAAyB,CAAC;aAC9E;SACF;KACF;CACF,CAAC","sourcesContent":["import * as cypress from \"eslint-plugin-cypress/flat\";\n\nexport const e2e = [\n cypress.configs.recommended,\n {\n files: [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\"],\n\n languageOptions: {\n ecmaVersion: 5,\n sourceType: \"script\",\n\n parserOptions: {\n project: [\"./tsconfig.*?.json\", \"./tsconfig.json\", \"./cypress/tsconfig.json\"],\n },\n },\n },\n];\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/presets/react.ts"],"names":[],"mappings":";;;AAAA,0DAAwE;AACxE,kEAAwE;AACxE,wCAWoB;AAEP,QAAA,WAAW,GAAG;IACzB;QACE,OAAO,EAAE;YACP,YAAY,EAAE,0BAAgB;YAC9B,oBAAoB,EAAE,0BAAgB;YACtC,KAAK,EAAL,eAAK;YACL,KAAK,EAAL,eAAK;YACL,aAAa,EAAE,oBAAU;YACzB,iBAAiB,EAAE,wBAAc;YACjC,KAAK,EAAE,YAAE;SACV;QAED,QAAQ,EAAE;YACR,KAAK,EAAE;gBACL,OAAO,EAAE,QAAQ;aAClB;SACF;QACD,eAAe,EAAE;YACf,OAAO,EAAE;gBACP,GAAG,iBAAO,CAAC,OAAO;gBAClB,GAAG,cAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO;gBACpC,GAAG,iBAAO,CAAC,IAAI;gBACf,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,UAAU;aACnB;YACD,MAAM,EAAE,kBAAQ;YAChB,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,UAAU;YACtB,aAAa,EAAE;gBACb,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI;iBACV;aACF;SACF;KACF;IACD;QACE,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC;QACrD,KAAK,EAAE;YACL,GAAG,8BAAgB;YAEnB,yBAAyB,EAAE;gBACzB,OAAO;gBACP;oBACE,GAAG,EAAE,CAAC;iBACP;aACF;YAED,gBAAgB,EAAE,OAAO;YACzB,eAAe,EAAE,OAAO;YAExB,GAAG,wBAAU;YAEb,sBAAsB,EAAE;gBACtB,MAAM;gBACN;oBACE,QAAQ,EAAE,mBAAmB;oBAC7B,OAAO,EAAE,8DAA8D;iBACxE;aACF;SACF;KACF;IACD;QACE,KAAK,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;QAC9C,KAAK,EAAE;YACL,qBAAqB,EAAE,KAAK;YAC5B,YAAY,EAAE,KAAK;YACnB,sCAAsC,EAAE,KAAK;SAC9C;KACF;IACD;QACE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;QAExC,OAAO,EAAE;YACP,IAAI,EAAJ,cAAI;YACJ,iBAAiB,EAAE,wBAAc;SAClC;QACD,eAAe,EAAE;YACf,OAAO,EAAE;gBACP,GAAG,iBAAO,CAAC,OAAO;gBAClB,GAAG,cAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO;gBACpC,GAAG,iBAAO,CAAC,IAAI;gBACf,IAAI,EAAE,UAAU;gBAChB,MAAM,EAAE,UAAU;aACnB;YAED,MAAM,EAAE,kBAAQ;SACjB;QAED,KAAK,EAAE;YACL,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;YACjC,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK;YAC3B,GAAG,0CAAwB;YAC3B,6BAA6B,EAAE,OAAO;YACtC,oBAAoB,EAAE,OAAO;SAC9B;KACF;CACF,CAAC","sourcesContent":["import { reactCustomRules, reactRules } from \"../fragments/react-rules\";\nimport { reactTestingLibraryRules } from \"../fragments/testing-library\";\nimport {\n globals,\n jest,\n jsdoc,\n localRulesPlugin,\n nx,\n react,\n reactHooks,\n testingLibrary,\n tsParser,\n typescriptEslint,\n} from \"../plugins\";\n\nexport const reactPreset = [\n {\n plugins: {\n \"@trackunit\": localRulesPlugin,\n \"@typescript-eslint\": typescriptEslint,\n jsdoc,\n react,\n \"react-hooks\": reactHooks,\n \"testing-library\": testingLibrary,\n \"@nx\": nx,\n },\n\n settings: {\n react: {\n version: \"detect\",\n },\n },\n languageOptions: {\n globals: {\n ...globals.browser,\n ...jest.environments.globals.globals,\n ...globals.node,\n Text: \"writable\",\n screen: \"writable\",\n },\n parser: tsParser,\n ecmaVersion: 2022,\n sourceType: \"commonjs\",\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n },\n },\n {\n files: [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\"],\n rules: {\n ...reactCustomRules,\n\n \"no-multiple-empty-lines\": [\n \"error\",\n {\n max: 1,\n },\n ],\n\n \"no-unreachable\": \"error\",\n \"prefer-spread\": \"error\",\n\n ...reactRules,\n\n \"no-restricted-syntax\": [\n \"warn\",\n {\n selector: \"TSEnumDeclaration\",\n message: \"Please use string literal union or objects instead of enums.\",\n },\n ],\n },\n },\n {\n files: [\"**/*.stories.ts\", \"**/*.stories.tsx\"],\n rules: {\n \"jsdoc/require-jsdoc\": \"off\",\n \"no-console\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n },\n },\n {\n files: [\"**/*.spec.ts\", \"**/*.spec.tsx\"],\n\n plugins: {\n jest,\n \"testing-library\": testingLibrary,\n },\n languageOptions: {\n globals: {\n ...globals.browser,\n ...jest.environments.globals.globals,\n ...globals.node,\n Text: \"writable\",\n screen: \"writable\",\n },\n\n parser: tsParser,\n },\n\n rules: {\n ...jest.configs.recommended.rules,\n ...jest.configs.style.rules,\n ...reactTestingLibraryRules,\n \"jest/no-commented-out-tests\": \"error\",\n \"jest/expect-expect\": \"error\",\n },\n },\n];\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/presets/server.ts"],"names":[],"mappings":";;;;AAAA,2CAAkD;AAClD,gFAA0D;AAE1D,wCAAsD;AAEzC,QAAA,MAAM,GAAG;IACpB;QACE,eAAe,EAAE;YACf,OAAO,EAAE;gBACP,GAAG,iBAAO,CAAC,OAAO;aACnB;YAED,MAAM,EAAE,kBAAQ;SACjB;KACF;IACD;QACE,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;QAC7B,OAAO,EAAE;YACP,KAAK,EAAL,eAAK;YACL,cAAc,EAAE,IAAA,yBAAgB,EAAC,WAAW,CAAC;SAC9C;QACD,eAAe,EAAE;YACf,aAAa,EAAE;gBACb,OAAO,EAAE,CAAC,oBAAoB,CAAC;aAChC;SACF;QAED,KAAK,EAAE;YACL,GAAG,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;YACxC,qCAAqC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;YACvD,2CAA2C,EAAE,KAAK;YAClD,wCAAwC,EAAE,OAAO;YACjD,0CAA0C,EAAE,KAAK;SAClD;KACF;CACF,CAAC","sourcesContent":["import { fixupPluginRules } from \"@eslint/compat\";\nimport * as typeGraphql from \"eslint-plugin-type-graphql\";\n\nimport { globals, jsdoc, tsParser } from \"../plugins\";\n\nexport const server = [\n {\n languageOptions: {\n globals: {\n ...globals.browser,\n },\n\n parser: tsParser,\n },\n },\n {\n files: [\"**/*.ts\", \"**/*.js\"],\n plugins: {\n jsdoc,\n \"type-graphql\": fixupPluginRules(typeGraphql),\n },\n languageOptions: {\n parserOptions: {\n project: [\"./tsconfig.*?.json\"],\n },\n },\n\n rules: {\n ...typeGraphql.configs.recommended.rules,\n \"type-graphql/missing-decorator-type\": [\"error\", \"all\"],\n \"type-graphql/invalid-nullable-output-type\": \"off\",\n \"type-graphql/wrong-decorator-signature\": \"error\",\n \"type-graphql/invalid-nullable-input-type\": \"off\",\n },\n },\n];\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/utils.ts"],"names":[],"mappings":";;AAUA,4CAcC;;AAxBD,+CAAyB;AACzB,mDAA6B;AAE7B,IAAI,UAA8B,CAAC;AAEnC;;;;GAIG;AACH,SAAgB,gBAAgB;IAC9B,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,OAAO,GAAG,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;YAC7C,UAAU,GAAG,GAAG,CAAC;YACjB,OAAO,GAAG,CAAC;QACb,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC3B,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\n\nlet cachedRoot: string | undefined;\n\n/**\n * Finds the monorepo root by walking up from the config package directory\n * until a directory containing nx.json is found.\n * Falls back to process.cwd() if no nx.json is found.\n */\nexport function findMonorepoRoot(): string {\n if (cachedRoot !== undefined) {\n return cachedRoot;\n }\n let dir = __dirname;\n while (dir !== path.dirname(dir)) {\n if (fs.existsSync(path.join(dir, \"nx.json\"))) {\n cachedRoot = dir;\n return dir;\n }\n dir = path.dirname(dir);\n }\n cachedRoot = process.cwd();\n return cachedRoot;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-skip-when.js","sourceRoot":"","sources":["../../../../../../../libs/eslint/plugin-trackunit/src/lib/config-helpers/create-skip-when.ts"],"names":[],"mappings":";;;AAqBA,gDAAmG;AAUnG,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB;;GAEG;AACI,MAAM,cAAc,GAAG,CAAC,OAA8B,EAAqB,EAAE;IAClF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,O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AC,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC;IACxD,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP,CAAC,UAAU,CAAC,EAAE;gBACZ,KAAK,EAAE,YAAY;aACpB;SACF;QACD,KAAK,EAAE,WAAW;KACnB,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,cAAc,kBAqDzB","sourcesContent":["/**\n * Helper to create ESLint config that wraps rules with skip-when-lib-has-tag-tool logic.\n *\n * This provides a cleaner API than manually using the skip-when-lib-has-tag-tool/ prefix.\n *\n * @example\n * createSkipWhen({\n * when: { tags: ['scope:tool'] },\n * plugins: {\n * 'import-x': importXPlugin,\n * },\n * rules: {\n * 'import-x/no-extraneous-dependencies': [\"error\", { ... }],\n * }\n * })\n *\n * Returns a config object with:\n * - A unique plugin containing the wrapped rules for this specific config\n * - Rules configured to use the wrapped versions\n */\nimport type { Linter, Rule } from \"eslint\";\nimport { getProjectMetadata, projectMatchesCriteria, type MatchCriteria } from \"../utils/nx-utils\";\n\ntype PluginMap = Record<string, { rules: Record<string, Rule.RuleModule> }>;\n\ntype CreateSkipWhenOptions = {\n when: MatchCriteria;\n plugins: PluginMap;\n rules: Linter.RulesRecord;\n};\n\nlet skipWhenCounter = 0;\n\n/**\n * Creates an ESLint config that wraps rules to skip enforcement based on NX project criteria.\n */\nexport const createSkipWhen = (options: CreateSkipWhenOptions): Linter.FlatConfig => {\n const { when, plugins, rules } = options;\n\n // Create a unique plugin name for this config\n const pluginName = `skip-when-${skipWhenCounter++}`;\n\n // Build wrapped rules from provided plugins\n const wrappedRules: Record<string, Rule.RuleModule> = {};\n\n for (const [originalPluginName, plugin] of Object.entries(plugins)) {\n for (const [ruleName, originalRule] of Object.entries(plugin.rules)) {\n const fullRuleName = `${originalPluginName}/${ruleName}`;\n\n // Create wrapped version of this rule\n wrappedRules[fullRuleName] = {\n meta: originalRule.meta,\n create(context: Rule.RuleContext) {\n // Check if this file belongs to a project matching the criteria\n const filename = context.filename || context.getFilename();\n const metadata = getProjectMetadata(filename);\n\n // Check if project matches the skip criteria\n if (metadata && projectMatchesCriteria(metadata, when)) {\n // Skip enforcement - return empty visitor\n return {};\n }\n\n // Otherwise, delegate to the original rule\n return originalRule.create(context);\n },\n };\n }\n }\n\n // Build the rules config\n const rulesConfig: Linter.RulesRecord = {};\n\n for (const [ruleName, ruleConfig] of Object.entries(rules)) {\n // Disable the original rule\n rulesConfig[ruleName] = \"off\";\n\n // Enable our wrapped version\n rulesConfig[`${pluginName}/${ruleName}`] = ruleConfig;\n }\n\n return {\n plugins: {\n [pluginName]: {\n rules: wrappedRules,\n },\n },\n rules: rulesConfig,\n };\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cva-merge-base-classes-as-array.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/cva-merge-base-classes-as-array/cva-merge-base-classes-as-array.ts"],"names":[],"mappings":";;;AAAA,oDAAiF;AACjF,iEAAyF;AAEzF,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,KAAK,CAC/G,CAAC;AAKF;;;;;;;;;GASG;AACU,QAAA,0BAA0B,GAAG,UAAU,CAAsB;IACxE,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,WAAW,EAAE,wEAAwE;SACtF;QACD,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE;YACR,gBAAgB,EAAE,4FAA4F;YAC9G,eAAe,EAAE,sDAAsD;SACxE;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,cAAc,CAAC,IAA6B;gBAC1C,MAAM,UAAU,GAAG,IAAA,+BAAa,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAE9C,IAAI,UAAU,KAAK,UAAU,I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AAU,GAAkB,EAAE,CAAC;gCACrC,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;oCACxC,IAAI,OAAO,EAAE,IAAI,KAAK,sBAAc,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;wCAClF,UAAU,CAAC,IAAI,CAAC,GAAG,IAAA,8BAAY,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;oCAClD,CAAC;gCACH,CAAC;gCACD,OAAO,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAA,+BAAa,EAAC,UAAU,CAAC,CAAC,CAAC;4BAChE,CAAC;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { AST_NODE_TYPES, ESLintUtils, TSESTree } from \"@typescript-eslint/utils\";\nimport { formatAsArray, getCalleeName, splitClasses } from \"../../utils/classname-utils\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}.ts`\n);\n\ntype MessageIds = \"stringNeedsArray\" | \"arrayNeedsSplit\";\ntype Options = [];\n\n/**\n * ESLint rule that converts cvaMerge base styles to arrays if more than one class is used.\n *\n * @example\n * Invalid:\n * const cvaMyComponent = cvaMerge(\"text-danger-600 mb-4 font-semibold\");\n * const cvaMyComponent = cvaMerge([\"text-danger-600 mb-4\",\"font-semibold\"]);\n * Valid:\n * const cvaMyComponent = cvaMerge([\"text-danger-600\", \"mb-4\", \"font-semibold\"]);\n */\nexport const cvaMergeBaseClassesAsArray = createRule<Options, MessageIds>({\n name: \"cva-merge-base-classes-as-array\",\n meta: {\n type: \"layout\",\n docs: {\n description: \"Convert cvaMerge base styles to arrays if more than one class is used.\",\n },\n fixable: \"code\",\n messages: {\n stringNeedsArray: \"[cvaMerge] The first argument of cvaMerge should be an array if multiple classes are used.\",\n arrayNeedsSplit: \"[cvaMerge] Only one class per array item is allowed.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node: TSESTree.CallExpression) {\n const calleeName = getCalleeName(node.callee);\n\n if (calleeName !== \"cvaMerge\" || node.arguments.length === 0) {\n return;\n }\n\n const firstArg = node.arguments[0];\n if (!firstArg) {\n return;\n }\n\n // Handle string literal: cvaMerge(\"class1 class2\")\n if (firstArg.type === AST_NODE_TYPES.Literal && typeof firstArg.value === \"string\") {\n const value = firstArg.value;\n if (value.includes(\" \")) {\n context.report({\n node,\n messageId: \"stringNeedsArray\",\n fix(fixer) {\n return fixer.replaceText(firstArg, formatAsArray(splitClasses(value)));\n },\n });\n }\n return;\n }\n\n // Handle array: cvaMerge([\"class1 class2\", \"class3\"])\n if (firstArg.type === AST_NODE_TYPES.ArrayExpression) {\n const hasMultiClassElement = firstArg.elements.some(\n element =>\n element?.type === AST_NODE_TYPES.Literal &&\n typeof element.value === \"string\" &&\n element.value.includes(\" \")\n );\n\n if (hasMultiClassElement) {\n context.report({\n node,\n messageId: \"arrayNeedsSplit\",\n fix(fixer) {\n // Extract all string values and split them into individual classes\n const allClasses: Array<string> = [];\n for (const element of firstArg.elements) {\n if (element?.type === AST_NODE_TYPES.Literal && typeof element.value === \"string\") {\n allClasses.push(...splitClasses(element.value));\n }\n }\n return fixer.replaceText(firstArg, formatAsArray(allClasses));\n },\n });\n }\n }\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-guideline-button-icon-size-match.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/design-guideline-button-icon-size-match/design-guideline-button-icon-size-match.ts"],"names":[],"mappings":";;;;AAAA,oDAAqF;AACrF,uDAAiC;AAEjC,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,0FAA0F,IAAI,KAAK,CAC5G,CAAC;AAEF,sEA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I,CAAC;4CACrC,OAAO,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;wCAChE,CAAC;6CAAM,CAAC;4CACN,qBAAqB;4CACrB,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;4CAC3E,IAAI,QAAQ,EAAE,CAAC;gDACb,OAAO,KAAK,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;4CACrE,CAAC;iDAAM,CAAC;gDACN,OAAO,KAAK,CAAC,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,CAAC,CAAC;4CAC7E,CAAC;wCACH,CAAC;oCACH,CAAC;iCACF,CAAC,CAAC;4BACL,CAAC;wBACH,CAAC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils, type TSESLint, type TSESTree } from \"@typescript-eslint/utils\";\nimport * as ts from \"typescript\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/docs/rules/${name}.md`\n);\n\n// Helper to get possible string literal values from a variable's type\nfunction getPossibleStringLiterals(\n context: TSESLint.RuleContext<string, ReadonlyArray<unknown>>,\n identifier: TSESTree.Identifier\n): Array<string> | null {\n try {\n const services = ESLintUtils.getParserServices(context);\n const checker = services.program.getTypeChecker();\n const tsNode = services.esTreeNodeToTSNodeMap.get(identifier);\n const type = checker.getTypeAtLocation(tsNode);\n\n const literalValues: Array<string> = [];\n\n // Type guard for string literal types\n const isStringLiteralType = (t: ts.Type): t is ts.Type & { value: string } => {\n if ((t.flags & ts.TypeFlags.StringLiteral) === 0) {\n return false;\n }\n // Check if the type has a value property and it's a string\n // eslint-disable-next-line @trackunit/no-typescript-assertion\n const typeWithValue = t as { value?: unknown };\n return \"value\" in typeWithValue && typeof typeWithValue.value === \"string\";\n };\n\n if (type.isUnion()) {\n for (const unionType of type.types) {\n if (isStringLiteralType(unionType)) {\n literalValues.push(unionType.value);\n }\n }\n } else if (isStringLiteralType(type)) {\n literalValues.push(type.value);\n }\n\n return literalValues.length > 0 ? literalValues : null;\n } catch {\n return null;\n }\n}\n\n// Helper to check if a conditional expression matches the expected button-icon size pattern\nfunction isCorrectConditionalExpression(expression: TSESTree.Expression, buttonVariableName: string): boolean {\n if (expression.type !== \"ConditionalExpression\") {\n return false;\n }\n\n const { test, consequent, alternate } = expression;\n\n // Check if test is: variable === \"large\"\n if (\n test.type === \"BinaryExpression\" &&\n test.operator === \"===\" &&\n test.left.type === \"Identifier\" &&\n test.left.name === buttonVariableName &&\n test.right.type === \"Literal\" &&\n test.right.value === \"large\"\n ) {\n // Check if consequent is \"medium\" and alternate is \"small\"\n return (\n consequent.type === \"Literal\" &&\n consequent.value === \"medium\" &&\n alternate.type === \"Literal\" &&\n alternate.value === \"small\"\n );\n }\n\n return false;\n}\n\nexport const designGuidelineButtonIconSizeMatch = createRule({\n name: \"design-guideline-button-icon-size-match\",\n meta: {\n type: \"suggestion\",\n docs: {\n description: \"Ensure Icon components within Button have the correct size prop based on the Button's size.\",\n },\n fixable: \"code\",\n schema: [],\n messages: {\n incorrectIconSize:\n \"Expected Icon size to be '{{expectedSize}}' for Button size '{{buttonSize}}', found '{{iconSize}}'.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node: TSESTree.JSXOpeningElement) {\n if (node.name.type === \"JSXIdentifier\" && node.name.name === \"Button\") {\n const sizeAttr = node.attributes.find(\n (attr): attr is TSESTree.JSXAttribute =>\n attr.type === \"JSXAttribute\" && attr.name.type === \"JSXIdentifier\" && attr.name.name === \"size\"\n );\n\n const buttonSizeInfo = (() => {\n if (!sizeAttr?.value) return { type: \"implicit\", value: null };\n\n if (sizeAttr.value.type === \"Literal\" && typeof sizeAttr.value.value === \"string\") {\n return { type: \"literal\", value: sizeAttr.value.value };\n }\n\n if (sizeAttr.value.type === \"JSXExpressionContainer\") {\n const expr = sizeAttr.value.expression;\n if (expr.type === \"Identifier\") {\n return { type: \"variable\", value: expr.name, expression: expr };\n }\n return { type: \"expression\", value: null, expression: expr };\n }\n\n return { type: \"implicit\", value: null };\n })();\n\n node.attributes.forEach(attr => {\n if (\n attr.type === \"JSXAttribute\" &&\n attr.name.type === \"JSXIdentifier\" &&\n (attr.name.name === \"prefix\" || attr.name.name === \"suffix\") &&\n attr.value?.type === \"JSXExpressionContainer\"\n ) {\n // Find Icon element - could be direct or inside conditional\n const findIconElement = (expression: TSESTree.Expression): TSESTree.JSXOpeningElement | null => {\n if (\n expression.type === \"JSXElement\" &&\n expression.openingElement.name.type === \"JSXIdentifier\" &&\n expression.openingElement.name.name === \"Icon\"\n ) {\n return expression.openingElement;\n }\n\n if (expression.type === \"ConditionalExpression\") {\n // Check both consequent and alternate\n const consequent = findIconElement(expression.consequent);\n if (consequent) return consequent;\n\n const alternate = findIconElement(expression.alternate);\n if (alternate) return alternate;\n }\n\n return null;\n };\n\n // Skip empty JSX expressions like {}\n if (attr.value.expression.type === \"JSXEmptyExpression\") return;\n\n const iconElement = findIconElement(attr.value.expression);\n if (!iconElement) return;\n const iconSizeAttr = iconElement.attributes.find(\n (iconAttr): iconAttr is TSESTree.JSXAttribute =>\n iconAttr.type === \"JSXAttribute\" &&\n iconAttr.name.type === \"JSXIdentifier\" &&\n iconAttr.name.name === \"size\"\n );\n\n const iconSizeInfo = (() => {\n if (!iconSizeAttr?.value) return { type: \"implicit\", value: null };\n\n if (iconSizeAttr.value.type === \"Literal\" && typeof iconSizeAttr.value.value === \"string\") {\n return { type: \"literal\", value: iconSizeAttr.value.value };\n }\n\n if (iconSizeAttr.value.type === \"JSXExpressionContainer\") {\n const expr = iconSizeAttr.value.expression;\n if (expr.type === \"Identifier\") {\n return { type: \"variable\", value: expr.name, expression: expr };\n }\n return { type: \"expression\", value: null, expression: expr };\n }\n\n return { type: \"implicit\", value: null };\n })();\n\n // Rule: large buttons → medium icons, small/medium buttons → small icons\n const getExpectedIconSize = (buttonSize: string): string => {\n if (buttonSize === \"large\") return \"medium\";\n return \"small\"; // both \"small\" and \"medium\" buttons get \"small\" icons\n };\n\n const shouldReport = (() => {\n // For complex expressions, always warn but don't autofix\n if (buttonSizeInfo.type === \"expression\") {\n return true;\n }\n\n // For variables, check if icon already has the correct size\n if (buttonSizeInfo.type === \"variable\" && buttonSizeInfo.expression?.type === \"Identifier\") {\n const possibleSizes = getPossibleStringLiterals(context, buttonSizeInfo.expression);\n\n if (possibleSizes) {\n // Check if all possible button sizes map to the same icon size\n const iconSizes = possibleSizes.map(getExpectedIconSize);\n const uniqueIconSizes = [...new Set(iconSizes)];\n\n if (uniqueIconSizes.length === 1) {\n // All map to same icon size - check if icon already has correct literal\n const variableExpectedIconSize = uniqueIconSizes[0];\n const variableIconEffectiveSize = iconSizeInfo.value || \"medium\";\n\n if (variableIconEffectiveSize === variableExpectedIconSize) {\n return false; // Icon already has correct literal size\n }\n } else {\n // Mixed mapping - check if icon has correct conditional expression\n if (\n iconSizeInfo.type === \"expression\" &&\n iconSizeInfo.expression &&\n iconSizeInfo.expression.type !== \"JSXEmptyExpression\" &&\n buttonSizeInfo.value &&\n isCorrectConditionalExpression(iconSizeInfo.expression, buttonSizeInfo.value)\n ) {\n return false; // Icon already has correct conditional\n }\n }\n }\n\n // Mixed mapping or can't determine - always warn\n return true;\n }\n\n // For literals and implicit, check the mapping\n const buttonEffectiveSize = buttonSizeInfo.value || \"medium\";\n const iconEffectiveSize = iconSizeInfo.value || \"medium\";\n const expectedIconSize = getExpectedIconSize(buttonEffectiveSize);\n\n return iconEffectiveSize !== expectedIconSize;\n })();\n\n if (shouldReport) {\n context.report({\n node: iconElement,\n messageId: \"incorrectIconSize\",\n data: {\n expectedSize: (() => {\n if (buttonSizeInfo.type === \"variable\" && buttonSizeInfo.expression?.type === \"Identifier\") {\n // Analyze the variable's type to determine expected message\n const possibleSizes = getPossibleStringLiterals(context, buttonSizeInfo.expression);\n\n if (possibleSizes) {\n const iconSizes = possibleSizes.map(getExpectedIconSize);\n const uniqueIconSizes = [...new Set(iconSizes)];\n\n if (uniqueIconSizes.length === 1) {\n return uniqueIconSizes[0];\n }\n }\n\n return `{${buttonSizeInfo.value} === \"large\" ? \"medium\" : \"small\"}`;\n }\n if (buttonSizeInfo.type === \"expression\") {\n return \"small (for small/medium buttons) or medium (for large buttons)\";\n }\n const buttonEffectiveSize = buttonSizeInfo.value || \"medium\";\n return getExpectedIconSize(buttonEffectiveSize);\n })(),\n buttonSize:\n buttonSizeInfo.type === \"implicit\"\n ? \"medium (default)\"\n : buttonSizeInfo.type === \"literal\"\n ? buttonSizeInfo.value\n : buttonSizeInfo.type === \"variable\"\n ? (() => {\n if (buttonSizeInfo.expression?.type === \"Identifier\") {\n const possibleSizes = getPossibleStringLiterals(context, buttonSizeInfo.expression);\n if (possibleSizes && possibleSizes.length > 0) {\n const sizeList = possibleSizes.map(s => `\"${s}\"`).join(\" | \");\n return `{${buttonSizeInfo.value}} (of type ${sizeList})`;\n }\n }\n return `{${buttonSizeInfo.value}}`;\n })()\n : \"expression\",\n iconSize:\n iconSizeInfo.type === \"implicit\"\n ? \"medium (default)\"\n : iconSizeInfo.type === \"literal\"\n ? iconSizeInfo.value\n : iconSizeInfo.type === \"variable\"\n ? `{${iconSizeInfo.value}}`\n : \"expression\",\n },\n fix(fixer) {\n // Don't autofix complex expressions, only variables and literals\n if (buttonSizeInfo.type === \"expression\") {\n return null;\n }\n\n let targetSizeValue: string;\n\n if (buttonSizeInfo.type === \"variable\" && buttonSizeInfo.expression?.type === \"Identifier\") {\n // Analyze the variable's type to determine optimal autofix\n const possibleSizes = getPossibleStringLiterals(context, buttonSizeInfo.expression);\n\n if (possibleSizes) {\n // Check if all possible button sizes map to the same icon size\n const iconSizes = possibleSizes.map(getExpectedIconSize);\n const uniqueIconSizes = [...new Set(iconSizes)];\n\n if (uniqueIconSizes.length === 1) {\n // All possible button sizes map to the same icon size\n targetSizeValue = `\"${uniqueIconSizes[0]}\"`;\n } else {\n // Mixed mapping, use conditional\n targetSizeValue = `{${buttonSizeInfo.value} === \"large\" ? \"medium\" : \"small\"}`;\n }\n } else {\n // Can't determine type, use conditional\n targetSizeValue = `{${buttonSizeInfo.value} === \"large\" ? \"medium\" : \"small\"}`;\n }\n } else {\n // Calculate target icon size based on button size (literal or implicit)\n const buttonEffectiveSize = buttonSizeInfo.value || \"medium\";\n const targetIconSize = getExpectedIconSize(buttonEffectiveSize);\n targetSizeValue = `\"${targetIconSize}\"`;\n }\n\n if (iconSizeAttr) {\n // Replace existing size attribute\n if (!iconSizeAttr.value) return null;\n return fixer.replaceText(iconSizeAttr.value, targetSizeValue);\n } else {\n // Add size attribute\n const lastAttr = iconElement.attributes[iconElement.attributes.length - 1];\n if (lastAttr) {\n return fixer.insertTextAfter(lastAttr, ` size=${targetSizeValue}`);\n } else {\n return fixer.insertTextAfter(iconElement.name, ` size=${targetSizeValue}`);\n }\n }\n },\n });\n }\n }\n });\n }\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-internal-barrel-files.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-internal-barrel-files/no-internal-barrel-files.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oDAAuD;AACvD,+CAAyB;AACzB,mDAA6B;AAC7B,6BAAwB;AACxB,uDAAyD;AAEzD,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,eAAe,EAAE,OAAC;SACf,MAAM,CAAC;QACN,KAAK,EAAE,OAAC,C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C,CAAC;gBAC9E,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC;gBAChF,MAAM,qBAAqB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;gBAEzD,2CAA2C;gBAC3C,IAAI,qBAAqB,KAAK,YAAY,IAAI,qBAAqB,KAAK,aAAa,EAAE,CAAC;oBACtF,OAAO;gBACT,CAAC;gBAED,4EAA4E;gBAC5E,IAAI,aAAa,EAAE,CAAC;oBAClB,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAC;oBACpE,IAAI,oBAAoB,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;wBACpD,uDAAuD;wBACvD,OAAO;oBACT,CAAC;gBACH,CAAC;gBAED,4CAA4C;gBAC5C,sDAAsD;gBACtD,qDAAqD;gBACrD,uDAAuD;gBACvD,2DAA2D;gBAC3D,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,kBAAkB;iBAC9B,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * ESLint rule to disallow internal barrel files.\n *\n * Internal barrel files (any index.ts or index.tsx that is not at the library root) cause:\n * - Multiple import paths to the same module\n * - Slower builds (bundlers must traverse more barrel files)\n * - Confusion about canonical import paths\n * - Potential bundle size issues\n * - Module identity problems\n *\n * EXCEPTION: Secondary entry points configured in tsconfig.base.json are allowed.\n * These are intentional barrel files that provide separate package imports\n * (e.g., @trackunit/react-core-contexts-host-test pointing to src/test/index.ts).\n *\n * @example\n * // Valid - Root barrel file\n * // libs/my-lib/src/index.ts ✅\n *\n * // Valid - Secondary entry point configured in tsconfig.base.json\n * // libs/my-lib/src/test/index.ts ✅ (if configured as @trackunit/my-lib-test)\n *\n * // Invalid - Internal barrel file\n * // libs/my-lib/src/components/index.ts ❌\n * // libs/my-lib/src/utils/helpers/index.ts ❌\n */\nimport { ESLintUtils } from \"@typescript-eslint/utils\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { z } from \"zod\";\nimport { findNearestFile } from \"../../utils/file-utils\";\n\nconst projectJsonSchema = z.object({\n sourceRoot: z.string().optional(),\n});\n\nconst tsconfigSchema = z.object({\n compilerOptions: z\n .object({\n paths: z.record(z.array(z.string())).optional(),\n })\n .optional(),\n});\n\n/**\n * Cache for tsconfig.base.json secondary entry points.\n * Key: workspace root path\n * Value: Set of absolute paths to allowed secondary entry points\n */\nconst secondaryEntryPointsCache = new Map<string, Set<string>>();\n\n/**\n * Find the workspace root by looking for nx.json\n */\nconst findWorkspaceRoot = (startPath: string): string | null => {\n const nxJsonPath = findNearestFile(startPath, \"nx.json\");\n return nxJsonPath ? path.dirname(nxJsonPath) : null;\n};\n\n/**\n * Get secondary entry points from tsconfig.base.json.\n * These are path mappings that point to index.ts files inside src/ subdirectories.\n * Results are cached per workspace root.\n */\nconst getSecondaryEntryPoints = (workspaceRoot: string): Set<string> => {\n const cached = secondaryEntryPointsCache.get(workspaceRoot);\n if (cached) {\n return cached;\n }\n\n const entryPoints = new Set<string>();\n const tsconfigPath = path.join(workspaceRoot, \"tsconfig.base.json\");\n\n try {\n const tsconfigContent = fs.readFileSync(tsconfigPath, \"utf-8\");\n const parsed = tsconfigSchema.safeParse(JSON.parse(tsconfigContent));\n\n if (parsed.success && parsed.data.compilerOptions?.paths) {\n const paths = parsed.data.compilerOptions.paths;\n\n for (const pathMappings of Object.values(paths)) {\n for (const mapping of pathMappings) {\n // Only consider mappings that point to index.ts files\n if (mapping.endsWith(\"/index.ts\") || mapping.endsWith(\"/index.tsx\")) {\n const absolutePath = path.normalize(path.join(workspaceRoot, mapping));\n entryPoints.add(absolutePath);\n }\n }\n }\n }\n } catch {\n // If we can't read tsconfig.base.json, return empty set\n }\n\n secondaryEntryPointsCache.set(workspaceRoot, entryPoints);\n return entryPoints;\n};\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}.ts`\n);\n\ntype MessageIds = \"noInternalBarrel\";\ntype Options = [];\n\n/**\n * Check if a file is a barrel file (index.ts or index.tsx).\n */\nconst isBarrelFile = (filePath: string): boolean => {\n const basename = path.basename(filePath);\n return basename === \"index.ts\" || basename === \"index.tsx\";\n};\n\n/**\n * Normalize file path for comparison (handles potential trailing slashes, etc.)\n */\nconst normalizePath = (filePath: string): string => {\n return path.normalize(filePath);\n};\n\nexport const noInternalBarrelFiles = createRule<Options, MessageIds>({\n name: \"no-internal-barrel-files\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow internal barrel files (index.ts) that are not at the library root or configured as secondary entry points\",\n },\n schema: [],\n messages: {\n noInternalBarrel:\n \"Internal barrel files are not allowed. Move exports to the root barrel file (src/index.ts) instead. Use the flatten-barrel-exports tool: yarn ts-node devtools/flatten-barrel-exports/flatten-barrel-exports.ts\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n Program(node) {\n const currentFile = context.filename;\n\n // Only analyze barrel files (index.ts/tsx)\n if (!isBarrelFile(currentFile)) {\n return;\n }\n\n // Find the project root by looking for project.json\n const projectJsonPath = findNearestFile(currentFile, \"project.json\");\n if (projectJsonPath === null) {\n // Not in an NX project, skip\n return;\n }\n\n const projectRoot = path.dirname(projectJsonPath);\n const workspaceRoot = findWorkspaceRoot(currentFile);\n\n // Read sourceRoot from project.json, defaulting to \"src\" if not specified\n // sourceRoot in project.json is relative to workspace root (e.g., \"libs/my-lib/src\")\n let sourceRootAbsolute = path.join(projectRoot, \"src\");\n try {\n const projectJsonContent = fs.readFileSync(projectJsonPath, \"utf-8\");\n const parsed = projectJsonSchema.safeParse(JSON.parse(projectJsonContent));\n if (parsed.success && parsed.data.sourceRoot && workspaceRoot) {\n // sourceRoot is relative to workspace root, so resolve it\n sourceRootAbsolute = path.join(workspaceRoot, parsed.data.sourceRoot);\n }\n } catch {\n // If we can't read project.json, fall back to projectRoot/src\n }\n\n // The root barrel is at {sourceRoot}/index.ts or {sourceRoot}/index.tsx\n const rootBarrelTs = normalizePath(path.join(sourceRootAbsolute, \"index.ts\"));\n const rootBarrelTsx = normalizePath(path.join(sourceRootAbsolute, \"index.tsx\"));\n const normalizedCurrentFile = normalizePath(currentFile);\n\n // If this IS the root barrel, it's allowed\n if (normalizedCurrentFile === rootBarrelTs || normalizedCurrentFile === rootBarrelTsx) {\n return;\n }\n\n // Check if this is a secondary entry point configured in tsconfig.base.json\n if (workspaceRoot) {\n const secondaryEntryPoints = getSecondaryEntryPoints(workspaceRoot);\n if (secondaryEntryPoints.has(normalizedCurrentFile)) {\n // This is a configured secondary entry point, allow it\n return;\n }\n }\n\n // This is an internal barrel file - flag it\n // Note: No autofix or suggestion is provided because:\n // 1. The exports need to be moved to the root barrel\n // 2. Imports throughout the codebase may need updating\n // 3. The flatten-barrel-exports tool handles this properly\n context.report({\n node,\n messageId: \"noInternalBarrel\",\n });\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-internal-graphql-when-tagged-with-gql-public.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-internal-graphql-when-tagged-with-gql-public/no-internal-graphql-when-tagged-with-gql-public.ts"],"names":[],"mappings":";;;;AAAA,oDAAuD;AACvD,+CAAyB;AACzB,mDAA6B;AAE7B,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,IAAI,IAAI,KAAK,CACvH,CAAC;AAKW,QAAA,wCAAwC,GAAG,UAAU,CAAsB;IACtF,IAAI,EAAE,iDAAiD;IACvD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,yEAAyE;SACvF;QACD,QAAQ,EAAE;YACR,wBAAwB,EAAE,8EAA8E;SACzG;QACD,MAAM,EAAE,EAAE;KACX;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E,QAAQ,EAAE;wBACxB,GAAG,EAAE,4BAA4B,CAAC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;qBAClF,CAAC,CAAC;oBACH,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QACF,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,EAAE;gBACf,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;gBAC7C,IAAI,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;oBAC7C,MAAM,iBAAiB,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;oBAClE,MAAM,WAAW,GAA6B,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;oBAC5E,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;wBAC/E,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;wBAChD,qCAAqC,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;oBACvE,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils } from \"@typescript-eslint/utils\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}/${name}.ts`\n);\n\ntype MessageIds = \"internalGraphqlFileFound\";\ntype Options = [];\n\nexport const noInternalGraphqlWhenTaggedWithGqlPublic = createRule<Options, MessageIds>({\n name: \"no-internal-graphql-when-tagged-with-gql-public\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow '-internal.graphql' files in projects tagged with 'gql:public'\",\n },\n messages: {\n internalGraphqlFileFound: \"'*-internal.graphql' file found in a 'gql:public' tagged project. - {{path}}\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n const getLineAndColumnFromPosition = (content: string, position: number) => {\n const lines = content.substring(0, position).split(\"\\n\");\n const line = lines.length;\n const column = lines[lines.length - 1]?.length ?? 0;\n return { line, column };\n };\n\n const checkDirectoryForInternalGraphQLFiles = (directory: string, projectJson: string) => {\n const entries = fs.readdirSync(directory, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = path.join(directory, entry.name);\n\n // Handle broken symlinks or inaccessible paths gracefully\n let stat: fs.Stats;\n try {\n stat = fs.statSync(fullPath);\n } catch {\n // Skip paths that can't be accessed (broken symlinks, permission issues, etc.)\n continue;\n }\n\n if (stat.isDirectory()) {\n checkDirectoryForInternalGraphQLFiles(fullPath, projectJson);\n } else if (entry.name.endsWith(\"-internal.graphql\")) {\n context.report({\n messageId: \"internalGraphqlFileFound\",\n data: { path: fullPath },\n loc: getLineAndColumnFromPosition(projectJson, projectJson.indexOf(\"gql:public\")),\n });\n return;\n }\n }\n };\n return {\n Program: _node => {\n const sourceFilePath = context.getFilename();\n if (sourceFilePath.endsWith(\"/project.json\")) {\n const projectJsonString = fs.readFileSync(sourceFilePath, \"utf8\");\n const projectJson: { tags?: Array<string> } = JSON.parse(projectJsonString);\n if (Array.isArray(projectJson.tags) && projectJson.tags.includes(\"gql:public\")) {\n const projectDir = path.dirname(sourceFilePath);\n checkDirectoryForInternalGraphQLFiles(projectDir, projectJsonString);\n }\n }\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-jest-mock-trackunit-react-core-hooks.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-jest-mock-trackunit-react-core-hooks/no-jest-mock-trackunit-react-core-hooks.ts"],"names":[],"mappings":";;;AAAA,oDAAuD;AAEvD,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CACL,6FAA6F,IAAI,IAAI,IAAI,KAAK,CACjH,CAAC;AAKW,QAAA,iCAAiC,GAAG,UAAU,CAAsB;IAC/E,IAAI,EAAE,yCAAyC;IAC/C,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;SAC1E;QACD,QAAQ,EAAE;YACR,YAAY,EACV,oKAAoK;SACvK;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,cAAc,CAAC,IAAI;gBACjB,IACE,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;oBACvC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;oBACxC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM;oBAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;oBAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,MAAM;oBACpC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,SAAS;oBACrC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,6BAA6B,EACzD,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,cAAc;qBAC1B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { ESLintUtils } from \"@typescript-eslint/utils\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name =>\n `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}/${name}.ts`\n);\n\ntype MessageIds = \"noDirectMock\";\ntype Options = [];\n\nexport const noJestMockTrackunitReactCoreHooks = createRule<Options, MessageIds>({\n name: \"no-jest-mock-trackunit-react-core-hooks\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow direct jest.mock() of @trackunit/react-core-hooks\",\n },\n messages: {\n noDirectMock:\n 'Don\\'t use jest.mock(\"@trackunit/react-core-hooks\"). Use mock builder from trackunitProviders(), trackunitProvidersInternal() or trackunitProvidersHost() instead.',\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node) {\n if (\n node.callee.type === \"MemberExpression\" &&\n node.callee.object.type === \"Identifier\" &&\n node.callee.object.name === \"jest\" &&\n node.callee.property.type === \"Identifier\" &&\n node.callee.property.name === \"mock\" &&\n node.arguments[0]?.type === \"Literal\" &&\n node.arguments[0].value === \"@trackunit/react-core-hooks\"\n ) {\n context.report({\n node,\n messageId: \"noDirectMock\",\n });\n }\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-template-strings-in-classname-prop.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-template-strings-in-classname-prop/no-template-strings-in-classname-prop.ts"],"names":[],"mappings":";;;AAAA,oDAAiF;AACjF,iEAAmE;AAEnE,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,KAAK,CAC/G,CAAC;AAKF;;;;;;;;;;;GAWG;AACU,QAAA,4BAA4B,GAAG,UAAU,CAAsB;IAC1E,IAAI,EAAE,uCAAuC;IAC7C,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,8FAA8F;SAC5G;QACD,QAAQ,EAAE;YACR,yBAAyB,EACvB,+LAA+L;SAClM;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL;;;;;;eAMG;YACH,YAAY,CAAC,IAA2B;gBACtC,8DAA8D;gBAC9D,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,aAAa,IAAI,CAAC,IAAA,sCAAoB,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7F,OAAO;gBACT,CAAC;gBAED,yEAAyE;gBACzE,IACE,IAAI,CAAC,KAAK,EAAE,IAAI,KAAK,sBAAc,CAAC,sBAAsB;oBAC1D,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,sBAAc,CAAC,eAAe,EAC7D,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { AST_NODE_TYPES, ESLintUtils, TSESTree } from \"@typescript-eslint/utils\";\nimport { isClassnameAttribute } from \"../../utils/classname-utils\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}.ts`\n);\n\ntype MessageIds = \"templateStringInClassName\";\ntype Options = [];\n\n/**\n * ESLint rule to disallow template strings in className prop.\n *\n * @example\n * // Bad\n * <div className={`${dynamicClass} staticClass`}>Content</div>\n *\n * // Good\n * <div className={twMerge(dynamicClassName, \"staticClassName\")}>Content</div>\n * // or\n * <div className={yourCvaMergeFunction({ yourVariantProp, className: \"extraClassName\" })}>Content</div>\n */\nexport const noTemplateStringsInClassName = createRule<Options, MessageIds>({\n name: \"no-template-strings-in-classname-prop\",\n meta: {\n type: \"suggestion\",\n docs: {\n description: \"Disallow the use of template strings in className prop to encourage better class management.\",\n },\n messages: {\n templateStringInClassName:\n \"Do not use template strings in className prop. If you wish to merge classes from different sources, use twMerge() for simple inline merging or make a cvaMerge() function if it has variants.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n return {\n /**\n * Handle JSXAttribute with className prop that uses template strings.\n *\n * @example\n * // Bad\n * <div className={`${dynamicClass} staticClass`}>Content</div>\n */\n JSXAttribute(node: TSESTree.JSXAttribute) {\n // Check if this is a classname attribute (className or class)\n if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || !isClassnameAttribute(node.name.name)) {\n return;\n }\n\n // Check if the value is a template literal in a JSX expression container\n if (\n node.value?.type === AST_NODE_TYPES.JSXExpressionContainer &&\n node.value.expression.type === AST_NODE_TYPES.TemplateLiteral\n ) {\n context.report({ node, messageId: \"templateStringInClassName\" });\n }\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-typescript-assertion.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-typescript-assertion/no-typescript-assertion.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,oDAAiF;AAEjF,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,IAAI,IAAI,KAAK,CACvH,CAAC;AAKF,SAAS,sBAAsB,CAAC,cAAiC;IAC/D,IAAI,cAAc,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB,EAAE,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,cAAc,CAAC,IAAI,KAAK,sBAAc,CAAC,eAAe,EAAE,CAAC;QAC3D,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QACpC,IAAI,QAAQ,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7E,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAEY,QAAA,qBAAqB,GAAG,UAAU,CAAsB;IACnE,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,qEAAqE;SACnF;QACD,QAAQ,EAAE;YACR,qBAAqB,EAAE,wEAAwE;YAC/F,WAAW,EAAE,2EAA2E;YACxF,gBAAgB,EAAE,iFAAiF;SACpG;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,eAAe,CAAC,IAA8B;gBAC5C,IAAI,sBAAsB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;oBAChD,OAAO;gBACT,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC,CAAC;YAC/D,CAAC;YACD,cAAc,CAAC,IAA6B;gBAC1C,IAAI,sBAAsB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;oBAChD,OAAO;gBACT,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;YACrD,CAAC;YACD,mBAAmB,CAAC,IAAkC;gBACpD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAC1D,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * ESLint rule to disallow type assertions in TypeScript.\n * Initial implementation based on eslint-plugin-no-type-assertion\n * https://github.com/Dremora/eslint-plugin-no-type-assertion/blob/master/lib/rules/no-type-assertion.js\n *\n * @example\n * // Bad - type assertions bypass type checking\n * const foo = <string> bar;\n * const baz = bar as string;\n * const qux = bar!;\n *\n * // Good - proper typing or const assertions\n * const foo = bar;\n * const options = [\"a\", \"b\"] as const;\n */\nimport { AST_NODE_TYPES, ESLintUtils, TSESTree } from \"@typescript-eslint/utils\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}/${name}.ts`\n);\n\ntype MessageIds = \"angleBracketAssertion\" | \"asAssertion\" | \"nonNullAssertion\";\ntype Options = [];\n\nfunction isAllowedTypeAssertion(typeAnnotation: TSESTree.TypeNode): boolean {\n if (typeAnnotation.type === AST_NODE_TYPES.TSUnknownKeyword) {\n return true;\n }\n if (typeAnnotation.type === AST_NODE_TYPES.TSTypeReference) {\n const { typeName } = typeAnnotation;\n if (typeName.type === AST_NODE_TYPES.Identifier && typeName.name === \"const\") {\n return true;\n }\n }\n return false;\n}\n\nexport const noTypescriptAssertion = createRule<Options, MessageIds>({\n name: \"no-typescript-assertion\",\n meta: {\n type: \"suggestion\",\n docs: {\n description: \"Prevent the use of type assertions to encourage better type safety.\",\n },\n messages: {\n angleBracketAssertion: \"Avoid using angle bracket for type casting. It bypasses type checking.\",\n asAssertion: \"Avoid using the `as` keyword for type casting. It bypasses type checking.\",\n nonNullAssertion: \"Avoid using the non-null assertion operator (!). It can lead to runtime errors.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n return {\n TSTypeAssertion(node: TSESTree.TSTypeAssertion) {\n if (isAllowedTypeAssertion(node.typeAnnotation)) {\n return;\n }\n context.report({ node, messageId: \"angleBracketAssertion\" });\n },\n TSAsExpression(node: TSESTree.TSAsExpression) {\n if (isAllowedTypeAssertion(node.typeAnnotation)) {\n return;\n }\n context.report({ node, messageId: \"asAssertion\" });\n },\n TSNonNullExpression(node: TSESTree.TSNonNullExpression) {\n context.report({ node, messageId: \"nonNullAssertion\" });\n },\n };\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefer-destructured-imports.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/prefer-destructured-imports/prefer-destructured-imports.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAEH,oDAAiF;AACjF,2DAAiG;AAEjG,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,I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AAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gCAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,UAAU,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;gCACtE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;4BAC/C,CAAC;4BAED,OAAO,KAAK,CAAC;wBACf,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * @fileoverview Enforce destructured imports instead of namespace imports for configured packages.\n * This rule helps maintain consistent import styles by converting namespace imports and detecting global UMD usage.\n * @example\n * // ❌ Bad (namespace import)\n * import React from \"react\";\n * const Component = () => {\n * React.useEffect(() => {}, []);\n * return <div />;\n * };\n *\n * // ✅ Good (destructured import)\n * import { useEffect } from \"react\";\n * const Component = () => {\n * useEffect(() => {}, []);\n * return <div />;\n * };\n * @example\n * // ❌ Bad (global UMD usage without import)\n * interface Props {\n * children: React.ReactNode;\n * }\n *\n * // ✅ Good (explicit import)\n * import { ReactNode } from \"react\";\n * interface Props {\n * children: ReactNode;\n * }\n */\n\nimport { AST_NODE_TYPES, ESLintUtils, TSESTree } from \"@typescript-eslint/utils\";\nimport { addImportSpecifiers, replaceNamespaceWithDestructured } from \"../../utils/import-utils\";\n\nconst createRule = ESLintUtils.RuleCreator(\n name => `https://github.com/trackunit/manager/blob/main/libs/eslint/plugin-trackunit/src/lib/rules/${name}.ts`\n);\n\ntype MessageIds = \"preferDestructured\" | \"preferDestructuredGlobal\";\n\ntype PackageConfig = {\n /** Mapping of package names to their global UMD variable names (e.g., { \"react\": \"React\", \"lodash\": \"_\" }) */\n packages: Record<string, string>;\n};\n\ntype Options = [PackageConfig?];\n\n/**\n * ESLint rule: prefer-destructured-imports\n *\n * ## Configuration\n *\n * This rule requires explicit configuration to specify which packages to enforce.\n * Without configuration, the rule does nothing.\n *\n * @example\n * // .eslintrc.js - Enforce for React\n * {\n * \"rules\": {\n * \"@trackunit/prefer-destructured-imports\": [\"error\", {\n * \"packages\": {\n * \"react\": \"React\"\n * }\n * }]\n * }\n * }\n * @example\n * // .eslintrc.js - Multiple packages\n * {\n * \"rules\": {\n * \"@trackunit/prefer-destructured-imports\": [\"error\", {\n * \"packages\": {\n * \"react\": \"React\",\n * \"lodash\": \"_\",\n * \"jquery\": \"$\"\n * }\n * }]\n * }\n * }\n */\nexport const preferDestructuredImports = createRule<Options, MessageIds>({\n name: \"prefer-destructured-imports\",\n meta: {\n type: \"suggestion\",\n docs: {\n description: \"Prefer destructured imports instead of namespace imports for certain packages\",\n },\n fixable: \"code\",\n schema: [\n {\n type: \"object\",\n properties: {\n packages: {\n type: \"object\",\n description: \"Mapping of package names to their global UMD variable names (e.g., { 'react': 'React' })\",\n additionalProperties: {\n type: \"string\",\n },\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n preferDestructured: \"Prefer destructured imports instead of namespace imports\",\n preferDestructuredGlobal:\n \"Import '{{members}}' from '{{packageName}}' instead of using the global {{globalName}} variable\",\n },\n },\n defaultOptions: [],\n create(context) {\n const sourceCode = context.sourceCode;\n const options = context.options[0];\n\n // Return early if no packages are configured\n if (options === undefined || Object.keys(options.packages).length === 0) {\n return {};\n }\n\n const packageToGlobalName = options.packages;\n const targetPackages = Object.keys(packageToGlobalName);\n\n // Helper to check if a string is a valid/configured package name\n const isValidPackageName = (value: string): boolean => {\n return targetPackages.includes(value);\n };\n\n // Track which global identifiers are actually imported (to avoid false positives)\n const importedGlobalIdentifiers = new Set<string>();\n\n const namespaceImports = new Map<string, { node: TSESTree.ImportDeclaration; existingSpecifiers: Set<string> }>();\n const usagesByImport = new Map<string, Map<number, { name: string; start: number; end: number }>>();\n\n // Track usages of global identifiers that aren't imported (e.g., React.ReactElement without importing React)\n const globalUsages = new Map<string, { packageName: string; members: Set<string>; nodes: Array<TSESTree.Node> }>();\n\n return {\n ImportDeclaration(node: TSESTree.ImportDeclaration) {\n const sourceValue = node.source.value;\n if (typeof sourceValue === \"string\" && isValidPackageName(sourceValue)) {\n const globalName = packageToGlobalName[sourceValue];\n\n // Get any existing destructured imports\n const existingSpecifiers = new Set(\n node.specifiers\n .filter((s): s is TSESTree.ImportSpecifier => s.type === AST_NODE_TYPES.ImportSpecifier)\n .map(s => s.local.name)\n );\n\n // Find the namespace or default import if it exists\n const namespaceOrDefaultSpecifier = node.specifiers.find(\n (s): s is TSESTree.ImportDefaultSpecifier | TSESTree.ImportNamespaceSpecifier =>\n s.type === AST_NODE_TYPES.ImportDefaultSpecifier || s.type === AST_NODE_TYPES.ImportNamespaceSpecifier\n );\n\n if (namespaceOrDefaultSpecifier) {\n const importName = namespaceOrDefaultSpecifier.local.name;\n // Only mark this global as imported if the import name matches the global name\n // This prevents false positives when someone imports React as a different name\n if (importName === globalName) {\n importedGlobalIdentifiers.add(globalName);\n }\n\n // If this import also has destructured specifiers, store it as both\n if (existingSpecifiers.size > 0) {\n namespaceImports.set(\"destructured\", { node, existingSpecifiers });\n }\n namespaceImports.set(importName, { node, existingSpecifiers });\n usagesByImport.set(importName, new Map());\n } else if (existingSpecifiers.size > 0) {\n // Store pure destructured imports\n namespaceImports.set(\"destructured\", { node, existingSpecifiers });\n // Do NOT mark the global as imported - we want to catch global usage even with destructured imports\n }\n }\n },\n\n // Handle React.something in regular code\n MemberExpression(node: TSESTree.MemberExpression) {\n const objectNode = node.object;\n\n if (objectNode.type === AST_NODE_TYPES.Identifier && node.property.type === AST_NODE_TYPES.Identifier) {\n // Check if this is a tracked namespace import\n if (namespaceImports.has(objectNode.name)) {\n const usages = usagesByImport.get(objectNode.name);\n if (usages) {\n usages.set(node.range[0], {\n name: node.property.name,\n start: node.range[0],\n end: node.range[1],\n });\n }\n }\n // Check if this is a global identifier usage (e.g., React.ReactElement without import)\n else if (!importedGlobalIdentifiers.has(objectNode.name)) {\n // Find if this identifier matches any of our configured global names\n for (const packageName of targetPackages) {\n const globalName = packageToGlobalName[packageName];\n if (objectNode.name === globalName) {\n if (!globalUsages.has(globalName)) {\n globalUsages.set(globalName, {\n packageName: packageName,\n members: new Set(),\n nodes: [],\n });\n }\n const usage = globalUsages.get(globalName);\n if (usage) {\n usage.members.add(node.property.name);\n usage.nodes.push(node);\n }\n break;\n }\n }\n }\n }\n },\n\n // Handle React.ReactNode in type annotations\n TSQualifiedName(node: TSESTree.TSQualifiedName) {\n if (node.left.type === AST_NODE_TYPES.Identifier) {\n // Check if this is a tracked namespace import\n if (namespaceImports.has(node.left.name)) {\n const usages = usagesByImport.get(node.left.name);\n if (usages) {\n usages.set(node.range[0], {\n name: node.right.name,\n start: node.range[0],\n end: node.range[1],\n });\n }\n }\n // Check if this is a global identifier usage\n else if (!importedGlobalIdentifiers.has(node.left.name)) {\n for (const packageName of targetPackages) {\n const globalName = packageToGlobalName[packageName];\n if (node.left.name === globalName) {\n if (!globalUsages.has(globalName)) {\n globalUsages.set(globalName, {\n packageName: packageName,\n members: new Set(),\n nodes: [],\n });\n }\n const usage = globalUsages.get(globalName);\n if (usage) {\n usage.members.add(node.right.name);\n usage.nodes.push(node);\n }\n break;\n }\n }\n }\n }\n },\n\n // Note: TSQualifiedName already handles React.ReactElement, React.RefObject, etc.\n // This visitor is kept for potential future expansion but currently does nothing\n // to avoid duplicate tracking with TSQualifiedName\n TSTypeReference(_node: TSESTree.TSTypeReference) {\n // TSQualifiedName visitor handles all qualified type names (React.Something)\n // No action needed here\n },\n\n \"Program:exit\"() {\n // Report errors for namespace imports\n for (const [importName, { node: importNode }] of namespaceImports) {\n const usages = usagesByImport.get(importName);\n if (!usages || usages.size === 0) {\n continue;\n }\n\n const sourceValue = importNode.source.value;\n\n if (typeof sourceValue !== \"string\" || !isValidPackageName(sourceValue)) {\n continue;\n }\n\n context.report({\n node: importNode,\n messageId: \"preferDestructured\",\n fix(fixer) {\n const fixes = [];\n\n // Collect all specifiers needed from usages (e.g., [\"useState\", \"useEffect\"] from React.useState, React.useEffect)\n const specifiersFromUsages = Array.from(usages.values()).map(usage => usage.name);\n\n // Check if there's a separate destructured import to merge with\n const existingDestructured = namespaceImports.get(\"destructured\");\n const otherDestructuredImport =\n existingDestructured && existingDestructured.node !== importNode\n ? existingDestructured.node\n : undefined;\n\n // Replace the namespace import with destructured imports (merges if other import exists)\n fixes.push(\n ...replaceNamespaceWithDestructured({\n sourceCode,\n fixer,\n packageName: sourceValue,\n namespaceImportToReplace: importNode,\n specifiersToAdd: specifiersFromUsages,\n mergeIntoImport: otherDestructuredImport,\n })\n );\n\n // Remove namespace/default prefix from all usages\n for (const { start, end } of usages.values()) {\n const text = sourceCode.getText().slice(start, end);\n const newText = text.replace(new RegExp(`^${importName}\\\\.`), \"\");\n fixes.push(fixer.replaceTextRange([start, end], newText));\n }\n\n return fixes;\n },\n });\n }\n\n // Report errors for global UMD variable usages (e.g., React.ReactElement without import)\n for (const [globalName, { packageName, members, nodes }] of globalUsages) {\n if (members.size === 0 || nodes.length === 0) {\n continue;\n }\n\n // Report on the first usage node\n const firstNode = nodes[0];\n if (!firstNode) {\n continue;\n }\n\n const membersList = Array.from(members);\n const existingDestructured = namespaceImports.get(\"destructured\");\n\n // Filter out members that are already imported (no need to add them again)\n const membersToAdd = existingDestructured\n ? membersList.filter(member => !existingDestructured.existingSpecifiers.has(member))\n : membersList;\n\n context.report({\n node: firstNode,\n messageId: \"preferDestructuredGlobal\",\n data: {\n globalName,\n packageName,\n members: membersList.sort().join(\", \"), // Sort only for display in error message\n },\n fix(fixer) {\n const fixes = [];\n\n // Only update imports if there are new members to add\n if (membersToAdd.length > 0) {\n fixes.push(\n ...addImportSpecifiers({\n sourceCode,\n fixer,\n packageName,\n specifiers: membersToAdd,\n existingImport: existingDestructured?.node,\n })\n );\n }\n\n // Replace all global usages (React.X → X)\n // Deduplicate nodes by range and sort by position (reverse order to maintain positions)\n const uniqueNodesByRange = new Map<string, TSESTree.Node>();\n for (const node of nodes) {\n const rangeKey = `${node.range[0]}-${node.range[1]}`;\n if (!uniqueNodesByRange.has(rangeKey)) {\n uniqueNodesByRange.set(rangeKey, node);\n }\n }\n\n const sortedNodes = Array.from(uniqueNodesByRange.values()).sort((a, b) => b.range[0] - a.range[0]);\n\n for (const node of sortedNodes) {\n const nodeText = sourceCode.getText(node);\n const newText = nodeText.replace(new RegExp(`^${globalName}\\\\.`), \"\");\n fixes.push(fixer.replaceText(node, newText));\n }\n\n return fixes;\n },\n });\n }\n },\n };\n },\n});\n"]}