@memberjunction/react-linter 0.0.1 → 5.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-linter.d.ts +77 -0
- package/dist/component-linter.d.ts.map +1 -0
- package/dist/component-linter.js +1206 -0
- package/dist/component-linter.js.map +1 -0
- package/dist/control-flow-analyzer.d.ts +184 -0
- package/dist/control-flow-analyzer.d.ts.map +1 -0
- package/dist/control-flow-analyzer.js +798 -0
- package/dist/control-flow-analyzer.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/library-lint-cache.d.ts +50 -0
- package/dist/library-lint-cache.d.ts.map +1 -0
- package/dist/library-lint-cache.js +173 -0
- package/dist/library-lint-cache.js.map +1 -0
- package/dist/lint-rule.d.ts +70 -0
- package/dist/lint-rule.d.ts.map +1 -0
- package/dist/lint-rule.js +30 -0
- package/dist/lint-rule.js.map +1 -0
- package/dist/lint-utils.d.ts +131 -0
- package/dist/lint-utils.d.ts.map +1 -0
- package/dist/lint-utils.js +358 -0
- package/dist/lint-utils.js.map +1 -0
- package/dist/linter-options.d.ts +51 -0
- package/dist/linter-options.d.ts.map +1 -0
- package/dist/linter-options.js +2 -0
- package/dist/linter-options.js.map +1 -0
- package/dist/prop-value-extractor.d.ts +147 -0
- package/dist/prop-value-extractor.d.ts.map +1 -0
- package/dist/prop-value-extractor.js +472 -0
- package/dist/prop-value-extractor.js.map +1 -0
- package/dist/runtime-rules/ai-tools-availability-check.d.ts +9 -0
- package/dist/runtime-rules/ai-tools-availability-check.d.ts.map +1 -0
- package/dist/runtime-rules/ai-tools-availability-check.js +223 -0
- package/dist/runtime-rules/ai-tools-availability-check.js.map +1 -0
- package/dist/runtime-rules/callback-event-validation.d.ts +22 -0
- package/dist/runtime-rules/callback-event-validation.d.ts.map +1 -0
- package/dist/runtime-rules/callback-event-validation.js +561 -0
- package/dist/runtime-rules/callback-event-validation.js.map +1 -0
- package/dist/runtime-rules/chart-field-validation.d.ts +10 -0
- package/dist/runtime-rules/chart-field-validation.d.ts.map +1 -0
- package/dist/runtime-rules/chart-field-validation.js +270 -0
- package/dist/runtime-rules/chart-field-validation.js.map +1 -0
- package/dist/runtime-rules/child-component-prop-validation.d.ts +11 -0
- package/dist/runtime-rules/child-component-prop-validation.d.ts.map +1 -0
- package/dist/runtime-rules/child-component-prop-validation.js +443 -0
- package/dist/runtime-rules/child-component-prop-validation.js.map +1 -0
- package/dist/runtime-rules/component-name-mismatch.d.ts +19 -0
- package/dist/runtime-rules/component-name-mismatch.d.ts.map +1 -0
- package/dist/runtime-rules/component-name-mismatch.js +82 -0
- package/dist/runtime-rules/component-name-mismatch.js.map +1 -0
- package/dist/runtime-rules/component-not-in-dependencies.d.ts +20 -0
- package/dist/runtime-rules/component-not-in-dependencies.d.ts.map +1 -0
- package/dist/runtime-rules/component-not-in-dependencies.js +92 -0
- package/dist/runtime-rules/component-not-in-dependencies.js.map +1 -0
- package/dist/runtime-rules/component-props-validation.d.ts +25 -0
- package/dist/runtime-rules/component-props-validation.d.ts.map +1 -0
- package/dist/runtime-rules/component-props-validation.js +228 -0
- package/dist/runtime-rules/component-props-validation.js.map +1 -0
- package/dist/runtime-rules/component-usage-without-destructuring.d.ts +20 -0
- package/dist/runtime-rules/component-usage-without-destructuring.d.ts.map +1 -0
- package/dist/runtime-rules/component-usage-without-destructuring.js +124 -0
- package/dist/runtime-rules/component-usage-without-destructuring.js.map +1 -0
- package/dist/runtime-rules/data-result-validation.d.ts +9 -0
- package/dist/runtime-rules/data-result-validation.d.ts.map +1 -0
- package/dist/runtime-rules/data-result-validation.js +763 -0
- package/dist/runtime-rules/data-result-validation.js.map +1 -0
- package/dist/runtime-rules/datagrid-field-validation.d.ts +10 -0
- package/dist/runtime-rules/datagrid-field-validation.d.ts.map +1 -0
- package/dist/runtime-rules/datagrid-field-validation.js +249 -0
- package/dist/runtime-rules/datagrid-field-validation.js.map +1 -0
- package/dist/runtime-rules/dependency-shadowing.d.ts +20 -0
- package/dist/runtime-rules/dependency-shadowing.d.ts.map +1 -0
- package/dist/runtime-rules/dependency-shadowing.js +147 -0
- package/dist/runtime-rules/dependency-shadowing.js.map +1 -0
- package/dist/runtime-rules/entity-field-access-validation.d.ts +12 -0
- package/dist/runtime-rules/entity-field-access-validation.d.ts.map +1 -0
- package/dist/runtime-rules/entity-field-access-validation.js +304 -0
- package/dist/runtime-rules/entity-field-access-validation.js.map +1 -0
- package/dist/runtime-rules/event-parameter-validation.d.ts +22 -0
- package/dist/runtime-rules/event-parameter-validation.d.ts.map +1 -0
- package/dist/runtime-rules/event-parameter-validation.js +406 -0
- package/dist/runtime-rules/event-parameter-validation.js.map +1 -0
- package/dist/runtime-rules/index.d.ts +61 -0
- package/dist/runtime-rules/index.d.ts.map +1 -0
- package/dist/runtime-rules/index.js +62 -0
- package/dist/runtime-rules/index.js.map +1 -0
- package/dist/runtime-rules/library-variable-names.d.ts +24 -0
- package/dist/runtime-rules/library-variable-names.d.ts.map +1 -0
- package/dist/runtime-rules/library-variable-names.js +88 -0
- package/dist/runtime-rules/library-variable-names.js.map +1 -0
- package/dist/runtime-rules/no-child-implementation.d.ts +18 -0
- package/dist/runtime-rules/no-child-implementation.d.ts.map +1 -0
- package/dist/runtime-rules/no-child-implementation.js +57 -0
- package/dist/runtime-rules/no-child-implementation.js.map +1 -0
- package/dist/runtime-rules/no-data-prop.d.ts +22 -0
- package/dist/runtime-rules/no-data-prop.d.ts.map +1 -0
- package/dist/runtime-rules/no-data-prop.js +111 -0
- package/dist/runtime-rules/no-data-prop.js.map +1 -0
- package/dist/runtime-rules/no-export-statements.d.ts +18 -0
- package/dist/runtime-rules/no-export-statements.d.ts.map +1 -0
- package/dist/runtime-rules/no-export-statements.js +143 -0
- package/dist/runtime-rules/no-export-statements.js.map +1 -0
- package/dist/runtime-rules/no-iife-wrapper.d.ts +18 -0
- package/dist/runtime-rules/no-iife-wrapper.d.ts.map +1 -0
- package/dist/runtime-rules/no-iife-wrapper.js +217 -0
- package/dist/runtime-rules/no-iife-wrapper.js.map +1 -0
- package/dist/runtime-rules/no-import-statements.d.ts +18 -0
- package/dist/runtime-rules/no-import-statements.d.ts.map +1 -0
- package/dist/runtime-rules/no-import-statements.js +65 -0
- package/dist/runtime-rules/no-import-statements.js.map +1 -0
- package/dist/runtime-rules/no-react-destructuring.d.ts +18 -0
- package/dist/runtime-rules/no-react-destructuring.d.ts.map +1 -0
- package/dist/runtime-rules/no-react-destructuring.js +60 -0
- package/dist/runtime-rules/no-react-destructuring.js.map +1 -0
- package/dist/runtime-rules/no-require-statements.d.ts +18 -0
- package/dist/runtime-rules/no-require-statements.d.ts.map +1 -0
- package/dist/runtime-rules/no-require-statements.js +109 -0
- package/dist/runtime-rules/no-require-statements.js.map +1 -0
- package/dist/runtime-rules/no-return-component.d.ts +18 -0
- package/dist/runtime-rules/no-return-component.d.ts.map +1 -0
- package/dist/runtime-rules/no-return-component.js +106 -0
- package/dist/runtime-rules/no-return-component.js.map +1 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.d.ts +20 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.d.ts.map +1 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.js +75 -0
- package/dist/runtime-rules/no-unwrap-utility-libs.js.map +1 -0
- package/dist/runtime-rules/no-use-reducer.d.ts +19 -0
- package/dist/runtime-rules/no-use-reducer.d.ts.map +1 -0
- package/dist/runtime-rules/no-use-reducer.js +78 -0
- package/dist/runtime-rules/no-use-reducer.js.map +1 -0
- package/dist/runtime-rules/no-window-access.d.ts +23 -0
- package/dist/runtime-rules/no-window-access.d.ts.map +1 -0
- package/dist/runtime-rules/no-window-access.js +136 -0
- package/dist/runtime-rules/no-window-access.js.map +1 -0
- package/dist/runtime-rules/noisy-settings-updates.d.ts +18 -0
- package/dist/runtime-rules/noisy-settings-updates.d.ts.map +1 -0
- package/dist/runtime-rules/noisy-settings-updates.js +110 -0
- package/dist/runtime-rules/noisy-settings-updates.js.map +1 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts +30 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts.map +1 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.js +220 -0
- package/dist/runtime-rules/overflow-hidden-on-layout-container.js.map +1 -0
- package/dist/runtime-rules/pass-standard-props.d.ts +19 -0
- package/dist/runtime-rules/pass-standard-props.d.ts.map +1 -0
- package/dist/runtime-rules/pass-standard-props.js +82 -0
- package/dist/runtime-rules/pass-standard-props.js.map +1 -0
- package/dist/runtime-rules/prefer-async-await.d.ts +17 -0
- package/dist/runtime-rules/prefer-async-await.d.ts.map +1 -0
- package/dist/runtime-rules/prefer-async-await.js +52 -0
- package/dist/runtime-rules/prefer-async-await.js.map +1 -0
- package/dist/runtime-rules/prefer-jsx-syntax.d.ts +17 -0
- package/dist/runtime-rules/prefer-jsx-syntax.d.ts.map +1 -0
- package/dist/runtime-rules/prefer-jsx-syntax.js +51 -0
- package/dist/runtime-rules/prefer-jsx-syntax.js.map +1 -0
- package/dist/runtime-rules/prop-state-sync.d.ts +19 -0
- package/dist/runtime-rules/prop-state-sync.d.ts.map +1 -0
- package/dist/runtime-rules/prop-state-sync.js +76 -0
- package/dist/runtime-rules/prop-state-sync.js.map +1 -0
- package/dist/runtime-rules/property-name-consistency.d.ts +20 -0
- package/dist/runtime-rules/property-name-consistency.d.ts.map +1 -0
- package/dist/runtime-rules/property-name-consistency.js +172 -0
- package/dist/runtime-rules/property-name-consistency.js.map +1 -0
- package/dist/runtime-rules/query-result-field-access-validation.d.ts +10 -0
- package/dist/runtime-rules/query-result-field-access-validation.d.ts.map +1 -0
- package/dist/runtime-rules/query-result-field-access-validation.js +304 -0
- package/dist/runtime-rules/query-result-field-access-validation.js.map +1 -0
- package/dist/runtime-rules/react-component-naming.d.ts +19 -0
- package/dist/runtime-rules/react-component-naming.d.ts.map +1 -0
- package/dist/runtime-rules/react-component-naming.js +72 -0
- package/dist/runtime-rules/react-component-naming.js.map +1 -0
- package/dist/runtime-rules/react-hooks-rules.d.ts +27 -0
- package/dist/runtime-rules/react-hooks-rules.d.ts.map +1 -0
- package/dist/runtime-rules/react-hooks-rules.js +223 -0
- package/dist/runtime-rules/react-hooks-rules.js.map +1 -0
- package/dist/runtime-rules/required-queries-not-called.d.ts +19 -0
- package/dist/runtime-rules/required-queries-not-called.d.ts.map +1 -0
- package/dist/runtime-rules/required-queries-not-called.js +146 -0
- package/dist/runtime-rules/required-queries-not-called.js.map +1 -0
- package/dist/runtime-rules/runquery-call-validation.d.ts +11 -0
- package/dist/runtime-rules/runquery-call-validation.d.ts.map +1 -0
- package/dist/runtime-rules/runquery-call-validation.js +886 -0
- package/dist/runtime-rules/runquery-call-validation.js.map +1 -0
- package/dist/runtime-rules/runview-call-validation.d.ts +10 -0
- package/dist/runtime-rules/runview-call-validation.d.ts.map +1 -0
- package/dist/runtime-rules/runview-call-validation.js +336 -0
- package/dist/runtime-rules/runview-call-validation.js.map +1 -0
- package/dist/runtime-rules/saved-user-settings-pattern.d.ts +19 -0
- package/dist/runtime-rules/saved-user-settings-pattern.d.ts.map +1 -0
- package/dist/runtime-rules/saved-user-settings-pattern.js +90 -0
- package/dist/runtime-rules/saved-user-settings-pattern.js.map +1 -0
- package/dist/runtime-rules/search-availability-check.d.ts +9 -0
- package/dist/runtime-rules/search-availability-check.d.ts.map +1 -0
- package/dist/runtime-rules/search-availability-check.js +220 -0
- package/dist/runtime-rules/search-availability-check.js.map +1 -0
- package/dist/runtime-rules/search-call-validation.d.ts +9 -0
- package/dist/runtime-rules/search-call-validation.d.ts.map +1 -0
- package/dist/runtime-rules/search-call-validation.js +336 -0
- package/dist/runtime-rules/search-call-validation.js.map +1 -0
- package/dist/runtime-rules/server-reload-on-client-operation.d.ts +18 -0
- package/dist/runtime-rules/server-reload-on-client-operation.d.ts.map +1 -0
- package/dist/runtime-rules/server-reload-on-client-operation.js +107 -0
- package/dist/runtime-rules/server-reload-on-client-operation.js.map +1 -0
- package/dist/runtime-rules/single-function-only.d.ts +18 -0
- package/dist/runtime-rules/single-function-only.d.ts.map +1 -0
- package/dist/runtime-rules/single-function-only.js +103 -0
- package/dist/runtime-rules/single-function-only.js.map +1 -0
- package/dist/runtime-rules/string-replace-all-occurrences.d.ts +19 -0
- package/dist/runtime-rules/string-replace-all-occurrences.d.ts.map +1 -0
- package/dist/runtime-rules/string-replace-all-occurrences.js +109 -0
- package/dist/runtime-rules/string-replace-all-occurrences.js.map +1 -0
- package/dist/runtime-rules/string-template-validation.d.ts +22 -0
- package/dist/runtime-rules/string-template-validation.d.ts.map +1 -0
- package/dist/runtime-rules/string-template-validation.js +163 -0
- package/dist/runtime-rules/string-template-validation.js.map +1 -0
- package/dist/runtime-rules/styles-validation.d.ts +10 -0
- package/dist/runtime-rules/styles-validation.d.ts.map +1 -0
- package/dist/runtime-rules/styles-validation.js +153 -0
- package/dist/runtime-rules/styles-validation.js.map +1 -0
- package/dist/runtime-rules/type-inference-errors.d.ts +23 -0
- package/dist/runtime-rules/type-inference-errors.d.ts.map +1 -0
- package/dist/runtime-rules/type-inference-errors.js +53 -0
- package/dist/runtime-rules/type-inference-errors.js.map +1 -0
- package/dist/runtime-rules/type-mismatch-operation.d.ts +23 -0
- package/dist/runtime-rules/type-mismatch-operation.d.ts.map +1 -0
- package/dist/runtime-rules/type-mismatch-operation.js +145 -0
- package/dist/runtime-rules/type-mismatch-operation.js.map +1 -0
- package/dist/runtime-rules/undefined-component-usage.d.ts +20 -0
- package/dist/runtime-rules/undefined-component-usage.d.ts.map +1 -0
- package/dist/runtime-rules/undefined-component-usage.js +138 -0
- package/dist/runtime-rules/undefined-component-usage.js.map +1 -0
- package/dist/runtime-rules/undefined-jsx-component.d.ts +25 -0
- package/dist/runtime-rules/undefined-jsx-component.d.ts.map +1 -0
- package/dist/runtime-rules/undefined-jsx-component.js +269 -0
- package/dist/runtime-rules/undefined-jsx-component.js.map +1 -0
- package/dist/runtime-rules/unsafe-array-operations.d.ts +25 -0
- package/dist/runtime-rules/unsafe-array-operations.d.ts.map +1 -0
- package/dist/runtime-rules/unsafe-array-operations.js +347 -0
- package/dist/runtime-rules/unsafe-array-operations.js.map +1 -0
- package/dist/runtime-rules/unsafe-formatting-methods.d.ts +24 -0
- package/dist/runtime-rules/unsafe-formatting-methods.d.ts.map +1 -0
- package/dist/runtime-rules/unsafe-formatting-methods.js +277 -0
- package/dist/runtime-rules/unsafe-formatting-methods.js.map +1 -0
- package/dist/runtime-rules/unused-component-dependencies.d.ts +19 -0
- package/dist/runtime-rules/unused-component-dependencies.d.ts.map +1 -0
- package/dist/runtime-rules/unused-component-dependencies.js +90 -0
- package/dist/runtime-rules/unused-component-dependencies.js.map +1 -0
- package/dist/runtime-rules/unused-libraries.d.ts +19 -0
- package/dist/runtime-rules/unused-libraries.d.ts.map +1 -0
- package/dist/runtime-rules/unused-libraries.js +127 -0
- package/dist/runtime-rules/unused-libraries.js.map +1 -0
- package/dist/runtime-rules/use-function-declaration.d.ts +18 -0
- package/dist/runtime-rules/use-function-declaration.d.ts.map +1 -0
- package/dist/runtime-rules/use-function-declaration.js +127 -0
- package/dist/runtime-rules/use-function-declaration.js.map +1 -0
- package/dist/runtime-rules/use-unwrap-components.d.ts +19 -0
- package/dist/runtime-rules/use-unwrap-components.d.ts.map +1 -0
- package/dist/runtime-rules/use-unwrap-components.js +84 -0
- package/dist/runtime-rules/use-unwrap-components.js.map +1 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts +23 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts.map +1 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.js +215 -0
- package/dist/runtime-rules/useeffect-unstable-dependencies.js.map +1 -0
- package/dist/runtime-rules/utilities-api-validation.d.ts +24 -0
- package/dist/runtime-rules/utilities-api-validation.d.ts.map +1 -0
- package/dist/runtime-rules/utilities-api-validation.js +121 -0
- package/dist/runtime-rules/utilities-api-validation.js.map +1 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts +20 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts.map +1 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.js +58 -0
- package/dist/runtime-rules/utilities-no-direct-instantiation.js.map +1 -0
- package/dist/runtime-rules/validate-component-references.d.ts +19 -0
- package/dist/runtime-rules/validate-component-references.d.ts.map +1 -0
- package/dist/runtime-rules/validate-component-references.js +255 -0
- package/dist/runtime-rules/validate-component-references.js.map +1 -0
- package/dist/schema-validation/component-prop-rule.d.ts +131 -0
- package/dist/schema-validation/component-prop-rule.d.ts.map +1 -0
- package/dist/schema-validation/component-prop-rule.js +625 -0
- package/dist/schema-validation/component-prop-rule.js.map +1 -0
- package/dist/schema-validation/index.d.ts +26 -0
- package/dist/schema-validation/index.d.ts.map +1 -0
- package/dist/schema-validation/index.js +26 -0
- package/dist/schema-validation/index.js.map +1 -0
- package/dist/schema-validation/semantic-validators/index.d.ts +23 -0
- package/dist/schema-validation/semantic-validators/index.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/index.js +23 -0
- package/dist/schema-validation/semantic-validators/index.js.map +1 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.d.ts +43 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.js +94 -0
- package/dist/schema-validation/semantic-validators/required-when-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts +122 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.js +166 -0
- package/dist/schema-validation/semantic-validators/semantic-validator-registry.js.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.d.ts +260 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.js +301 -0
- package/dist/schema-validation/semantic-validators/semantic-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts +115 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js +381 -0
- package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts +60 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js +195 -0
- package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js.map +1 -0
- package/dist/schema-validation/semantic-validators/validation-context.d.ts +335 -0
- package/dist/schema-validation/semantic-validators/validation-context.d.ts.map +1 -0
- package/dist/schema-validation/semantic-validators/validation-context.js +13 -0
- package/dist/schema-validation/semantic-validators/validation-context.js.map +1 -0
- package/dist/styles-type-analyzer.d.ts +64 -0
- package/dist/styles-type-analyzer.d.ts.map +1 -0
- package/dist/styles-type-analyzer.js +242 -0
- package/dist/styles-type-analyzer.js.map +1 -0
- package/dist/type-context.d.ts +184 -0
- package/dist/type-context.d.ts.map +1 -0
- package/dist/type-context.js +415 -0
- package/dist/type-context.js.map +1 -0
- package/dist/type-inference-engine.d.ts +181 -0
- package/dist/type-inference-engine.d.ts.map +1 -0
- package/dist/type-inference-engine.js +1151 -0
- package/dist/type-inference-engine.js.map +1 -0
- package/dist/type-rules/type-compatibility-rule.d.ts +85 -0
- package/dist/type-rules/type-compatibility-rule.d.ts.map +1 -0
- package/dist/type-rules/type-compatibility-rule.js +211 -0
- package/dist/type-rules/type-compatibility-rule.js.map +1 -0
- package/package.json +35 -7
- package/README.md +0 -45
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
8
|
+
import * as t from '@babel/types';
|
|
9
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
10
|
+
import { traverse, createViolation, truncateCode } from '../lint-utils.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: use-function-declaration
|
|
13
|
+
*
|
|
14
|
+
* Ensures that components use function declaration syntax instead of
|
|
15
|
+
* arrow functions or function expressions.
|
|
16
|
+
*
|
|
17
|
+
* Severity: critical
|
|
18
|
+
* Applies to: all components
|
|
19
|
+
*/
|
|
20
|
+
let UseFunctionDeclarationRule = class UseFunctionDeclarationRule extends BaseLintRule {
|
|
21
|
+
get Name() { return 'use-function-declaration'; }
|
|
22
|
+
get AppliesTo() { return 'all'; }
|
|
23
|
+
Test(ast, componentName) {
|
|
24
|
+
const violations = [];
|
|
25
|
+
traverse(ast, {
|
|
26
|
+
VariableDeclarator(path) {
|
|
27
|
+
// Only check TOP-LEVEL declarations (not nested inside functions)
|
|
28
|
+
// This prevents flagging arrow functions inside the component
|
|
29
|
+
const isTopLevel = path.getFunctionParent() === null || path.scope.path.type === 'Program';
|
|
30
|
+
if (!isTopLevel) {
|
|
31
|
+
return; // Skip non-top-level declarations
|
|
32
|
+
}
|
|
33
|
+
// Check if this is the main component being defined as arrow function
|
|
34
|
+
if (t.isIdentifier(path.node.id) && path.node.id.name === componentName) {
|
|
35
|
+
const init = path.node.init;
|
|
36
|
+
// Check if it's an arrow function
|
|
37
|
+
if (t.isArrowFunctionExpression(init)) {
|
|
38
|
+
violations.push(createViolation('use-function-declaration', 'critical', path.node, `Component "${componentName}" must be defined using function declaration syntax, not arrow function.`, truncateCode(path.toString(), 150), {
|
|
39
|
+
text: 'Use function declaration syntax for TOP-LEVEL component definitions. Arrow functions are fine inside components.',
|
|
40
|
+
example: `// ❌ WRONG - Top-level arrow function component:
|
|
41
|
+
const MyComponent = ({ utilities, styles, components }) => {
|
|
42
|
+
const [state, setState] = useState('');
|
|
43
|
+
|
|
44
|
+
return <div>{state}</div>;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ✅ CORRECT - Function declaration for top-level:
|
|
48
|
+
function MyComponent({ utilities, styles, components }) {
|
|
49
|
+
const [state, setState] = useState('');
|
|
50
|
+
|
|
51
|
+
// Arrow functions are FINE inside the component:
|
|
52
|
+
const handleClick = () => {
|
|
53
|
+
setState('clicked');
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const ChildComponent = () => <div>This is OK inside the component</div>;
|
|
57
|
+
|
|
58
|
+
return <div onClick={handleClick}>{state}</div>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Child components also use function declaration:
|
|
62
|
+
function ChildComponent() {
|
|
63
|
+
return <div>Child</div>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Why function declarations?
|
|
67
|
+
// 1. Clearer component identification
|
|
68
|
+
// 2. Better debugging experience (named functions)
|
|
69
|
+
// 3. Hoisting allows flexible code organization
|
|
70
|
+
// 4. Consistent with React documentation patterns
|
|
71
|
+
// 5. Easier to distinguish from regular variables`,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Also check for any other TOP-LEVEL component-like arrow functions (starts with capital letter)
|
|
76
|
+
// But ONLY at the top level, not inside the component
|
|
77
|
+
if (t.isIdentifier(path.node.id) && /^[A-Z]/.test(path.node.id.name)) {
|
|
78
|
+
const init = path.node.init;
|
|
79
|
+
if (t.isArrowFunctionExpression(init)) {
|
|
80
|
+
// Only flag if it's at the top level (parallel to main component)
|
|
81
|
+
violations.push(createViolation('use-function-declaration', 'high', path.node, `Top-level component "${path.node.id.name}" should use function declaration syntax.`, truncateCode(path.toString(), 150), {
|
|
82
|
+
text: 'Use function declaration syntax for TOP-LEVEL component definitions. Arrow functions are fine inside components.',
|
|
83
|
+
example: `// ❌ WRONG - Top-level arrow function component:
|
|
84
|
+
const MyComponent = ({ utilities, styles, components }) => {
|
|
85
|
+
const [state, setState] = useState('');
|
|
86
|
+
|
|
87
|
+
return <div>{state}</div>;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// ✅ CORRECT - Function declaration for top-level:
|
|
91
|
+
function MyComponent({ utilities, styles, components }) {
|
|
92
|
+
const [state, setState] = useState('');
|
|
93
|
+
|
|
94
|
+
// Arrow functions are FINE inside the component:
|
|
95
|
+
const handleClick = () => {
|
|
96
|
+
setState('clicked');
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const ChildComponent = () => <div>This is OK inside the component</div>;
|
|
100
|
+
|
|
101
|
+
return <div onClick={handleClick}>{state}</div>;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Child components also use function declaration:
|
|
105
|
+
function ChildComponent() {
|
|
106
|
+
return <div>Child</div>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Why function declarations?
|
|
110
|
+
// 1. Clearer component identification
|
|
111
|
+
// 2. Better debugging experience (named functions)
|
|
112
|
+
// 3. Hoisting allows flexible code organization
|
|
113
|
+
// 4. Consistent with React documentation patterns
|
|
114
|
+
// 5. Easier to distinguish from regular variables`,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
return violations;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
UseFunctionDeclarationRule = __decorate([
|
|
124
|
+
RegisterClass(BaseLintRule, 'use-function-declaration')
|
|
125
|
+
], UseFunctionDeclarationRule);
|
|
126
|
+
export { UseFunctionDeclarationRule };
|
|
127
|
+
//# sourceMappingURL=use-function-declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-function-declaration.js","sourceRoot":"","sources":["../../src/runtime-rules/use-function-declaration.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAY,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElF;;;;;;;;GAQG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,YAAY;IAC1D,IAAI,IAAI,KAAK,OAAO,0BAA0B,CAAC,CAAC,CAAC;IACjD,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB;QACrC,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,QAAQ,CAAC,GAAG,EAAE;YACZ,kBAAkB,CAAC,IAAoC;gBACrD,kEAAkE;gBAClE,8DAA8D;gBAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,iBAAiB,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;gBAE3F,IAAI,CAAC,UAAU,EAAE,CAAC;oBAChB,OAAO,CAAC,kCAAkC;gBAC5C,CAAC;gBAED,sEAAsE;gBACtE,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;oBACxE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBAE5B,kCAAkC;oBAClC,IAAI,CAAC,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,CAAC;wB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|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
5
|
+
/**
|
|
6
|
+
* Rule: use-unwrap-components
|
|
7
|
+
*
|
|
8
|
+
* Ensures that components use unwrapComponents() utility to access library components
|
|
9
|
+
* instead of direct destructuring. This ensures safe access to library APIs.
|
|
10
|
+
*
|
|
11
|
+
* Severity: critical
|
|
12
|
+
* Applies to: all components
|
|
13
|
+
*/
|
|
14
|
+
export declare class UseUnwrapComponentsRule extends BaseLintRule {
|
|
15
|
+
get Name(): string;
|
|
16
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
17
|
+
Test(ast: t.File, _componentName: string, componentSpec?: ComponentSpec): Violation[];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=use-unwrap-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-unwrap-components.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/use-unwrap-components.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;GAQG;AACH,qBACa,uBAAwB,SAAQ,YAAY;IACvD,IAAI,IAAI,WAAsC;IAC9C,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE;CA8DtF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { traverse } from '../lint-utils.js';
|
|
8
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import * as t from '@babel/types';
|
|
10
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: use-unwrap-components
|
|
13
|
+
*
|
|
14
|
+
* Ensures that components use unwrapComponents() utility to access library components
|
|
15
|
+
* instead of direct destructuring. This ensures safe access to library APIs.
|
|
16
|
+
*
|
|
17
|
+
* Severity: critical
|
|
18
|
+
* Applies to: all components
|
|
19
|
+
*/
|
|
20
|
+
let UseUnwrapComponentsRule = class UseUnwrapComponentsRule extends BaseLintRule {
|
|
21
|
+
get Name() { return 'use-unwrap-components'; }
|
|
22
|
+
get AppliesTo() { return 'all'; }
|
|
23
|
+
Test(ast, _componentName, componentSpec) {
|
|
24
|
+
const violations = [];
|
|
25
|
+
// Build a set of library global variables
|
|
26
|
+
const libraryGlobals = new Set();
|
|
27
|
+
if (componentSpec?.libraries) {
|
|
28
|
+
for (const lib of componentSpec.libraries) {
|
|
29
|
+
if (lib.globalVariable) {
|
|
30
|
+
libraryGlobals.add(lib.globalVariable);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
traverse(ast, {
|
|
35
|
+
VariableDeclarator(path) {
|
|
36
|
+
// Check for direct destructuring from library globals
|
|
37
|
+
if (t.isObjectPattern(path.node.id) && t.isIdentifier(path.node.init)) {
|
|
38
|
+
const sourceVar = path.node.init.name;
|
|
39
|
+
// Check if this is destructuring from a library global
|
|
40
|
+
if (libraryGlobals.has(sourceVar)) {
|
|
41
|
+
// Extract the destructured component names
|
|
42
|
+
const componentNames = [];
|
|
43
|
+
for (const prop of path.node.id.properties) {
|
|
44
|
+
if (t.isObjectProperty(prop)) {
|
|
45
|
+
if (t.isIdentifier(prop.key)) {
|
|
46
|
+
componentNames.push(prop.key.name);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
violations.push({
|
|
51
|
+
rule: 'use-unwrap-components',
|
|
52
|
+
severity: 'critical',
|
|
53
|
+
line: path.node.loc?.start.line || 0,
|
|
54
|
+
column: path.node.loc?.start.column || 0,
|
|
55
|
+
message: `Direct destructuring from library "${sourceVar}" is not allowed. You MUST use unwrapComponents to access library components. Replace "const { ${componentNames.join(', ')} } = ${sourceVar};" with "const { ${componentNames.join(', ')} } = unwrapComponents(${sourceVar}, [${componentNames.map((n) => `'${n}'`).join(', ')}]);"`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Also check for MemberExpression destructuring like const { Button } = antd.Button
|
|
60
|
+
if (t.isObjectPattern(path.node.id) && t.isMemberExpression(path.node.init)) {
|
|
61
|
+
const memberExpr = path.node.init;
|
|
62
|
+
if (t.isIdentifier(memberExpr.object)) {
|
|
63
|
+
const objName = memberExpr.object.name;
|
|
64
|
+
if (libraryGlobals.has(objName)) {
|
|
65
|
+
violations.push({
|
|
66
|
+
rule: 'use-unwrap-components',
|
|
67
|
+
severity: 'critical',
|
|
68
|
+
line: path.node.loc?.start.line || 0,
|
|
69
|
+
column: path.node.loc?.start.column || 0,
|
|
70
|
+
message: `Direct destructuring from library member expression is not allowed. Use unwrapComponents to safely access library components. Example: Instead of "const { Something } = ${objName}.Something;", use "const { Something } = unwrapComponents(${objName}, ['Something']);"`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return violations;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
UseUnwrapComponentsRule = __decorate([
|
|
81
|
+
RegisterClass(BaseLintRule, 'use-unwrap-components')
|
|
82
|
+
], UseUnwrapComponentsRule);
|
|
83
|
+
export { UseUnwrapComponentsRule };
|
|
84
|
+
//# sourceMappingURL=use-unwrap-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-unwrap-components.js","sourceRoot":"","sources":["../../src/runtime-rules/use-unwrap-components.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;GAQG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,YAAY;IACvD,IAAI,IAAI,KAAK,OAAO,uBAAuB,CAAC,CAAC,CAAC;IAC9C,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,cAAsB,EAAE,aAA6B;QACrE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,0CAA0C;QAC1C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;QACzC,IAAI,aAAa,EAAE,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC1C,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;oBACvB,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;gBACzC,CAAC;YACH,CAAC;QACH,CAAC;QAED,QAAQ,CAAC,GAAG,EAAE;YACZ,kBAAkB,CAAC,IAAoC;gBACrD,sDAAsD;gBACtD,IAAI,CA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AAC;gBACH,CAAC;gBAED,oFAAoF;gBACpF,IAAI,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBAClC,IAAI,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;wBACtC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC;wBACvC,IAAI,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;4BAChC,UAAU,CAAC,IAAI,CAAC;gCACd,IAAI,EAAE,uBAAuB;gCAC7B,QAAQ,EAAE,UAAU;gCACpB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC;gCACpC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;gCACxC,OAAO,EAAE,4KAA4K,OAAO,6DAA6D,OAAO,oBAAoB;6BACrR,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IAClB,CAAC;CACJ,CAAA;AAlEY,uBAAuB;IADnC,aAAa,CAAC,YAAY,EAAE,uBAAuB,CAAC;GACxC,uBAAuB,CAkEnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rule: useeffect-unstable-dependencies
|
|
6
|
+
*
|
|
7
|
+
* Detects unstable dependencies in useEffect hooks that can cause infinite render loops.
|
|
8
|
+
* Two types of issues:
|
|
9
|
+
*
|
|
10
|
+
* 1. Object/function props (utilities, components, callbacks, styles, savedUserSettings)
|
|
11
|
+
* - Severity: high - May cause infinite loops if parent doesn't provide stable references
|
|
12
|
+
*
|
|
13
|
+
* 2. Parameters with object literal defaults (queryParameters = {})
|
|
14
|
+
* - Severity: critical - ALWAYS causes infinite loops (new object every render)
|
|
15
|
+
*
|
|
16
|
+
* Applies to: all components
|
|
17
|
+
*/
|
|
18
|
+
export declare class UseeffectUnstableDependenciesRule extends BaseLintRule {
|
|
19
|
+
get Name(): string;
|
|
20
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
21
|
+
Test(ast: t.File, componentName: string): Violation[];
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=useeffect-unstable-dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useeffect-unstable-dependencies.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/useeffect-unstable-dependencies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,qBACa,iCAAkC,SAAQ,YAAY;IACjE,IAAI,IAAI,WAAgD;IACxD,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE;CAuMtD"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { traverse } from '../lint-utils.js';
|
|
8
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import * as t from '@babel/types';
|
|
10
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: useeffect-unstable-dependencies
|
|
13
|
+
*
|
|
14
|
+
* Detects unstable dependencies in useEffect hooks that can cause infinite render loops.
|
|
15
|
+
* Two types of issues:
|
|
16
|
+
*
|
|
17
|
+
* 1. Object/function props (utilities, components, callbacks, styles, savedUserSettings)
|
|
18
|
+
* - Severity: high - May cause infinite loops if parent doesn't provide stable references
|
|
19
|
+
*
|
|
20
|
+
* 2. Parameters with object literal defaults (queryParameters = {})
|
|
21
|
+
* - Severity: critical - ALWAYS causes infinite loops (new object every render)
|
|
22
|
+
*
|
|
23
|
+
* Applies to: all components
|
|
24
|
+
*/
|
|
25
|
+
let UseeffectUnstableDependenciesRule = class UseeffectUnstableDependenciesRule extends BaseLintRule {
|
|
26
|
+
get Name() { return 'useeffect-unstable-dependencies'; }
|
|
27
|
+
get AppliesTo() { return 'all'; }
|
|
28
|
+
Test(ast, componentName) {
|
|
29
|
+
const violations = [];
|
|
30
|
+
// Known prop names that are always objects/functions and unstable
|
|
31
|
+
const unstablePropNames = new Set([
|
|
32
|
+
'utilities',
|
|
33
|
+
'components',
|
|
34
|
+
'callbacks',
|
|
35
|
+
'styles',
|
|
36
|
+
'savedUserSettings', // Can be unstable if not memoized by parent
|
|
37
|
+
]);
|
|
38
|
+
// Helper to find the component function and extract parameters with object defaults
|
|
39
|
+
const findComponentParams = (useEffectPath) => {
|
|
40
|
+
const paramsWithObjectDefaults = new Map();
|
|
41
|
+
let current = useEffectPath.parentPath;
|
|
42
|
+
while (current) {
|
|
43
|
+
// Look for FunctionDeclaration or ArrowFunctionExpression/FunctionExpression
|
|
44
|
+
if (t.isFunctionDeclaration(current.node) ||
|
|
45
|
+
t.isArrowFunctionExpression(current.node) ||
|
|
46
|
+
t.isFunctionExpression(current.node)) {
|
|
47
|
+
const func = current.node;
|
|
48
|
+
// Check if this looks like a component (starts with uppercase)
|
|
49
|
+
let isComponent = false;
|
|
50
|
+
if (t.isFunctionDeclaration(func) && func.id && /^[A-Z]/.test(func.id.name)) {
|
|
51
|
+
isComponent = true;
|
|
52
|
+
}
|
|
53
|
+
// For arrow functions, check the variable declarator name
|
|
54
|
+
if ((t.isArrowFunctionExpression(func) || t.isFunctionExpression(func)) && current.parentPath) {
|
|
55
|
+
const parent = current.parentPath.node;
|
|
56
|
+
if (t.isVariableDeclarator(parent) && t.isIdentifier(parent.id) && /^[A-Z]/.test(parent.id.name)) {
|
|
57
|
+
isComponent = true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (isComponent) {
|
|
61
|
+
// Extract parameters with object literal defaults
|
|
62
|
+
for (const param of func.params) {
|
|
63
|
+
// Case 1: ObjectPattern (destructured props): { foo = {}, bar = [] }
|
|
64
|
+
if (t.isObjectPattern(param)) {
|
|
65
|
+
for (const prop of param.properties) {
|
|
66
|
+
if (t.isObjectProperty(prop)) {
|
|
67
|
+
const value = prop.value;
|
|
68
|
+
// Check if this destructured property has a default: queryParameters = {}
|
|
69
|
+
if (t.isAssignmentPattern(value) && t.isIdentifier(value.left)) {
|
|
70
|
+
const defaultVal = value.right;
|
|
71
|
+
if (t.isObjectExpression(defaultVal) || t.isArrayExpression(defaultVal)) {
|
|
72
|
+
paramsWithObjectDefaults.set(value.left.name, defaultVal);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Case 2: AssignmentPattern (param with default): queryParameters = {}
|
|
79
|
+
else if (t.isAssignmentPattern(param)) {
|
|
80
|
+
const left = param.left;
|
|
81
|
+
const right = param.right;
|
|
82
|
+
// Simple param with object default: queryParameters = {}
|
|
83
|
+
if (t.isIdentifier(left) && (t.isObjectExpression(right) || t.isArrayExpression(right))) {
|
|
84
|
+
paramsWithObjectDefaults.set(left.name, right);
|
|
85
|
+
}
|
|
86
|
+
// ObjectPattern with object default: { foo, bar } = {}
|
|
87
|
+
else if (t.isObjectPattern(left) && (t.isObjectExpression(right) || t.isArrayExpression(right))) {
|
|
88
|
+
// The whole destructured object gets a default - mark all properties
|
|
89
|
+
for (const prop of left.properties) {
|
|
90
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) {
|
|
91
|
+
paramsWithObjectDefaults.set(prop.key.name, right);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
break; // Found the component, stop traversing up
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
current = current.parentPath;
|
|
101
|
+
}
|
|
102
|
+
return paramsWithObjectDefaults;
|
|
103
|
+
};
|
|
104
|
+
traverse(ast, {
|
|
105
|
+
CallExpression(path) {
|
|
106
|
+
// Check for useEffect calls
|
|
107
|
+
if (t.isIdentifier(path.node.callee) && path.node.callee.name === 'useEffect') {
|
|
108
|
+
// Get the dependency array (second argument)
|
|
109
|
+
const depsArg = path.node.arguments[1];
|
|
110
|
+
if (!depsArg || !t.isArrayExpression(depsArg)) {
|
|
111
|
+
return; // No deps array or empty deps []
|
|
112
|
+
}
|
|
113
|
+
// Find component parameters with object defaults
|
|
114
|
+
const paramsWithObjectDefaults = findComponentParams(path);
|
|
115
|
+
// Check each dependency
|
|
116
|
+
for (const dep of depsArg.elements) {
|
|
117
|
+
if (!dep)
|
|
118
|
+
continue;
|
|
119
|
+
let unstableDep = null;
|
|
120
|
+
let severity = 'high';
|
|
121
|
+
let message = '';
|
|
122
|
+
let suggestionText = '';
|
|
123
|
+
// Case 1: Member expression (utilities.rq.RunQuery, callbacks?.onSelect)
|
|
124
|
+
if (t.isMemberExpression(dep) || t.isOptionalMemberExpression(dep)) {
|
|
125
|
+
const memberExpr = dep;
|
|
126
|
+
// Get the root object (e.g., 'utilities' from 'utilities.rq.RunQuery')
|
|
127
|
+
let rootObj = memberExpr.object;
|
|
128
|
+
while ((t.isMemberExpression(rootObj) || t.isOptionalMemberExpression(rootObj)) && 'object' in rootObj) {
|
|
129
|
+
rootObj = rootObj.object;
|
|
130
|
+
}
|
|
131
|
+
if (t.isIdentifier(rootObj) && unstablePropNames.has(rootObj.name)) {
|
|
132
|
+
unstableDep = `${rootObj.name}.${t.isIdentifier(memberExpr.property) ? memberExpr.property.name : '...'}`;
|
|
133
|
+
severity = 'high';
|
|
134
|
+
message = `useEffect has unstable dependency '${unstableDep}' that may cause infinite render loops. Object/function references from props typically change on every render. This works if the parent provides stable references (via useMemo), but is fragile and should be avoided.`;
|
|
135
|
+
suggestionText = `Remove '${unstableDep}' from dependency array. These utilities/services are typically stable and don't need to be tracked.`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Case 2: Direct identifier (utilities, components, etc.)
|
|
139
|
+
else if (t.isIdentifier(dep)) {
|
|
140
|
+
// Check if it's a known unstable prop name
|
|
141
|
+
if (unstablePropNames.has(dep.name)) {
|
|
142
|
+
unstableDep = dep.name;
|
|
143
|
+
severity = 'high';
|
|
144
|
+
message = `useEffect has unstable dependency '${unstableDep}' that may cause infinite render loops. Object/function references from props typically change on every render. This works if the parent provides stable references (via useMemo), but is fragile and should be avoided.`;
|
|
145
|
+
suggestionText = `Remove '${unstableDep}' from dependency array. These utilities/services are typically stable and don't need to be tracked.`;
|
|
146
|
+
}
|
|
147
|
+
// Check if it's a param with object literal default
|
|
148
|
+
else if (paramsWithObjectDefaults.has(dep.name)) {
|
|
149
|
+
unstableDep = dep.name;
|
|
150
|
+
severity = 'critical';
|
|
151
|
+
const defaultValue = paramsWithObjectDefaults.get(dep.name);
|
|
152
|
+
const defaultStr = t.isObjectExpression(defaultValue) ? '{}' : '[]';
|
|
153
|
+
message = `useEffect has CRITICAL unstable dependency '${unstableDep}' with object literal default (${dep.name} = ${defaultStr}). This creates a NEW object on EVERY render, causing infinite loops. This is ALWAYS broken.`;
|
|
154
|
+
suggestionText = `Remove '${unstableDep}' from dependency array. Props with object literal defaults (${dep.name} = ${defaultStr}) create new references every render.`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Report violation if we found an unstable dependency
|
|
158
|
+
if (unstableDep) {
|
|
159
|
+
let fixedDeps = depsArg.elements
|
|
160
|
+
.filter((e) => e !== dep)
|
|
161
|
+
.map((e) => {
|
|
162
|
+
if (!e)
|
|
163
|
+
return '';
|
|
164
|
+
if (t.isIdentifier(e))
|
|
165
|
+
return e.name;
|
|
166
|
+
if (t.isMemberExpression(e) || t.isOptionalMemberExpression(e)) {
|
|
167
|
+
// Try to extract the full path
|
|
168
|
+
const parts = [];
|
|
169
|
+
let current = e;
|
|
170
|
+
while (t.isMemberExpression(current) || t.isOptionalMemberExpression(current)) {
|
|
171
|
+
if ('property' in current && t.isIdentifier(current.property)) {
|
|
172
|
+
parts.unshift(current.property.name);
|
|
173
|
+
}
|
|
174
|
+
if ('object' in current) {
|
|
175
|
+
current = current.object;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (t.isIdentifier(current)) {
|
|
182
|
+
parts.unshift(current.name);
|
|
183
|
+
}
|
|
184
|
+
return parts.join('.');
|
|
185
|
+
}
|
|
186
|
+
return '...';
|
|
187
|
+
})
|
|
188
|
+
.filter(Boolean);
|
|
189
|
+
violations.push({
|
|
190
|
+
rule: 'useeffect-unstable-dependencies',
|
|
191
|
+
severity: severity,
|
|
192
|
+
line: dep.loc?.start.line || path.node.loc?.start.line || 0,
|
|
193
|
+
column: dep.loc?.start.column || path.node.loc?.start.column || 0,
|
|
194
|
+
message: message,
|
|
195
|
+
code: `}, [${fixedDeps.join(', ')}${fixedDeps.length > 0 ? ', ' : ''}${unstableDep}]); // ${severity === 'critical' ? '🚨' : '⚠️'} Remove '${unstableDep}'`,
|
|
196
|
+
suggestion: {
|
|
197
|
+
text: suggestionText,
|
|
198
|
+
example: fixedDeps.length > 0
|
|
199
|
+
? `}, [${fixedDeps.join(', ')}]); // ✅ Removed unstable '${unstableDep}'`
|
|
200
|
+
: `}, []); // ✅ Run once on mount - dependencies are stable`
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
return violations;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
UseeffectUnstableDependenciesRule = __decorate([
|
|
212
|
+
RegisterClass(BaseLintRule, 'useeffect-unstable-dependencies')
|
|
213
|
+
], UseeffectUnstableDependenciesRule);
|
|
214
|
+
export { UseeffectUnstableDependenciesRule };
|
|
215
|
+
//# sourceMappingURL=useeffect-unstable-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useeffect-unstable-dependencies.js","sourceRoot":"","sources":["../../src/runtime-rules/useeffect-unstable-dependencies.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C;;;;;;;;;;;;;GAaG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,YAAY;IACjE,IAAI,IAAI,KAAK,OAAO,iCAAiC,CAAC,CAAC,CAAC;IACxD,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB;QACrC,M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3D,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;gCACjE,OAAO,EAAE,OAAO;gCAChB,IAAI,EAAE,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,WAAW,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,YAAY,WAAW,GAAG;gCAC5J,UAAU,EAAE;oCACV,IAAI,EAAE,cAAc;oCACpB,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC;wCAC3B,CAAC,CAAC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,WAAW,GAAG;wCAC1E,CAAC,CAAC,2DAA2D;iCAChE;6BACF,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AA3MY,iCAAiC;IAD7C,aAAa,CAAC,YAAY,EAAE,iCAAiC,CAAC;GAClD,iCAAiC,CA2M7C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rule: utilities-api-validation
|
|
6
|
+
*
|
|
7
|
+
* Validates that components only access valid properties and methods
|
|
8
|
+
* on the utilities object (rv, rq, md, ai) and their sub-objects.
|
|
9
|
+
*
|
|
10
|
+
* Valid API surface:
|
|
11
|
+
* - utilities.rv: RunView(), RunViews()
|
|
12
|
+
* - utilities.rq: RunQuery()
|
|
13
|
+
* - utilities.md: GetEntityObject(), Entities
|
|
14
|
+
* - utilities.ai: ExecutePrompt(), EmbedText(), VectorService
|
|
15
|
+
*
|
|
16
|
+
* Severity: critical
|
|
17
|
+
* Applies to: all components
|
|
18
|
+
*/
|
|
19
|
+
export declare class UtilitiesApiValidationRule extends BaseLintRule {
|
|
20
|
+
get Name(): string;
|
|
21
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
22
|
+
Test(ast: t.File): Violation[];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=utilities-api-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities-api-validation.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/utilities-api-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,qBACa,0BAA2B,SAAQ,YAAY;IAC1D,IAAI,IAAI,WAAyC;IACjD,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,EAAE;CAsG/B"}
|