@trackunit/eslint-plugin-trackunit 0.6.170 → 0.6.171-alpha-e1e6a0f33ce.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations/entry.js.map +1 -0
- package/package.json +2 -2
- package/src/index.js.map +1 -0
- package/src/lib/config/fragments/ignores.js.map +1 -0
- package/src/lib/config/fragments/import-rules.js.map +1 -0
- package/src/lib/config/fragments/jest-overrides.js.map +1 -0
- package/src/lib/config/fragments/jsdoc-rules.js.map +1 -0
- package/src/lib/config/fragments/module-boundaries.js.map +1 -0
- package/src/lib/config/fragments/no-direct-storage-access.js.map +1 -0
- package/src/lib/config/fragments/react-rules.js.map +1 -0
- package/src/lib/config/fragments/restricted-imports.js.map +1 -0
- package/src/lib/config/fragments/story-relaxations.js.map +1 -0
- package/src/lib/config/fragments/testing-library.js.map +1 -0
- package/src/lib/config/fragments/typescript-rules.js.map +1 -0
- package/src/lib/config/index.js.map +1 -0
- package/src/lib/config/plugins.js.map +1 -0
- package/src/lib/config/presets/base.js.map +1 -0
- package/src/lib/config/presets/e2e.js.map +1 -0
- package/src/lib/config/presets/react.js.map +1 -0
- package/src/lib/config/presets/server.js.map +1 -0
- package/src/lib/config/utils.js.map +1 -0
- package/src/lib/config-helpers/create-skip-when.js.map +1 -0
- package/src/lib/rules/component-name-matches-filename/component-name-matches-filename.js.map +1 -0
- package/src/lib/rules/cva-merge-base-classes-as-array/cva-merge-base-classes-as-array.js.map +1 -0
- package/src/lib/rules/design-guideline-icon-size-match/design-guideline-icon-size-match.js.map +1 -0
- package/src/lib/rules/no-deprecated-graphql-fields/no-deprecated-graphql-fields.js.map +1 -0
- package/src/lib/rules/no-deprecated-graphql-fields/schema-cache.js.map +1 -0
- package/src/lib/rules/no-dynamic-translation-key/no-dynamic-translation-key.js.map +1 -0
- package/src/lib/rules/no-internal-barrel-files/no-internal-barrel-files.js.map +1 -0
- package/src/lib/rules/no-internal-graphql-when-tagged-with-gql-public/no-internal-graphql-when-tagged-with-gql-public.js.map +1 -0
- package/src/lib/rules/no-jest-mock-trackunit-react-core-hooks/no-jest-mock-trackunit-react-core-hooks.js.map +1 -0
- package/src/lib/rules/no-local-meta-component/no-local-meta-component.js.map +1 -0
- package/src/lib/rules/no-template-strings-in-classname-prop/no-template-strings-in-classname-prop.js.map +1 -0
- package/src/lib/rules/no-typescript-assertion/no-typescript-assertion.js.map +1 -0
- package/src/lib/rules/no-unused-translation-key/expand-dynamic-key.js.map +1 -0
- package/src/lib/rules/no-unused-translation-key/no-unused-translation-key.js.map +1 -0
- package/src/lib/rules/no-unused-translation-key/used-strings.js.map +1 -0
- package/src/lib/rules/one-component-per-file/one-component-per-file.js.map +1 -0
- package/src/lib/rules/prefer-destructured-imports/prefer-destructured-imports.js.map +1 -0
- package/src/lib/rules/prefer-event-specific-callback-naming/name-suggestion-strategies.js.map +1 -0
- package/src/lib/rules/prefer-event-specific-callback-naming/prefer-event-specific-callback-naming.js.map +1 -0
- package/src/lib/rules/prefer-event-specific-callback-naming/strategies/string-based.js.map +1 -0
- package/src/lib/rules/prefer-event-specific-callback-naming/strategies/type-based.js.map +1 -0
- package/src/lib/rules/prefer-event-specific-callback-naming/utils.js.map +1 -0
- package/src/lib/rules/prefer-field-components/prefer-field-components.js.map +1 -0
- package/src/lib/rules/prefer-mouse-event-handler-in-react-props/prefer-mouse-event-handler-in-react-props.js.map +1 -0
- package/src/lib/rules/require-classname-alternatives/require-classname-alternatives.js.map +1 -0
- package/src/lib/rules/require-component-prop-contracts/require-component-prop-contracts.js.map +1 -0
- package/src/lib/rules/require-csf-factory/require-csf-factory.js.map +1 -0
- package/src/lib/rules/require-list-item-virtualization-props/require-list-item-virtualization-props.js.map +1 -0
- package/src/lib/rules/require-optional-prop-initialization/require-optional-prop-initialization.js.map +1 -0
- package/src/lib/rules/require-optional-prop-initialization/suggestion-utils.js.map +1 -0
- package/src/lib/rules/require-storybook-folder-landing-page/require-storybook-folder-landing-page.js.map +1 -0
- package/src/lib/rules-map.js.map +1 -0
- package/src/lib/utils/ast-utils.js.map +1 -0
- package/src/lib/utils/component-utils.js.map +1 -0
- package/src/lib/utils/file-utils.js.map +1 -0
- package/src/lib/utils/import-utils.js.map +1 -0
- package/src/lib/utils/nx-utils.js.map +1 -0
- package/src/lib/utils/package-utils.js.map +1 -0
- package/src/lib/utils/program-utils.js.map +1 -0
- package/src/lib/utils/translation-key-types.js.map +1 -0
- package/src/lib/utils/typescript-utils.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/eslint/plugin-trackunit/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/eslint-plugin-trackunit",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.171-alpha-e1e6a0f33ce.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"repository": "https://github.com/Trackunit/manager",
|
|
6
6
|
"engines": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@nx/eslint-plugin": "23.1.0",
|
|
11
|
-
"@trackunit/css-classname-utils": "0.0.
|
|
11
|
+
"@trackunit/css-classname-utils": "0.0.72-alpha-e1e6a0f33ce.0",
|
|
12
12
|
"@typescript-eslint/eslint-plugin": "8.70.1",
|
|
13
13
|
"@typescript-eslint/utils": "8.70.1",
|
|
14
14
|
"eslint-config-prettier": "^10.1.8",
|
package/src/index.js.map
ADDED
|
@@ -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,gFAAkF;AAAzE,2HAAA,qBAAqB,OAAA;AAC9B,8EAA4F;AAAnF,mHAAA,cAAc,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AACzC,gDAAmH;AAA1G,kGAAA,OAAO,OAAA;AAAE,gGAAA,KAAK,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AAAE,6FAAA,EAAE,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,0GAAA,eAAe,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 { restrictedImportRules } from \"./lib/config/fragments/restricted-imports\";\nexport { storyFileGlobs, storyRelaxations } from \"./lib/config/fragments/story-relaxations\";\nexport { globals, jsdoc, localRulesPlugin, nx, reactHooks, storybookPlugin, 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,mBAAmB;QACnB,kBAAkB;QAClB,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 \"**/vite*.config.*\",\n \"**/vite*.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;IACvB,4BAA4B,EAAE,MAAM;CACrC,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,oBAAoB;oBACpB,oBAAoB;oBACpB,iBAAiB;oBACjB,iBAAiB;oBACjB,mBAAmB;oBACnB,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 \"import-x/no-default-export\": \"warn\",\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 \"**/*.spec.{ts,tsx}\",\n \"**/*.test.{ts,tsx}\",\n \"**/jest.setup.*\",\n \"**/vite.setup.*\",\n \"**/vite.config.ts\",\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,IAAI;QACjB,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,4FAA4F;QAC5F,8EAA8E;QAC9E,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE,mBAAmB,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC;QACpF,oCAAoC,EAAE,KAAK;QAC3C,sCAAsC,EAAE,KAAK;QAC7C,0CAA0C,EAAE,KAAK;QACjD,oCAAoC,EAAE,KAAK;QAC3C,oDAAoD,EAAE,OAAO;QAC7D,YAAY,EAAE,KAAK;QACnB,uBAAuB,EAAE,KAAK;QAC9B,0BAA0B,EAAE,KAAK;QACjC,+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: 2022,\n sourceType: \"module\",\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 // Recognise vitest's `expectTypeOf` (compile-time-only type assertions) alongside `expect`,\n // otherwise specs that only assert types are flagged as having no assertions.\n \"jest/expect-expect\": [\"error\", { assertFunctionNames: [\"expect\", \"expectTypeOf\"] }],\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 \"no-restricted-globals\": \"off\",\n \"no-restricted-properties\": \"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;SACd;KACF;IACD,uBAAuB,EAAE,OAAO;IAChC,wBAAwB,EAAE,KAAK;IAC/B,yBAAyB,EAAE,KAAK;IAChC,4BAA4B,EAAE;QAC5B,OAAO;QACP;YACE,QAAQ,EAAE;gBACR;oBACE,OAAO,EAAE,sCAAsC;oBAC/C,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,qDAAqD;iBAC/D;aACF;SACF;KACF;CACF,CAAC;AAEW,QAAA,gBAAgB,GAAuB;IAClD,qBAAqB,EAAE;QACrB,OAAO;QACP;YACE,UAAU,EAAE,IAAI;YAEhB,OAAO,EAAE;gBACP,uBAAuB,EAAE,IAAI;gBAC7B,gBAAgB,EAAE,IAAI;gBACtB,mBAAmB,EAAE,IAAI;gBACzB,kBAAkB,EAAE,IAAI;gBACxB,gBAAgB,EAAE,IAAI;aACvB;SACF;KACF;IAED,0BAA0B,EAAE;QAC1B,OAAO;QACP;YACE,YAAY,EAAE,CAAC,KAAK,CAAC;SACtB;KACF;IAED,yBAAyB,EAAE,OAAO;IAClC,4BAA4B,EAAE,OAAO;IACrC,mBAAmB,EAAE,OAAO;IAC5B,iCAAiC,EAAE,OAAO;IAC1C,oBAAoB,EAAE,OAAO;IAC7B,4BAA4B,EAAE,OAAO;IACrC,wFAAwF;IACxF,0FAA0F;IAC1F,uFAAuF;IACvF,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;IAClE,mBAAmB,EAAE,OAAO;IAC5B,oBAAoB,EAAE,OAAO;IAC7B,uBAAuB,EAAE,OAAO;IAChC,kBAAkB,EAAE,OAAO;IAC3B,6BAA6B,EAAE,OAAO;IACtC,wBAAwB,EAAE,OAAO;IACjC,0BAA0B,EAAE,OAAO;IACnC,wBAAwB,EAAE,OAAO;IACjC,oCAAoC,EAAE,OAAO;IAC7C,6BAA6B,EAAE,OAAO;IACtC,6BAA6B,EAAE,OAAO;IACtC,6BAA6B,EAAE,OAAO;IACtC,mCAAmC,EAAE,OAAO;IAC5C,sBAAsB,EAAE,OAAO;IAC/B,4BAA4B,EAAE,OAAO;CACtC,CAAC","sourcesContent":["import type { Linter } from \"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 // `important` is GLU-1348's docgen-enricher annotation vocabulary (alongside `@expand`,\n // `@category`, and `@ignore`, which are already recognized TypeDoc/JSDoc tags and need no\n // allowlisting here) — see `libs/storybook/docgen-enricher`'s `AnnotationTags` schema.\n \"jsdoc/check-tag-names\": [\"error\", { definedTags: [\"important\"] }],\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,uGAAuG;YACvG,KAAK,EAAE,CAAC,8BAA8B,CAAC;YAEvC,cAAc,EAAE;gBACd;oBACE,SAAS,EAAE,UAAU;oBACrB,wBAAwB,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAE,cAAc,CAAC;oBAC1E,qBAAqB,EAAE,CAAC,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O;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 // Ambient alias for the loading Storybook's preview (`typings/storybook-preview.d.ts`), not a project.\n allow: [\"@trackunit/storybook/preview\"],\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":"no-direct-storage-access.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/no-direct-storage-access.ts"],"names":[],"mappings":";;;AACA,oCAA4C;AAE5C,MAAM,mBAAmB,GACvB,uHAAuH,CAAC;AAC1H,MAAM,qBAAqB,GACzB,6HAA6H,CAAC;AAEnH,QAAA,0BAA0B,GAAqB;IAC1D,OAAO;IACP;QACE,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,mBAAmB;KAC7B;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,qBAAqB;KAC/B;CACF,CAAC;AAEW,QAAA,6BAA6B,GAAqB;IAC7D,OAAO;IACP;QACE,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,mBAAmB;KAC7B;IACD;QACE,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,gBAAgB;QAC1B,OAAO,EAAE,qBAAqB;KAC/B;IACD;QACE,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,cAAc;QACxB,OAAO,EAAE,mBAAmB;KAC7B;IACD;QACE,MAAM,EAAE,YAAY;QACpB,QAAQ,EAAE,gBAAgB;QAC1B,OAAO,EAAE,qBAAqB;KAC/B;CACF,CAAC;AAEF,MAAM,8BAA8B,GAAG;IACrC,iEAAiE;IACjE,wEAAwE;IACxE,mEAAmE;IACnE,0EAA0E;IAC1E,6DAA6D;CAC9D,CAAC;AAEW,QAAA,yCAAyC,GAAkB;IACtE,QAAQ,EAAE,IAAA,wBAAgB,GAAE;IAC5B,KAAK,EAAE,8BAA8B;IACrC,KAAK,EAAE;QACL,0BAA0B,EAAE,KAAK;KAClC;CACF,CAAC;AAEF,4FAA4F;AAC5F,sFAAsF;AACtF,2FAA2F;AAC3F,+FAA+F;AAC/F,MAAM,iCAAiC,GAAG;IACxC,oFAAoF;IACpF,8EAA8E;IAC9E,uFAAuF;IACvF,0FAA0F;IAC1F,6FAA6F;IAC7F,6FAA6F;IAC7F,6CAA6C;CAC9C,CAAC;AAEW,QAAA,wCAAwC,GAAkB;IACrE,QAAQ,EAAE,IAAA,wBAAgB,GAAE;IAC5B,KAAK,EAAE,iCAAiC;IACxC,KAAK,EAAE;QACL,uBAAuB,EAAE,KAAK;KAC/B;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\nimport { findMonorepoRoot } from \"../utils\";\n\nconst localStorageMessage =\n \"Use useLocalStorage or useLocalStorageReducer from @trackunit/react-components instead of direct localStorage access.\";\nconst sessionStorageMessage =\n \"Use useSessionStorage or useSessionStorageReducer from @trackunit/react-components instead of direct sessionStorage access.\";\n\nexport const noDirectStorageGlobalsRule: Linter.RuleEntry = [\n \"error\",\n {\n name: \"localStorage\",\n message: localStorageMessage,\n },\n {\n name: \"sessionStorage\",\n message: sessionStorageMessage,\n },\n];\n\nexport const noDirectStoragePropertiesRule: Linter.RuleEntry = [\n \"error\",\n {\n object: \"window\",\n property: \"localStorage\",\n message: localStorageMessage,\n },\n {\n object: \"window\",\n property: \"sessionStorage\",\n message: sessionStorageMessage,\n },\n {\n object: \"globalThis\",\n property: \"localStorage\",\n message: localStorageMessage,\n },\n {\n object: \"globalThis\",\n property: \"sessionStorage\",\n message: sessionStorageMessage,\n },\n];\n\nconst storageHookImplementationFiles = [\n \"libs/react/components/src/hooks/localStorage/useLocalStorage.ts\",\n \"libs/react/components/src/hooks/localStorage/useLocalStorageReducer.ts\",\n \"libs/react/components/src/hooks/localStorage/useSessionStorage.ts\",\n \"libs/react/components/src/hooks/localStorage/useSessionStorageReducer.ts\",\n \"libs/shared/utils/src/localStorage/localStorageAccessors.ts\",\n];\n\nexport const noDirectStoragePropertyExceptionOverrides: Linter.Config = {\n basePath: findMonorepoRoot(),\n files: storageHookImplementationFiles,\n rules: {\n \"no-restricted-properties\": \"off\",\n },\n};\n\n// Files exempted from the bare `localStorage`/`sessionStorage` globals check (as opposed to\n// `window.localStorage`, covered by noDirectStoragePropertyExceptionOverrides above).\n// Deliberately narrow: only for bundles where pulling in the shared storage helpers' zod +\n// superjson runtime is itself the problem, not a call site that merely predates the migration.\nconst directStorageGlobalExceptionFiles = [\n // A <script defer> loaded synchronously in the <head> of every Iris app iframe (see\n // libs/iris-app-sdk/iris-app-build-utilities/src/plugin-shared/index.html and\n // apps/iris-app-sdk-server/src/app/iris-app-content.ts). Routing its two-number reload\n // guard through readLocalStorageValue/writeLocalStorageValue pulls zod and superjson into\n // this bundle, roughly 4x'ing its size (measured ~31.9 KB -> ~128.6 KB raw, ~9.4 KB -> ~30.4\n // KB gzip) for every one of the ~118 Iris apps' iframe boots — not worth it for two numbers.\n \"apps/iris-app-loader/src/iris-app-loader.ts\",\n];\n\nexport const noDirectStorageGlobalsExceptionOverrides: Linter.Config = {\n basePath: findMonorepoRoot(),\n files: directStorageGlobalExceptionFiles,\n rules: {\n \"no-restricted-globals\": \"off\",\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,EAAE,OAAO;IAC/B,yBAAyB,EAAE,OAAO;IAClC,gCAAgC,EAAE,OAAO;IACzC,+BAA+B,EAAE,OAAO;IACxC,oBAAoB,EAAE,OAAO;IAE7B,0BAA0B,EAAE,OAAO;IACnC,qCAAqC,EAAE,MAAM;IAC7C,kBAAkB,EAAE,MAAM;IAC1B,iCAAiC,EAAE,MAAM;IACzC,yCAAyC,EAAE,MAAM;IACjD,kCAAkC,EAAE,MAAM;IAE1C,gCAAgC,EAAE;QAChC,OAAO;QACP;YACE,QAAQ,EAAE,OAAO;YACjB,iBAAiB,EAAE,QAAQ;YAC3B,KAAK,EAAE,OAAO;SACf;KACF;IAED,eAAe,EAAE,OAAO;IACxB,4BAA4B,EAAE,OAAO;IACrC,sBAAsB,EAAE,OAAO;IAC/B,qBAAqB,EAAE,OAAO;IAC9B,iBAAiB,EAAE,OAAO;IAC1B,4BAA4B,EAAE,OAAO;IACrC,sBAAsB,EAAE,OAAO;IAE/B,wBAAwB,EAAE;QACxB,OAAO;QACP;YACE,cAAc,EAAE,KAAK;SACtB;KACF;CACF,CAAC;AAEW,QAAA,gBAAgB,GAAuB;IAClD,kDAAkD,EAAE,OAAO;IAC3D,2CAA2C,EAAE;QAC3C,OAAO;QACP;YACE,YAAY,EAAE;gBACZ,KAAK,EAAE,CAAC,SAAS,CAAC;gBAClB,IAAI,EAAE,CAAC,SAAS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AAE,eAAe,CAAC;SACjD;KACF;IACD,sDAAsD,EAAE;QACtD,OAAO;QACP;YACE,YAAY,EAAE,CAAC,cAAc,CAAC;SAC/B;KACF;IACD,oCAAoC,EAAE,OAAO;IAC7C,mCAAmC,EAAE,OAAO;IAC5C,4CAA4C,EAAE;QAC5C,OAAO;QACP;YACE,iBAAiB,EAAE;gBACjB,gFAAgF;gBAChF,mDAAmD;gBACnD,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,EAAE;gBAC3C,mFAAmF;gBACnF,kFAAkF;gBAClF,6CAA6C;gBAC7C,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE;aAC7C;SACF;KACF;CACF,CAAC;AAEW,QAAA,4BAA4B,GAAkB;IACzD,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;IACxC,KAAK,EAAE;QACL,6BAA6B,EAAE,OAAO;QACtC,oBAAoB,EAAE,OAAO;KAC9B;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\": \"error\",\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-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 \"@trackunit/one-component-per-file\": \"error\",\n \"@trackunit/component-name-matches-filename\": [\n \"error\",\n {\n allowedMismatches: [\n // i18next convention: every library's translation.tsx exports a `Trans` wrapper\n // named after the library component, not the file.\n { file: \"translation\", component: \"Trans\" },\n // React context pattern: *Context files always contain both the context object and\n // the provider component. The provider can't be renamed to match the file because\n // the context object already uses that name.\n { file: \"*Context\", component: \"*Provider\" },\n ],\n },\n ],\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"]}
|
|
@@ -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,qBAAqB;oBAC3B,OAAO,EAAE,mEAAmE;iBAC7E;gBACD;oBACE,IAAI,EAAE,2CAA2C;oBACjD,OAAO,EAAE,gFAAgF;iBAC1F;gBACD;oBACE,IAAI,EAAE,UAAU;oBAChB,WAAW,EAAE,CAAC,eAAe,CAAC;oBAC9B,OAAO,EAAE,gFAAgF;iBAC1F;gBACD;oBACE,IAAI,EAAE,2BAA2B;oBACjC,OAAO,EAAE,8DAA8D;iBACxE;gBACD;oBACE,IAAI,EAAE,6BAA6B;oBACnC,OAAO,EAAE,8DAA8D;iBACxE;gBACD;oBACE,IAAI,EAAE,KAAK;oBACX,OAAO,EACL,4PAA4P;iBAC/P;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: \"vite-tsconfig-paths\",\n message: \"Import workspace path helpers from workspace-vite-config instead.\",\n },\n {\n name: \"@nx/vite/plugins/nx-tsconfig-paths.plugin\",\n message: \"Deprecated — import workspace path helpers from workspace-vite-config instead.\",\n },\n {\n name: \"@nx/vite\",\n importNames: [\"nxViteTsPaths\"],\n message: \"Deprecated — import workspace path helpers from workspace-vite-config instead.\",\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: \"cva\",\n message:\n \"Import cva/cx from @trackunit/css-class-variance-utilities instead. Ours are bound to a config whose onComplete hook runs every generated class string through tailwind-merge; the raw ones only concatenate, so conflicting utilities would both survive.\",\n },\n {\n name: \"class-variance-authority\",\n message:\n \"Removed — import cva/cx from @trackunit/css-class-variance-utilities instead. The old package is no longer a dependency.\",\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":"story-relaxations.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/config/fragments/story-relaxations.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACU,QAAA,cAAc,GAA0B,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAE7F;;;;;;;;;;;;;GAaG;AACU,QAAA,gBAAgB,GAAkB;IAC7C,KAAK,EAAE,CAAC,GAAG,sBAAc,CAAC;IAC1B,KAAK,EAAE;QACL,qBAAqB,EAAE,KAAK;QAC5B,YAAY,EAAE,KAAK;QACnB,sCAAsC,EAAE,KAAK;QAC7C,mCAAmC,EAAE,KAAK;QAC1C,4CAA4C,EAAE,KAAK;QACnD,6CAA6C,EAAE,KAAK;KACrD;CACF,CAAC","sourcesContent":["import type { Linter } from \"eslint\";\n\n/**\n * Story-file glob patterns shared by every preset that needs to scope config to Storybook CSF\n * files. Kept as its own export (rather than only living inside `storyRelaxations.files`) so\n * consumers that need the globs for something other than the rule relaxations below (e.g. an\n * `@nx/dependency-checks` `ignoredFiles` entry) can reuse the same list without re-typing it.\n */\nexport const storyFileGlobs: ReadonlyArray<string> = [\"**/*.stories.ts\", \"**/*.stories.tsx\"];\n\n/**\n * The single source of truth for the rule relaxations every story-bearing preset needs. Story\n * files (CSF `meta`/story objects) legitimately:\n * - skip JSDoc (`jsdoc/require-jsdoc`) — they're fixtures, not public API surface.\n * - use `console.*` in play/interaction functions (`no-console`).\n * - declare empty handlers as story args (`@typescript-eslint/no-empty-function`).\n * - export multiple story objects per file and name them after the story, not the file\n * (`@trackunit/one-component-per-file`, `@trackunit/component-name-matches-filename`).\n * - render components without satisfying the prop-contract shape the rule expects from real\n * components (`@trackunit/require-component-prop-contracts`).\n *\n * Intentionally does NOT touch `@trackunit/storybook/*` or `storybook/*` rules — those are\n * registered and enabled by separate presets, not by this rule-relaxation fragment.\n */\nexport const storyRelaxations: Linter.Config = {\n files: [...storyFileGlobs],\n rules: {\n \"jsdoc/require-jsdoc\": \"off\",\n \"no-console\": \"off\",\n \"@typescript-eslint/no-empty-function\": \"off\",\n \"@trackunit/one-component-per-file\": \"off\",\n \"@trackunit/component-name-matches-filename\": \"off\",\n \"@trackunit/require-component-prop-contracts\": \"off\",\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,OAAO;QACP;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 \"error\",\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;AA6CtC,gBAAE;AA5CJ,2FAAqE;AAiDnE,4CAAgB;AAhDlB,4EAAsD;AA+CpD,4BAAQ;AA9CV,+EAA+D;AAmC7D,+BAnCK,cAAoB,CAmCL;AAlCtB,2EAAqD;AAoCnD,oCAAY;AAnCd,iEAA2C;AAoCzC,oBAAI;AAnCN,mEAA6C;AAoC3C,sBAAK;AAnCP,sEAAgD;AAqC9C,wBAAM;AApCR,mEAA6C;AAsC3C,sBAAK;AArCP,8EAAwD;AAsCtD,gCAAU;AArCZ,0GAA2D;AAsCzD,yBAtCK,uCAAc,CAsCL;AArChB,yDAAmC;AA4BjC,0BAAO;AA3BT,yEAAmD;AA+BjD,kCAAW;AA9Bb,4CAAwC;AACxC,sGAAgG;AAChG,0FAAqF;AACrF,gJAAgI;AAEnH,QAAA,gBAAgB,GAAG,EAAE,KAAK,EAAE,oBAAQ,EAAE,CAAC;AAEpD;;;;;;;;GAQG;AACU,QAAA,eAAe,GAAG;IAC7B,KAAK,EAAE;QACL,6BAA6B,EAAE,gEAAwB;QACvD,qBAAqB,EAAE,uCAAiB;QACxC,yBAAyB,EAAE,8CAAoB;KAChD;CACF,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 testingLibrary from \"eslint-plugin-testing-library\";\nimport * as globals from \"globals\";\nimport * as jsoncParser from \"jsonc-eslint-parser\";\nimport { rulesMap } from \"../rules-map\";\nimport { noLocalMetaComponent } from \"../rules/no-local-meta-component/no-local-meta-component\";\nimport { requireCsfFactory } from \"../rules/require-csf-factory/require-csf-factory\";\nimport { requireFolderLandingPage } from \"../rules/require-storybook-folder-landing-page/require-storybook-folder-landing-page\";\n\nexport const localRulesPlugin = { rules: rulesMap };\n\n/**\n * Shared plugin object for the `@trackunit/storybook` namespace. Rule code stays in this\n * package; this object is what presets (and external consumers who opt in directly) register\n * under the `@trackunit/storybook` plugin key so ESLint resolves e.g.\n * `@trackunit/storybook/require-folder-landing-page` to plugin `@trackunit/storybook` + rule\n * `require-folder-landing-page`. Must stay a single object reference — flat config compares\n * plugin references by identity — so import this export everywhere the namespace is registered,\n * never construct a new `{ rules: {...} }` object elsewhere.\n */\nexport const storybookPlugin = {\n rules: {\n \"require-folder-landing-page\": requireFolderLandingPage,\n \"require-csf-factory\": requireCsfFactory,\n \"no-local-meta-component\": noLocalMetaComponent,\n },\n};\n\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,oFAG+C;AAC/C,wEAAwE;AACxE,sEAAkE;AAClE,oEAAgE;AAChE,wCAUoB;AACpB,oCAA4C;AAE5C,MAAM,gCAAgC,GAAG,IAAA,iCAAc,EAAC;IACtD,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,IAAA,wBAAgB,GAAE;gBAC9B,eAAe,EAAE;oBACf,oBAAoB;oBACpB,oBAAoB;oBACpB,iBAAiB;oBACjB,YAAY;oBACZ,aAAa;oBACb,eAAe;oBACf,kBAAkB;oBAClB,kBAAkB;oBAClB,iBAAiB;oBACjB,mBAAmB;oBACnB,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;AAEH,qFAAqF;AACrF,yFAAyF;AACzF,MAAM,+BA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AsB,CAAC;QAC/B,KAAK,EAAE;YACL,+BAA+B,EAAE,KAAK;SACvC;KACF;IACD,8BAAoB;IACpB,0FAA0F;IAC1F,sFAAsF;IACtF,oCAAgB;IAChB;QACE,KAAK,EAAE,CAAC,8BAA8B,EAAE,2BAA2B,CAAC;QACpE,KAAK,EAAE;YACL,+BAA+B,EAAE,KAAK;SACvC;KACF;IACD;QACE,4EAA4E;QAC5E,kEAAkE;QAClE,+FAA+F;QAC/F,0FAA0F;QAC1F,8EAA8E;QAC9E,kFAAkF;QAClF,KAAK,EAAE;YACL,8BAA8B;YAC9B,2BAA2B;YAC3B,6BAA6B;YAC7B,wBAAwB;YACxB,0BAA0B;YAC1B,wBAAwB;YACxB,8BAA8B;YAC9B,eAAe;YACf,+BAA+B;YAC/B,6BAA6B;YAC7B,qCAAqC;YACrC,0BAA0B;YAC1B,yBAAyB;YACzB,oDAAoD;YACpD,mCAAmC;YACnC,wCAAwC;SACzC;QACD,KAAK,EAAE;YACL,4BAA4B,EAAE,KAAK;SACpC;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 {\n noDirectStorageGlobalsExceptionOverrides,\n noDirectStorageGlobalsRule,\n} from \"../fragments/no-direct-storage-access\";\nimport { restrictedImportRules } from \"../fragments/restricted-imports\";\nimport { storyRelaxations } from \"../fragments/story-relaxations\";\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\nconst noExtraneousDependenciesSkipWhen = 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 \"**/*.spec.{ts,tsx}\",\n \"**/*.test.{ts,tsx}\",\n \"**/jest.setup.*\",\n \"**/test/**\",\n \"**/tests/**\",\n \"**/testing/**\",\n \"**/test-setup/**\",\n \"**/test-utils/**\",\n \"**/vite.setup.*\",\n \"**/vite.config.ts\",\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// createSkipWhen wraps the rule behind a uniquely-named plugin (e.g. \"skip-when-0\");\n// look the name up rather than hardcoding it, so per-lib configs never have to guess it.\nconst noExtraneousDependenciesRuleKey = `${Object.keys(noExtraneousDependenciesSkipWhen.plugins ?? {})[0]}/import-x/no-extraneous-dependencies`;\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 noExtraneousDependenciesSkipWhen,\n {\n // Nx migration codemods run inside the consumer's Nx generator context, which\n // supplies @nx/devkit and typescript; declaring those as runtime dependencies\n // would ship an Nx toolchain with every package that ever had a migration.\n // Centralized here so libs with a migrations/ folder never have to restate\n // this locally (see also the no-default-export exemption below).\n //\n // `jsdoc/require-jsdoc` is intentionally not turned off here. Only the\n // public-api preset enables it, and it re-applies that rule on `**/*.ts`\n // after this block, so an override here never wins. That half of the\n // exemption lives in public-api.ts, after `strictJsdocRules`.\n //\n // Scoped to the versioned `v[0-9]*` codemod subfolders and their shared `utils/`\n // helpers (not `**/migrations/**` broadly): the `@trackunit/migrations` package\n // is itself Nx tooling, rooted at a directory literally named `migrations`, and\n // legitimately declares @nx/devkit et al. as real dependencies for its whole\n // source tree — a broad `**/migrations/**` glob would wrongly swallow that\n // entire project too. Only the versioned codemod folders and their utils get\n // the exemption.\n files: [\"**/migrations/v[0-9]*/**/*.ts\", \"**/migrations/utils/**/*.ts\"],\n rules: {\n [noExtraneousDependenciesRuleKey]: \"off\",\n },\n },\n {\n files: [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\"],\n\n languageOptions: {\n ecmaVersion: 2022,\n sourceType: \"module\",\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 \"prefer-template\": \"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 \"no-restricted-globals\": noDirectStorageGlobalsRule,\n\n \"@trackunit/no-internal-barrel-files\": \"error\",\n \"@trackunit/no-typescript-assertion\": \"warn\",\n \"@trackunit/no-dynamic-translation-key\": \"error\",\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 \"@trackunit/no-deprecated-graphql-fields\": \"warn\",\n },\n },\n {\n files: [\"**/locales/en/translation.json\"],\n languageOptions: {\n parser: jsoncParser,\n },\n plugins: {\n \"@trackunit\": localRulesPlugin,\n },\n rules: {\n \"@trackunit/no-unused-translation-key\": \"error\",\n },\n },\n noDirectStorageGlobalsExceptionOverrides,\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 // Shared with the `react` preset and the internal `publicApi` preset. Consumers that only\n // spread `base` (without `react`) still get the six rule relaxations for story files.\n storyRelaxations,\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 // Files that legitimately require a default export and cannot be converted:\n // - Storybook CSF (meta object), demo files and .storybook config\n // - tool config files (only these *.config.* names carry a default export) and GraphQL codegen\n // - Nx generators/executors and migration codemods (Nx loads them via the default export,\n // except entries whose implementation string carries a #namedExport suffix)\n // - iris-app manifests and framework entry points loaded via their default export\n files: [\n \"**/*.stories.{ts,tsx,js,jsx}\",\n \"**/*.demo.{ts,tsx,js,jsx}\",\n \"**/.storybook/**/*.{ts,tsx}\",\n \"**/vite.config.{ts,js}\",\n \"**/vitest.config.{ts,js}\",\n \"**/jest.config.{ts,js}\",\n \"**/playwright.config.{ts,js}\",\n \"**/codegen.ts\",\n \"**/generators/**/generator.ts\",\n \"**/executors/**/executor.ts\",\n \"**/migrations/v[0-9]*/**/*.{ts,tsx}\",\n \"**/extension-manifest.ts\",\n \"**/iris-app-manifest.ts\",\n \"**/iris-app-playwright/src/plugins/logsReporter.ts\",\n \"**/react/test-setup/src/preset.ts\",\n \"**/react/vite-test-setup/src/preset.ts\",\n ],\n rules: {\n \"import-x/no-default-export\": \"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,QAAA,GAAG,GAAG;IACjB;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,4BAA4B,CAAC;aACjF;SACF;KACF;IACD;QACE,KAAK,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;QACpD,KAAK,EAAE;YACL,uCAAuC,EAAE,KAAK;YAC9C,gCAAgC,EAAE,KAAK;YACvC,8BAA8B,EAAE,KAAK;YACrC,iDAAiD,EAAE,KAAK;YACxD,wCAAwC,EAAE,KAAK;SAChD;KACF;CACF,CAAC","sourcesContent":["export const e2e = [\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\", \"./playwright/tsconfig.json\"],\n },\n },\n },\n {\n files: [\"playwright/**/*.ts\", \"playwright/**/*.tsx\"],\n rules: {\n \"testing-library/prefer-screen-queries\": \"off\",\n \"testing-library/no-node-access\": \"off\",\n \"testing-library/no-container\": \"off\",\n \"testing-library/render-result-naming-convention\": \"off\",\n \"testing-library/no-render-in-lifecycle\": \"off\",\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,oFAG+C;AAC/C,0DAAwE;AACxE,sEAAkE;AAClE,kEAAwE;AACxE,wCAYoB;AAEpB;;;;;;;;GAQG;AACH,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE5E,QAAA,WAAW,GAAG;IACzB;QACE,OAAO,EAAE;YACP,YAAY,EAAE,0BAAgB;YAC9B,mFAAmF;YACnF,uFAAuF;YACvF,gEAAgE;YAChE,sBAAsB,EAAE,yBAAe;YACvC,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;SACF;KACF;IACD;QACE,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE;YACf,MAAM,EAAE,kBAAQ;YAChB,WAAW,EAAE,IAAI;YACjB,UAAU,EAAE,QAAQ;YACpB,aAAa,EAAE;gBACb,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI;i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,6BAA6B,EAAE,OAAO;YACtC,oBAAoB,EAAE,OAAO;SAC9B;KACF;CACF,CAAC","sourcesContent":["import {\n noDirectStoragePropertiesRule,\n noDirectStoragePropertyExceptionOverrides,\n} from \"../fragments/no-direct-storage-access\";\nimport { reactCustomRules, reactRules } from \"../fragments/react-rules\";\nimport { storyRelaxations } from \"../fragments/story-relaxations\";\nimport { reactTestingLibraryRules } from \"../fragments/testing-library\";\nimport {\n globals,\n jest,\n jsdoc,\n localRulesPlugin,\n nx,\n react,\n reactHooks,\n storybookPlugin,\n testingLibrary,\n tsParser,\n typescriptEslint,\n} from \"../plugins\";\n\n/**\n * Files that are parsed as code and therefore need the TypeScript parser.\n *\n * The parser must NOT be set on an unscoped config block: `react` is spread after `base`, and an\n * unscoped `languageOptions.parser` overrides the JSON parser that `base` assigns to\n * `locales/en/translation.json`. The JSON visitor of `@trackunit/no-unused-translation-key` then never\n * fires and the rule silently reports nothing. `.cjs` and `.mjs` are listed so the config files\n * that are linted by default keep the parser they had when it was unscoped.\n */\nconst codeFiles = [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\", \"**/*.cjs\", \"**/*.mjs\"];\n\nexport const reactPreset = [\n {\n plugins: {\n \"@trackunit\": localRulesPlugin,\n // Registers the `@trackunit/storybook` namespace so opt-in consumers can reference\n // `@trackunit/storybook/require-folder-landing-page` without extra config. This preset\n // intentionally does not enable any rule under that key itself.\n \"@trackunit/storybook\": storybookPlugin,\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 },\n },\n {\n files: codeFiles,\n languageOptions: {\n parser: tsParser,\n ecmaVersion: 2022,\n sourceType: \"module\",\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 \"no-restricted-properties\": noDirectStoragePropertiesRule,\n },\n },\n noDirectStoragePropertyExceptionOverrides,\n // The published preset registers `@trackunit/storybook` (above) for opt-in use but does NOT\n // enable `@trackunit/storybook/require-folder-landing-page` (nor its deprecated\n // `@trackunit/require-storybook-folder-landing-page` alias) here. External consumers who want\n // the landing-page check opt in explicitly. The rule relaxations below are unrelated to that\n // namespace and shared with `base` and the internal `publicApi` preset.\n storyRelaxations,\n {\n files: [\"**/*.spec.ts\", \"**/*.spec.tsx\", \"**/*.test.ts\", \"**/*.test.tsx\"],\n rules: {\n \"@trackunit/one-component-per-file\": \"off\",\n \"@trackunit/component-name-matches-filename\": \"off\",\n \"no-restricted-properties\": \"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;AAEtD;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE5E,QAAA,MAAM,GAAG;IACpB;QACE,eAAe,EAAE;YACf,OAAO,EAAE;gBACP,GAAG,iBAAO,CAAC,OAAO;aACnB;SACF;KACF;IACD;QACE,KAAK,EAAE,SAAS;QAChB,eAAe,EAAE;YACf,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\n/**\n * The parser must NOT be set on an unscoped config block: an unscoped `languageOptions.parser`\n * overrides the JSON parser that `base` assigns to `locales/en/translation.json`, which silently\n * disables `@trackunit/no-unused-translation-key`. `.cjs` and `.mjs` are listed so the config\n * files linted by default keep the parser they had when it was unscoped.\n */\nconst codeFiles = [\"**/*.ts\", \"**/*.tsx\", \"**/*.js\", \"**/*.jsx\", \"**/*.cjs\", \"**/*.mjs\"];\n\nexport const server = [\n {\n languageOptions: {\n globals: {\n ...globals.browser,\n },\n },\n },\n {\n files: codeFiles,\n languageOptions: {\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,OAAO,CAAC;IAEzC,8CAA8C;IAC9C,MAAM,UAAU,GAAG,aAAa,eAAe,EAAE,EAAE,CAAC;IAEpD,4CAA4C;IAC5C,MAAM,YAAY,GAAoC,EAAE,CAAC;IAEzD,KAAK,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnE,KAAK,MAAM,CAAC,QAAQ,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACpE,MAAM,YAAY,GAAG,GAAG,kBAAkB,IAAI,QAAQ,EAAE,CAAC;YAEzD,sCAAsC;YACtC,YAAY,CAAC,YAAY,CAAC,GAAG;gBAC3B,IAAI,EAAE,YAAY,CAAC,IAAI;gBACvB,MAAM,CAAC,OAAyB;oBAC9B,gEAAgE;oBAChE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;oBAC3D,MAAM,QAAQ,GAAG,IAAA,6BAAkB,EAAC,QAAQ,CAAC,CAAC;oBAE9C,6CAA6C;oBAC7C,IAAI,QAAQ,IAAI,IAAA,iCAAsB,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;wBACvD,0CAA0C;wBAC1C,OAAO,EAAE,CAAC;oBACZ,CAAC;oBAED,2CAA2C;oBAC3C,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACtC,CAAC;aACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,yBAAyB;IACzB,MAAM,WAAW,GAAuB,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3D,4BAA4B;QAC5B,WAAW,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAE9B,6BAA6B;QAC7B,WAAW,CAAC,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":"component-name-matches-filename.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/component-name-matches-filename/component-name-matches-filename.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;AAEH,oDA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C,qBAAqB,EAAE,EAAE,CAAC;oBAC7D,IAAI,IAAI,KAAK,IAAI;wBAAE,SAAS,CAAC,uCAAuC;oBACpE,IAAI,IAAI,KAAK,YAAY;wBAAE,SAAS;oBAEpC,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CACtC,KAAK,CAAC,EAAE,CAAC,IAAA,qBAAS,EAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,IAAA,qBAAS,EAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAC7E,CAAC;oBACF,IAAI,SAAS;wBAAE,SAAS;oBAExB,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,uBAAuB;wBAClC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE;qBACvC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * ESLint rule: component-name-matches-filename\n *\n * Enforces that every exported React component is named after the file it lives in.\n * For a file named `Foo.tsx`, the exported component must be named `Foo`.\n *\n * Anonymous default exports are skipped (no name to compare).\n * `index.*` files are skipped (they are entry-point re-export files, not component files).\n * Files with a secondary extension (`Foo.variants.tsx`, `Foo.demo.tsx`) are skipped — their\n * basename is not a valid identifier, so no export name could ever match it.\n * Modules that neither render JSX nor import React are skipped — they hold no components,\n * so a PascalCase export there is a plain function (an Nx generator, an Express handler, …).\n *\n * When combined with `one-component-per-file`, these two rules together fully enforce\n * the \"one named component per file\" convention.\n *\n * @example\n * // File: Foo.tsx\n * // Bad — exported name doesn't match filename\n * export function Bar() { return <div />; }\n *\n * // Good\n * export function Foo() { return <div />; }\n */\n\nimport { ESLintUtils } from \"@typescript-eslint/utils\";\nimport { minimatch } from \"minimatch\";\nimport path from \"path\";\nimport { createComponentFileTracker } from \"../../utils/component-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 = \"componentNameMismatch\";\n\ntype AllowedMismatch = {\n /** Basename of the file (without extension) where the mismatch is permitted. Supports glob patterns (`*`, `?`). */\n file: string;\n /** Exported component name that is permitted despite not matching the filename. Supports glob patterns (`*`, `?`). */\n component: string;\n};\n\ntype Options = [{ allowedMismatches?: ReadonlyArray<AllowedMismatch> }];\n\n/** `react`, `react-dom`, `react/jsx-runtime`, `react-dom/client`, … */\nconst REACT_MODULE_PATTERN = /^react(-dom)?(\\/.+)?$/;\n\nexport const componentNameMatchesFilename = createRule<Options, MessageIds>({\n name: \"component-name-matches-filename\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Enforce that exported React component names match the filename they live in. \" +\n \"index.* files, files with a secondary extension, modules without React, and \" +\n \"anonymous default exports are exempt.\",\n },\n messages: {\n componentNameMismatch:\n \"Component '{{name}}' should match the filename. \" + \"Rename it to '{{expected}}' or move it to its own file.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n allowedMismatches: {\n type: \"array\",\n description:\n \"Pairs that are exempt from the name-matching rule. Both `file` and `component` support glob patterns \" +\n \"(`*`, `?`), so one entry can cover a whole family of files (e.g. { file: '*Context', component: '*Provider' }).\",\n items: {\n type: \"object\",\n properties: {\n file: {\n type: \"string\",\n description:\n \"Basename of the file without extension. Supports glob patterns (`*`, `?`). \" +\n \"e.g. 'translation' or '*Context'.\",\n },\n component: {\n type: \"string\",\n description:\n \"Exported component name. Supports glob patterns (`*`, `?`). \" + \"e.g. 'Trans' or '*Provider'.\",\n },\n },\n required: [\"file\", \"component\"],\n additionalProperties: false,\n },\n },\n },\n additionalProperties: false,\n },\n ],\n },\n defaultOptions: [{}],\n create(context, [{ allowedMismatches = [] }]) {\n const filename = context.filename;\n const basename = path.basename(filename, path.extname(filename));\n\n if (basename === \"index\" || basename === \"<input>\") return {};\n\n // Role files keep their secondary extension in the basename (`Foo.variants`, `Foo.demo`),\n // which no identifier can match. The primary segment names the subject the file relates\n // to, not the symbol it exports, so there is nothing to enforce here.\n if (basename.includes(\".\")) return {};\n\n // Normalize kebab-case and snake_case filenames to PascalCase.\n // e.g. `current-weather-status` → `CurrentWeatherStatus`, `app` → `App`.\n const expectedName = basename\n .split(/[-_]/)\n .map(segment => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(\"\");\n\n const tracker = createComponentFileTracker();\n\n // A PascalCase export only means \"component\" in a module that actually uses React.\n // Elsewhere it is a plain function that happens to be capitalized.\n let usesReact = false;\n\n return {\n ImportDeclaration(node) {\n if (REACT_MODULE_PATTERN.test(node.source.value)) {\n usesReact = true;\n }\n },\n JSXElement() {\n usesReact = true;\n },\n JSXFragment() {\n usesReact = true;\n },\n\n FunctionDeclaration: tracker.onFunctionDeclaration,\n VariableDeclarator: tracker.onVariableDeclarator,\n ExportNamedDeclaration: tracker.onExportNamedDeclaration,\n ExportDefaultDeclaration: tracker.onExportDefaultDeclaration,\n\n \"Program:exit\"() {\n if (!usesReact) return;\n\n for (const { name, node } of tracker.getExportedComponents()) {\n if (name === null) continue; // anonymous default exports are exempt\n if (name === expectedName) continue;\n\n const isAllowed = allowedMismatches.some(\n entry => minimatch(basename, entry.file) && minimatch(name, entry.component)\n );\n if (isAllowed) continue;\n\n context.report({\n node,\n messageId: \"componentNameMismatch\",\n data: { name, expected: expectedName },\n });\n }\n },\n };\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,wEAOwC;AACxC,oDAAiF;AAEjF,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,KAAK,CAC/G,CAAC;AAKF,0DAA0D;AAC1D,MAAM,aAAa,G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,CAAC,CAAC,CAAC;gBAE/F,IAAI,oBAAoB,EAAE,CAAC;oBACzB,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,iBAAiB;wBAC5B,mFAAmF;wBACnF,+EAA+E;wBAC/E,yBAAyB;wBACzB,GAAG,EAAE,oBAAoB,CAAC,QAAQ,CAAC;4BACjC,CAAC,CAAC,IAAI;4BACN,CAAC,CAAC,KAAK,CAAC,EAAE;gCACN,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAA,kCAAY,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;gCACxF,OAAO,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAA,mCAAa,EAAC,UAAU,CAAC,CAAC,CAAC;4BAChE,CAAC;qBACN,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {\n type ClassnameContext,\n type ClassnameLocation,\n findClassnameStringsInCall,\n formatAsArray,\n getCalleeName,\n splitClasses,\n} from \"@trackunit/css-classname-utils\";\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}.ts`\n);\n\ntype MessageIds = \"stringNeedsArray\" | \"arrayNeedsSplit\";\ntype Options = [];\n\n/** Base classes live under `base` in a cva 1.0 config. */\nconst isBaseContext = (context: ClassnameContext): boolean => {\n if (context.type === \"array-element\") {\n return isBaseContext(context.parentContext);\n }\n\n if (context.type === \"cva-variant\") {\n return context.functionName === \"cva\" && context.variantPath.length === 1 && context.variantPath[0] === \"base\";\n }\n\n return false;\n};\n\nconst propertyKeyName = (key: TSESTree.Property[\"key\"]): string | null => {\n if (key.type === AST_NODE_TYPES.Identifier) {\n return key.name;\n }\n if (key.type === AST_NODE_TYPES.Literal && typeof key.value === \"string\") {\n return key.value;\n }\n return null;\n};\n\n/**\n * The node holding the base classes on a `cva({ base, ... })` call.\n */\nconst findBaseNode = (node: TSESTree.CallExpression): TSESTree.Node | null => {\n const calleeName = getCalleeName(node.callee);\n if (calleeName !== \"cva\") {\n return null;\n }\n\n const firstArgument = node.arguments[0];\n if (!firstArgument || firstArgument.type !== AST_NODE_TYPES.ObjectExpression) {\n return null;\n }\n\n const baseProperty = firstArgument.properties.find(\n (property): property is TSESTree.Property =>\n property.type === AST_NODE_TYPES.Property && propertyKeyName(property.key) === \"base\"\n );\n\n const baseValue = baseProperty?.value;\n if (baseValue?.type === AST_NODE_TYPES.Literal || baseValue?.type === AST_NODE_TYPES.ArrayExpression) {\n return baseValue;\n }\n\n return null;\n};\n\nconst isLiteralLocation = (\n location: ClassnameLocation\n): location is ClassnameLocation & { fixNode: TSESTree.Literal } => {\n return location.fixNode.type === AST_NODE_TYPES.Literal && typeof location.fixNode.value === \"string\";\n};\n\nconst isStringLiteral = (element: TSESTree.Node | null): element is TSESTree.StringLiteral =>\n element !== null && element.type === AST_NODE_TYPES.Literal && typeof element.value === \"string\";\n\n/**\n * `formatAsArray(allClasses)` below rebuilds the array from string literals only, then replaces\n * the *whole* array node -- so a non-literal element (a spread, an identifier, a conditional, ...)\n * would be silently dropped. Report but don't offer a fix in that case instead.\n */\nconst hasNonLiteralElement = (node: TSESTree.Node): boolean =>\n node.type === AST_NODE_TYPES.ArrayExpression && node.elements.some(element => !isStringLiteral(element));\n\n/**\n * ESLint rule that converts cva base styles to arrays if more than one class is used.\n *\n * One class per array item keeps diffs and merge conflicts to the class that\n * actually changed, and lets tailwind-merge see each utility individually.\n *\n * The export and published rule id keep the historical `cva-merge-…` name\n * (GLU-2173). Renaming would be a breaking change for every consumer\n * `eslint.config` that lists `@trackunit/cva-merge-base-classes-as-array`;\n * the implementation only inspects `cva({ base })`.\n *\n * @example\n * Invalid:\n * const cvaMyComponent = cva({ base: \"text-danger-600 mb-4 font-semibold\" });\n * const cvaMyComponent = cva({ base: [\"text-danger-600 mb-4\",\"font-semibold\"] });\n * Valid:\n * const cvaMyComponent = cva({ base: [\"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 cva base styles to arrays if more than one class is used.\",\n },\n fixable: \"code\",\n messages: {\n stringNeedsArray: \"[cva] Base classes should be an array if multiple classes are used.\",\n arrayNeedsSplit: \"[cva] 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 baseNode = findBaseNode(node);\n if (!baseNode) {\n return;\n }\n\n const baseClassLocations = findClassnameStringsInCall(node)\n .filter(location => isBaseContext(location.context))\n .filter(isLiteralLocation);\n\n // A single string: cva({ base: \"class1 class2\" })\n if (baseNode.type === AST_NODE_TYPES.Literal) {\n const baseClassLocation = baseClassLocations[0];\n if (!baseClassLocation) {\n return;\n }\n\n const value = baseClassLocation.value;\n if (value.includes(\" \")) {\n context.report({\n node,\n messageId: \"stringNeedsArray\",\n fix(fixer) {\n return fixer.replaceText(baseClassLocation.fixNode, formatAsArray(splitClasses(value)));\n },\n });\n }\n return;\n }\n\n // An array: cva({ base: [...] })\n const hasMultiClassElement = baseClassLocations.some(location => location.value.includes(\" \"));\n\n if (hasMultiClassElement) {\n context.report({\n node,\n messageId: \"arrayNeedsSplit\",\n // A non-literal element (spread, identifier, conditional, ...) can't be rebuilt by\n // formatAsArray, and offering a fix that silently drops it would be worse than\n // reporting without one.\n fix: hasNonLiteralElement(baseNode)\n ? null\n : fixer => {\n const allClasses = baseClassLocations.flatMap(location => splitClasses(location.value));\n return fixer.replaceText(baseNode, formatAsArray(allClasses));\n },\n });\n }\n },\n };\n },\n});\n"]}
|
package/src/lib/rules/design-guideline-icon-size-match/design-guideline-icon-size-match.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-guideline-icon-size-match.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/design-guideline-icon-size-match/design-guideline-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;AAQF,MAAM,WAAW,GAAG,CAAC,QAA2C,EAAY,EAAE;IAC5E,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;QACrB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAClF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC1D,CAAC;IAED,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,wBAAwB,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;QACvC,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAC/B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QAClE,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;YACvC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAA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,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\ntype SizeInfo =\n | { type: \"implicit\"; value: null }\n | { type: \"literal\"; value: string }\n | { type: \"variable\"; value: string; expression: TSESTree.Identifier }\n | { type: \"expression\"; value: null; expression: TSESTree.Expression };\n\nconst getSizeInfo = (sizeAttr: TSESTree.JSXAttribute | undefined): SizeInfo => {\n if (!sizeAttr?.value) {\n return { type: \"implicit\", value: null };\n }\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 if (expr.type !== \"JSXEmptyExpression\") {\n return { type: \"expression\", value: null, expression: expr };\n }\n }\n\n return { type: \"implicit\", value: null };\n};\n\nconst getJsxAttribute = (node: TSESTree.JSXOpeningElement, name: string): TSESTree.JSXAttribute | undefined =>\n node.attributes.find(\n (attr): attr is TSESTree.JSXAttribute =>\n attr.type === \"JSXAttribute\" && attr.name.type === \"JSXIdentifier\" && attr.name.name === name\n );\n\n// Helper to get possible string literal values from a variable's type\nconst 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 inspectedType = checker.getTypeAtLocation(tsNode);\n\n const literalValues: Array<string> = [];\n\n // Type guard for string literal types\n const isStringLiteralType = (type: ts.Type): type is ts.StringLiteralType =>\n (type.flags & ts.TypeFlags.StringLiteral) !== 0;\n\n if (inspectedType.isUnion()) {\n for (const unionType of inspectedType.types) {\n if (isStringLiteralType(unionType)) {\n literalValues.push(unionType.value);\n }\n }\n } else if (isStringLiteralType(inspectedType)) {\n literalValues.push(inspectedType.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\nconst 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\nconst isIconOpeningElement = (element: TSESTree.JSXOpeningElement): boolean =>\n element.name.type === \"JSXIdentifier\" && element.name.name === \"Icon\";\n\nconst isMemoizedCallbackCall = (expression: TSESTree.CallExpression): boolean => {\n if (expression.callee.type === \"Identifier\") {\n return expression.callee.name === \"useCallback\" || expression.callee.name === \"useMemo\";\n }\n\n return (\n expression.callee.type === \"MemberExpression\" &&\n !expression.callee.computed &&\n expression.callee.property.type === \"Identifier\" &&\n (expression.callee.property.name === \"useCallback\" || expression.callee.property.name === \"useMemo\")\n );\n};\n\nconst collectReturnStatements = (statement: TSESTree.Statement, returns: Array<TSESTree.ReturnStatement>): void => {\n switch (statement.type) {\n case \"ReturnStatement\": {\n returns.push(statement);\n return;\n }\n case \"BlockStatement\": {\n for (const nested of statement.body) {\n collectReturnStatements(nested, returns);\n }\n return;\n }\n case \"IfStatement\": {\n collectReturnStatements(statement.consequent, returns);\n if (statement.alternate) {\n collectReturnStatements(statement.alternate, returns);\n }\n return;\n }\n case \"SwitchStatement\": {\n for (const switchCase of statement.cases) {\n for (const nested of switchCase.consequent) {\n collectReturnStatements(nested, returns);\n }\n }\n return;\n }\n default: {\n return;\n }\n }\n};\n\n// Find Icon elements - could be direct, nested in JSX, or inside conditionals and callbacks\nconst findIconElements = (\n context: TSESLint.RuleContext<string, ReadonlyArray<unknown>>,\n expression: TSESTree.Expression | TSESTree.JSXEmptyExpression | null | undefined,\n seen: Set<TSESTree.Node> = new Set()\n): Array<TSESTree.JSXOpeningElement> => {\n if (!expression || expression.type === \"JSXEmptyExpression\" || seen.has(expression)) {\n return [];\n }\n\n seen.add(expression);\n\n switch (expression.type) {\n case \"JSXElement\": {\n if (isIconOpeningElement(expression.openingElement)) {\n return [expression.openingElement];\n }\n\n return expression.children.flatMap(child => {\n if (child.type === \"JSXElement\" || child.type === \"JSXFragment\") {\n return findIconElements(context, child, seen);\n }\n if (child.type === \"JSXExpressionContainer\") {\n return findIconElements(context, child.expression, seen);\n }\n return [];\n });\n }\n case \"JSXFragment\": {\n return expression.children.flatMap(child => {\n if (child.type === \"JSXElement\" || child.type === \"JSXFragment\") {\n return findIconElements(context, child, seen);\n }\n if (child.type === \"JSXExpressionContainer\") {\n return findIconElements(context, child.expression, seen);\n }\n return [];\n });\n }\n case \"ConditionalExpression\": {\n // Check both consequent and alternate\n return [\n ...findIconElements(context, expression.consequent, seen),\n ...findIconElements(context, expression.alternate, seen),\n ];\n }\n case \"LogicalExpression\": {\n return [\n ...findIconElements(context, expression.left, seen),\n ...findIconElements(context, expression.right, seen),\n ];\n }\n case \"ArrowFunctionExpression\":\n case \"FunctionExpression\": {\n if (expression.body.type !== \"BlockStatement\") {\n return findIconElements(context, expression.body, seen);\n }\n\n const returns: Array<TSESTree.ReturnStatement> = [];\n for (const statement of expression.body.body) {\n collectReturnStatements(statement, returns);\n }\n\n return returns.flatMap(statement => findIconElements(context, statement.argument ?? undefined, seen));\n }\n case \"CallExpression\": {\n if (\n !isMemoizedCallbackCall(expression) ||\n !expression.arguments[0] ||\n expression.arguments[0].type === \"SpreadElement\"\n ) {\n return [];\n }\n return findIconElements(context, expression.arguments[0], seen);\n }\n case \"Identifier\": {\n const variable = context.sourceCode\n .getScope(expression)\n .references.find(ref => ref.identifier === expression)?.resolved;\n if (!variable) {\n return [];\n }\n\n return variable.defs.flatMap(definition => {\n if (definition.type === \"Variable\" && definition.node.init) {\n return findIconElements(context, definition.node.init, seen);\n }\n if (definition.type === \"FunctionName\" && definition.node.type === \"FunctionDeclaration\") {\n const returns: Array<TSESTree.ReturnStatement> = [];\n collectReturnStatements(definition.node.body, returns);\n return returns.flatMap(statement => findIconElements(context, statement.argument ?? undefined, seen));\n }\n return [];\n });\n }\n default: {\n return [];\n }\n }\n};\n\nconst reportWrongIconSize = ({\n context,\n iconElement,\n expectedSize,\n hostDescription,\n iconSizeInfo,\n autofixTarget,\n}: {\n context: TSESLint.RuleContext<\"incorrectIconSize\", ReadonlyArray<unknown>>;\n iconElement: TSESTree.JSXOpeningElement;\n expectedSize: string;\n hostDescription: string;\n iconSizeInfo: SizeInfo;\n autofixTarget: string | null;\n}): void => {\n const iconSizeAttr = getJsxAttribute(iconElement, \"size\");\n\n context.report({\n node: iconElement,\n messageId: \"incorrectIconSize\",\n data: {\n expectedSize,\n hostDescription,\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 if (autofixTarget === null) {\n return null;\n }\n\n if (iconSizeAttr) {\n // Replace existing size attribute\n if (!iconSizeAttr.value) {\n return null;\n }\n return fixer.replaceText(iconSizeAttr.value, autofixTarget);\n }\n\n // Add size attribute\n const lastAttr = iconElement.attributes[iconElement.attributes.length - 1];\n if (lastAttr) {\n return fixer.insertTextAfter(lastAttr, ` size=${autofixTarget}`);\n }\n return fixer.insertTextAfter(iconElement.name, ` size=${autofixTarget}`);\n },\n });\n};\n\n// Rule: large buttons → medium icons, small/medium buttons → small icons\nconst getButtonExpectedIconSize = (buttonSize: string): string => (buttonSize === \"large\" ? \"medium\" : \"small\"); // both \"small\" and \"medium\" buttons get \"small\" icons\n\nconst checkButtonIconSize = ({\n context,\n iconElement,\n buttonSizeInfo,\n}: {\n context: TSESLint.RuleContext<\"incorrectIconSize\", ReadonlyArray<unknown>>;\n iconElement: TSESTree.JSXOpeningElement;\n buttonSizeInfo: SizeInfo;\n}): void => {\n const iconSizeAttr = getJsxAttribute(iconElement, \"size\");\n const iconSizeInfo = getSizeInfo(iconSizeAttr);\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\") {\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(getButtonExpectedIconSize);\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;\n const variableIconEffectiveSize = iconSizeInfo.value || \"medium\";\n\n if (variableExpectedIconSize && variableIconEffectiveSize === variableExpectedIconSize) {\n return false; // Icon already has correct literal size\n }\n }\n }\n\n // Mixed mapping or can't determine type - check for the canonical conditional pattern\n if (\n iconSizeInfo.type === \"expression\" &&\n isCorrectConditionalExpression(iconSizeInfo.expression, buttonSizeInfo.value)\n ) {\n return false; // Icon already has correct conditional\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 return iconEffectiveSize !== getButtonExpectedIconSize(buttonEffectiveSize);\n })();\n\n if (!shouldReport) {\n return;\n }\n\n const expectedSize = (() => {\n if (buttonSizeInfo.type === \"variable\") {\n const possibleSizes = getPossibleStringLiterals(context, buttonSizeInfo.expression);\n\n if (possibleSizes) {\n const iconSizes = possibleSizes.map(getButtonExpectedIconSize);\n const uniqueIconSizes = [...new Set(iconSizes)];\n\n if (uniqueIconSizes.length === 1) {\n const [mappedSize] = uniqueIconSizes;\n if (mappedSize) {\n return mappedSize;\n }\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 return getButtonExpectedIconSize(buttonSizeInfo.value || \"medium\");\n })();\n\n const hostDescription = (() => {\n if (buttonSizeInfo.type === \"implicit\") {\n return \"Button size 'medium (default)'\";\n }\n if (buttonSizeInfo.type === \"literal\") {\n return `Button size '${buttonSizeInfo.value}'`;\n }\n if (buttonSizeInfo.type === \"variable\") {\n const possibleSizes = getPossibleStringLiterals(context, buttonSizeInfo.expression);\n if (possibleSizes && possibleSizes.length > 0) {\n const sizeList = possibleSizes.map(size => `\"${size}\"`).join(\" | \");\n return `Button size '{${buttonSizeInfo.value}} (of type ${sizeList})'`;\n }\n return `Button size '{${buttonSizeInfo.value}}'`;\n }\n return \"Button size 'expression'\";\n })();\n\n const autofixTarget = (() => {\n // Don't autofix complex expressions, only variables and literals\n if (buttonSizeInfo.type === \"expression\") {\n return null;\n }\n\n if (buttonSizeInfo.type === \"variable\") {\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(getButtonExpectedIconSize);\n const uniqueIconSizes = [...new Set(iconSizes)];\n\n if (uniqueIconSizes.length === 1) {\n // All possible button sizes map to the same icon size\n const [mappedSize] = uniqueIconSizes;\n if (mappedSize) {\n return `\"${mappedSize}\"`;\n }\n }\n\n // Mixed mapping, use conditional\n return `{${buttonSizeInfo.value} === \"large\" ? \"medium\" : \"small\"}`;\n }\n\n // Can't determine type, use conditional\n return `{${buttonSizeInfo.value} === \"large\" ? \"medium\" : \"small\"}`;\n }\n\n // Calculate target icon size based on button size (literal or implicit)\n return `\"${getButtonExpectedIconSize(buttonSizeInfo.value || \"medium\")}\"`;\n })();\n\n reportWrongIconSize({\n context,\n iconElement,\n expectedSize,\n hostDescription,\n iconSizeInfo,\n autofixTarget,\n });\n};\n\n// Tag icon and getOptionPrefix always require size=\"small\"\nconst checkFixedSlotIconSize = ({\n context,\n slotValue,\n expectedSize,\n hostDescription,\n}: {\n context: TSESLint.RuleContext<\"incorrectIconSize\", ReadonlyArray<unknown>>;\n slotValue: TSESTree.JSXAttribute[\"value\"] | undefined;\n expectedSize: \"small\";\n hostDescription: string;\n}): void => {\n if (!slotValue || slotValue.type !== \"JSXExpressionContainer\" || slotValue.expression.type === \"JSXEmptyExpression\") {\n return;\n }\n\n for (const iconElement of findIconElements(context, slotValue.expression)) {\n const iconSizeAttr = getJsxAttribute(iconElement, \"size\");\n const iconSizeInfo = getSizeInfo(iconSizeAttr);\n const iconEffectiveSize =\n iconSizeInfo.type === \"literal\" ? iconSizeInfo.value : iconSizeInfo.type === \"implicit\" ? \"medium\" : null;\n\n if (iconEffectiveSize === expectedSize) {\n continue;\n }\n\n reportWrongIconSize({\n context,\n iconElement,\n expectedSize,\n hostDescription,\n iconSizeInfo,\n autofixTarget:\n iconSizeInfo.type === \"expression\" || iconSizeInfo.type === \"variable\" ? null : `\"${expectedSize}\"`,\n });\n }\n};\n\nexport const designGuidelineIconSizeMatch = createRule({\n name: \"design-guideline-icon-size-match\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Ensure Icon components in Button (prefix, suffix, or children), Tag, and select option-prefix slots use the size required by the design system.\",\n },\n fixable: \"code\",\n schema: [],\n messages: {\n incorrectIconSize: \"Expected Icon size to be '{{expectedSize}}' for {{hostDescription}}, found '{{iconSize}}'.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node: TSESTree.JSXOpeningElement) {\n if (node.name.type !== \"JSXIdentifier\") {\n return;\n }\n\n const hostName = node.name.name;\n\n if (hostName === \"Tag\") {\n // Tag icon slot must always be small\n checkFixedSlotIconSize({\n context,\n slotValue: getJsxAttribute(node, \"icon\")?.value,\n expectedSize: \"small\",\n hostDescription: \"Tag icon\",\n });\n return;\n }\n\n const optionPrefixAttr = getJsxAttribute(node, \"getOptionPrefix\");\n if (optionPrefixAttr) {\n // getOptionPrefix authors icons for both tags and menu items\n checkFixedSlotIconSize({\n context,\n slotValue: optionPrefixAttr.value,\n expectedSize: \"small\",\n hostDescription: \"getOptionPrefix\",\n });\n }\n\n if (hostName !== \"Button\") {\n return;\n }\n\n const sizeAttr = getJsxAttribute(node, \"size\");\n const buttonSizeInfo = getSizeInfo(sizeAttr);\n\n const checkButtonIconsInExpression = (expression: TSESTree.Expression | TSESTree.JSXEmptyExpression): void => {\n // Skip empty JSX expressions like {}\n if (expression.type === \"JSXEmptyExpression\") {\n return;\n }\n\n for (const iconElement of findIconElements(context, expression)) {\n checkButtonIconSize({ context, iconElement, buttonSizeInfo });\n }\n };\n\n // Check prefix and suffix slots\n for (const attr of node.attributes) {\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 continue;\n }\n\n checkButtonIconsInExpression(attr.value.expression);\n }\n\n // Check Icon children rendered inside the button body\n for (const child of node.parent.children) {\n if (child.type === \"JSXElement\" || child.type === \"JSXFragment\") {\n for (const iconElement of findIconElements(context, child)) {\n checkButtonIconSize({ context, iconElement, buttonSizeInfo });\n }\n } else if (child.type === \"JSXExpressionContainer\") {\n checkButtonIconsInExpression(child.expression);\n }\n }\n },\n };\n },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-deprecated-graphql-fields.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-deprecated-graphql-fields/no-deprecated-graphql-fields.ts"],"names":[],"mappings":";;;;AAAA,oDAAuD;AACvD,+CAAyB;AACzB,qCAAkE;AAClE,mDAA6B;AAC7B,uDAAyD;AACzD,iDAA2C;AAE3C,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,IAAI,IAAI,KAAK,CACvH,CAAC;AAKF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;AAErE,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAE,QAAuB,EAAE,EAAiB,EAAE;IACpF,IAAI,OAAyB,CAAC;IAC9B,IAAI,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,IAAc,CAAC;QACnB,IAAI,CAAC;YACH,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;aAAM,IAAI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AC;gBAErD,KAAK,MAAM,OAAO,IAAI,YAAY,EAAE,CAAC;oBACnC,IAAI,OAAe,CAAC;oBACpB,IAAI,CAAC;wBACH,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;oBAC7C,CAAC;oBAAC,MAAM,CAAC;wBACP,SAAS;oBACX,CAAC;oBAED,IAAI,QAAQ,CAAC;oBACb,IAAI,CAAC;wBACH,QAAQ,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC;oBAC5B,CAAC;oBAAC,MAAM,CAAC;wBACP,SAAS;oBACX,CAAC;oBAED,MAAM,MAAM,GAAG,IAAA,kBAAQ,EAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,gCAAsB,CAAC,CAAC,CAAC;oBACpE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;wBAC3B,OAAO,CAAC,MAAM,CAAC;4BACb,SAAS,EAAE,qBAAqB;4BAChC,IAAI,EAAE;gCACJ,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gCAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;6BACvB;4BACD,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;yBAC5B,CAAC,CAAC;oBACL,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 { NoDeprecatedCustomRule, parse, validate } from \"graphql\";\nimport * as path from \"path\";\nimport { findNearestFile } from \"../../utils/file-utils\";\nimport { getSchema } from \"./schema-cache\";\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 = \"deprecatedFieldUsed\";\ntype Options = [];\n\nconst EXCLUDED_DIRS = new Set([\"node_modules\", \"generated\", \"dist\"]);\n\nconst collectGraphqlFiles = (dir: string, files: Array<string> = []): Array<string> => {\n let entries: Array<fs.Dirent>;\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true });\n } catch {\n return files;\n }\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n let stat: fs.Stats;\n try {\n stat = fs.statSync(fullPath);\n } catch {\n continue;\n }\n if (stat.isDirectory()) {\n if (!EXCLUDED_DIRS.has(entry.name)) {\n collectGraphqlFiles(fullPath, files);\n }\n } else if (entry.name.endsWith(\".graphql\")) {\n files.push(fullPath);\n }\n }\n return files;\n};\n\nexport const noDeprecatedGraphqlFields = createRule<Options, MessageIds>({\n name: \"no-deprecated-graphql-fields\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Disallow usage of @deprecated GraphQL fields in .graphql operation files\",\n },\n messages: {\n deprecatedFieldUsed: \"Deprecated GraphQL field used in {{file}}: {{message}}\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n return {\n Program: _node => {\n const sourceFilePath = context.filename;\n if (!sourceFilePath.endsWith(\"/project.json\")) {\n return;\n }\n\n const nxJsonPath = findNearestFile(sourceFilePath, \"nx.json\");\n if (!nxJsonPath) {\n return;\n }\n const monorepoRoot = path.dirname(nxJsonPath);\n\n const schemaPath = path.join(\n monorepoRoot,\n \"libs\",\n \"api\",\n \"internal-gql-schema\",\n \"generated\",\n \"internal-schema.gql\"\n );\n\n const schema = getSchema(schemaPath);\n if (!schema) {\n return;\n }\n\n const projectDir = path.dirname(sourceFilePath);\n const graphqlFiles = collectGraphqlFiles(projectDir);\n\n for (const gqlFile of graphqlFiles) {\n let content: string;\n try {\n content = fs.readFileSync(gqlFile, \"utf8\");\n } catch {\n continue;\n }\n\n let document;\n try {\n document = parse(content);\n } catch {\n continue;\n }\n\n const errors = validate(schema, document, [NoDeprecatedCustomRule]);\n for (const error of errors) {\n context.report({\n messageId: \"deprecatedFieldUsed\",\n data: {\n file: path.relative(monorepoRoot, gqlFile),\n message: error.message,\n },\n loc: { line: 1, column: 0 },\n });\n }\n }\n },\n };\n },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-cache.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-deprecated-graphql-fields/schema-cache.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,qCAA0D;AAE1D;;;GAGG;AACH,MAAM,WAAW,GAAG,IAAI,GAAG,EAAyB,CAAC;AAE9C,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAwB,EAAE;IACpE,IAAI,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,OAAO,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC;IAC7C,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,CAAC;QACpC,WAAW,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,SAAS,aAYpB;AAEK,MAAM,gBAAgB,GAAG,GAAS,EAAE;IACzC,WAAW,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B","sourcesContent":["import * as fs from \"fs\";\nimport { type GraphQLSchema, buildSchema } from \"graphql\";\n\n/**\n * Caches parsed schemas by path to avoid re-parsing on every project.json lint.\n * Isolated in its own module so tests can reset it independently of the rule's production exports.\n */\nconst schemaCache = new Map<string, GraphQLSchema>();\n\nexport const getSchema = (schemaPath: string): GraphQLSchema | null => {\n if (schemaCache.has(schemaPath)) {\n return schemaCache.get(schemaPath) ?? null;\n }\n try {\n const content = fs.readFileSync(schemaPath, \"utf8\");\n const schema = buildSchema(content);\n schemaCache.set(schemaPath, schema);\n return schema;\n } catch {\n return null;\n }\n};\n\nexport const clearSchemaCache = (): void => {\n schemaCache.clear();\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-dynamic-translation-key.js","sourceRoot":"","sources":["../../../../../../../../libs/eslint/plugin-trackunit/src/lib/rules/no-dynamic-translation-key/no-dynamic-translation-key.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,oDAAgG;AAChG,6EAA8E;AAE9E,MAAM,UAAU,GAAG,mBAAW,CAAC,WAAW,CACxC,IAAI,CAAC,EAAE,CAAC,6FAA6F,IAAI,IAAI,IAAI,KAAK,CACvH,CAAC;AAKF,oGAAoG;AACpG,MAAM,sBAAsB,GAAG,CAAC,IAAmB,EAAoC,EAAE,CACvF,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,MAAM,kBAAkB,GAAG,CAAC,IAAmB,EAAiB,EAAE;IAChE,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OACE,OAAO,CAAC,IAAI,KAAK,sBAAc,CAAC,cAAc;QAC9C,OAAO,CAAC,IAAI,KAAK,sBAAc,CAAC,qBAAqB;QACrD,OAAO,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;QACnD,OAAO,CAAC,IAAI,KAAK,sBAAc,CAAC,eAAe,EAC/C,CAAC;QACD,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,CAC9B,OAAkD,EAClD,eAAyC,EAChC,EAAE;IACX,IAAI,CAAC;QACH,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;QACZ,OAAO;YACL,cAAc,CAAC,IAAI;gBACjB,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACtC,OAAO;gBACT,CAAC;gBACD,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAClC,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,OAAO;gBACT,CAAC;gBACD,MAAM,GAAG,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;gBACzC,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;oBACzE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;YACD,YAAY,CAAC,IAAI;gBACf,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBACpF,OAAO;gBACT,CAAC;gBACD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;gBACvB,IAAI,KAAK,EAAE,IAAI,KAAK,sBAAc,CAAC,sBAAsB,EAAE,CAAC;oBAC1D,OAAO;gBACT,CAAC;gBACD,MAAM,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;gBACjD,IAAI,sBAAsB,CAAC,GAAG,CAAC,IAAI,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;oBACzE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * ESLint rule that discourages building i18next translation keys dynamically\n * with template strings (e.g. `t(`pages.categories.${category}`)`).\n *\n * Dynamic keys are impossible to analyse statically: they defeat the typed\n * translation-key safety and make it impossible to tell which keys in a\n * `translation.json` are actually used. Mapping the value to an explicit key\n * with a `switch` statement or a `Record` keeps keys statically analysable and\n * lets `no-unused-translation-key` detect orphaned translations.\n *\n * @example\n * // Bad\n * t(`pages.categories.${category}`);\n * <Trans i18nKey={`pages.categories.${category}`} />;\n *\n * // Good\n * const categoryKey: Record<Category, TranslationKeys> = { ... };\n * t(categoryKey[category]);\n */\nimport { AST_NODE_TYPES, ESLintUtils, type TSESLint, TSESTree } from \"@typescript-eslint/utils\";\nimport { classifyInterpolationType } from \"../../utils/translation-key-types\";\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 = \"dynamicKey\";\ntype Options = [];\n\n/** A template literal that actually interpolates a value, e.g. `foo.${bar}` (not a plain `foo`). */\nconst isInterpolatedTemplate = (node: TSESTree.Node): node is TSESTree.TemplateLiteral =>\n node.type === AST_NODE_TYPES.TemplateLiteral && node.expressions.length > 0;\n\n/**\n * Strips `as`/`satisfies`/non-null/`<T>`-assertion wrappers to reach the underlying expression.\n *\n * `` t(`a.${x}` as never) `` parses as a `TSAsExpression` whose `.expression` is the real\n * `TemplateLiteral`, so without this the wrapper silently hides the dynamic key from the rule.\n * That is an escape hatch we must not offer: casting a widened interpolation is exactly what this\n * rule exists to forbid, and the sibling `no-unused-translation-key` already unwraps the same\n * wrappers (see its `expand-dynamic-key.ts#unwrapToTemplateExpression`), so leaving them here means\n * one rule sees the key and the other does not.\n */\nconst unwrapTypeWrappers = (node: TSESTree.Node): TSESTree.Node => {\n let current = node;\n while (\n current.type === AST_NODE_TYPES.TSAsExpression ||\n current.type === AST_NODE_TYPES.TSSatisfiesExpression ||\n current.type === AST_NODE_TYPES.TSNonNullExpression ||\n current.type === AST_NODE_TYPES.TSTypeAssertion\n ) {\n current = current.expression;\n }\n return current;\n};\n\n/**\n * Whether a template literal's interpolations should be flagged: true unless every\n * interpolated expression's TypeScript type is a finite string-literal union (in which\n * case every possible resulting key is statically enumerable). If type resolution fails\n * for any reason (e.g. a non-type-aware lint run), fails safe by flagging the template.\n */\nconst hasWidenedInterpolation = (\n context: TSESLint.RuleContext<MessageIds, Options>,\n templateLiteral: TSESTree.TemplateLiteral\n): boolean => {\n try {\n const services = ESLintUtils.getParserServices(context);\n const checker = services.program.getTypeChecker();\n\n return templateLiteral.expressions.some(expr => {\n const tsNode = services.esTreeNodeToTSNodeMap.get(expr);\n const type = checker.getTypeAtLocation(tsNode);\n return classifyInterpolationType(type) === \"widened\";\n });\n } catch {\n return true;\n }\n};\n\n/** A call to the translation function: either a bare `t(...)` or a member call like `i18n.t(...)`. */\nconst isTranslationCallee = (callee: TSESTree.Node): boolean => {\n if (callee.type === AST_NODE_TYPES.Identifier) {\n return callee.name === \"t\";\n }\n return (\n callee.type === AST_NODE_TYPES.MemberExpression &&\n !callee.computed &&\n callee.property.type === AST_NODE_TYPES.Identifier &&\n callee.property.name === \"t\"\n );\n};\n\nexport const noDynamicTranslationKey = createRule<Options, MessageIds>({\n name: \"no-dynamic-translation-key\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow building i18next translation keys dynamically with template strings; map values to explicit keys with a switch or Record instead.\",\n },\n messages: {\n dynamicKey:\n \"Avoid building translation keys dynamically with template strings unless every interpolated value has a finite string-literal union type (TypeScript can then enumerate every possible key). Otherwise, map the value to an explicit key using a switch statement or a Record so keys stay statically analysable and unused keys can be detected.\",\n },\n schema: [],\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node) {\n if (!isTranslationCallee(node.callee)) {\n return;\n }\n const [firstArg] = node.arguments;\n if (!firstArg) {\n return;\n }\n const key = unwrapTypeWrappers(firstArg);\n if (isInterpolatedTemplate(key) && hasWidenedInterpolation(context, key)) {\n context.report({ node: key, messageId: \"dynamicKey\" });\n }\n },\n JSXAttribute(node) {\n if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || node.name.name !== \"i18nKey\") {\n return;\n }\n const { value } = node;\n if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) {\n return;\n }\n const key = unwrapTypeWrappers(value.expression);\n if (isInterpolatedTemplate(key) && hasWidenedInterpolation(context, key)) {\n context.report({ node: key, messageId: \"dynamicKey\" });\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,CAAC,MAAM,CAAC,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;KAChD,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEjE;;GAEG;AACH,MAAM,iBAAiB,GAAG,CAAC,SAAiB,EAAiB,EAAE;IAC7D,MAAM,UAAU,GAAG,IAAA,4BAAe,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACzD,OAAO,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CA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BAAqB,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;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,4BAA4B,GAAG,CAAC,OAAe,EAAE,QAAgB,EAAE,EAAE;YACzE,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;YAC1B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;YACpD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CA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BAClE,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.filename;\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"]}
|