@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,92 @@
|
|
|
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 * as t from '@babel/types';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: component-not-in-dependencies
|
|
13
|
+
*
|
|
14
|
+
* Ensures that all components accessed via components.X are defined in the
|
|
15
|
+
* component spec's dependencies array. Using undefined components will cause
|
|
16
|
+
* runtime errors.
|
|
17
|
+
*
|
|
18
|
+
* Severity: critical (causes runtime errors)
|
|
19
|
+
* Applies to: all components
|
|
20
|
+
*/
|
|
21
|
+
let ComponentNotInDependenciesRule = class ComponentNotInDependenciesRule extends BaseLintRule {
|
|
22
|
+
get Name() { return 'component-not-in-dependencies'; }
|
|
23
|
+
get AppliesTo() { return 'all'; }
|
|
24
|
+
Test(ast, componentName, componentSpec) {
|
|
25
|
+
const violations = [];
|
|
26
|
+
// Get the list of available component names from dependencies
|
|
27
|
+
const availableComponents = new Set();
|
|
28
|
+
if (componentSpec?.dependencies) {
|
|
29
|
+
for (const dep of componentSpec.dependencies) {
|
|
30
|
+
if (dep.name) {
|
|
31
|
+
availableComponents.add(dep.name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
traverse(ast, {
|
|
36
|
+
// Check for components.X usage in JSX
|
|
37
|
+
JSXElement(path) {
|
|
38
|
+
const openingElement = path.node.openingElement;
|
|
39
|
+
// Check for components.X pattern (e.g., <components.Loading>)
|
|
40
|
+
if (t.isJSXMemberExpression(openingElement.name)) {
|
|
41
|
+
if (t.isJSXIdentifier(openingElement.name.object) &&
|
|
42
|
+
openingElement.name.object.name === 'components' &&
|
|
43
|
+
t.isJSXIdentifier(openingElement.name.property)) {
|
|
44
|
+
const compName = openingElement.name.property.name;
|
|
45
|
+
// Check if this component is NOT in the dependencies
|
|
46
|
+
if (!availableComponents.has(compName)) {
|
|
47
|
+
violations.push({
|
|
48
|
+
rule: 'component-not-in-dependencies',
|
|
49
|
+
severity: 'critical',
|
|
50
|
+
line: openingElement.loc?.start.line || 0,
|
|
51
|
+
column: openingElement.loc?.start.column || 0,
|
|
52
|
+
message: `Component "${compName}" is used via components.${compName} but is not defined in the component spec's dependencies array. This will cause a runtime error.`,
|
|
53
|
+
code: `<components.${compName}>`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
// Also check for components.X usage in JavaScript expressions
|
|
60
|
+
MemberExpression(path) {
|
|
61
|
+
if (t.isIdentifier(path.node.object) && path.node.object.name === 'components' && t.isIdentifier(path.node.property)) {
|
|
62
|
+
const compName = path.node.property.name;
|
|
63
|
+
// Skip if this is a method call like components.hasOwnProperty
|
|
64
|
+
const parent = path.parent;
|
|
65
|
+
if (t.isCallExpression(parent) && parent.callee === path.node) {
|
|
66
|
+
// Check if it looks like a component (starts with uppercase)
|
|
67
|
+
if (!/^[A-Z]/.test(compName)) {
|
|
68
|
+
return; // Skip built-in methods
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Check if this component is NOT in the dependencies
|
|
72
|
+
if (/^[A-Z]/.test(compName) && !availableComponents.has(compName)) {
|
|
73
|
+
violations.push({
|
|
74
|
+
rule: 'component-not-in-dependencies',
|
|
75
|
+
severity: 'critical',
|
|
76
|
+
line: path.node.loc?.start.line || 0,
|
|
77
|
+
column: path.node.loc?.start.column || 0,
|
|
78
|
+
message: `Component "${compName}" is accessed via components.${compName} but is not defined in the component spec's dependencies array. This will cause a runtime error.`,
|
|
79
|
+
code: `components.${compName}`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
return violations;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
ComponentNotInDependenciesRule = __decorate([
|
|
89
|
+
RegisterClass(BaseLintRule, 'component-not-in-dependencies')
|
|
90
|
+
], ComponentNotInDependenciesRule);
|
|
91
|
+
export { ComponentNotInDependenciesRule };
|
|
92
|
+
//# sourceMappingURL=component-not-in-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-not-in-dependencies.js","sourceRoot":"","sources":["../../src/runtime-rules/component-not-in-dependencies.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;;GASG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,YAAY;IAC9D,IAAI,IAAI,KAAK,OAAO,+BAA+B,CAAC,CAAC,CAAC;IACtD,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB,EAAE,aAA6B;QACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,8DAA8D;QAC9D,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;QAC9C,IAAI,aAAa,EAAE,YAAY,EAAE,CAAC;YAChC,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,YAAY,EAAE,CAAC;gBAC7C,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;oBACb,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACpC,CAAC;YACH,CAA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../component-linter.js';
|
|
4
|
+
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
5
|
+
import type { LinterOptions } from '../linter-options.js';
|
|
6
|
+
/**
|
|
7
|
+
* Rule: component-props-validation
|
|
8
|
+
*
|
|
9
|
+
* Validates that components only accept declared props from:
|
|
10
|
+
* - Standard props (utilities, styles, components, callbacks, savedUserSettings, onSaveUserSettings)
|
|
11
|
+
* - React special props (children)
|
|
12
|
+
* - Spec-defined properties
|
|
13
|
+
* - Spec-defined events (with 'on' prefix convention)
|
|
14
|
+
*
|
|
15
|
+
* Also checks that required props are present.
|
|
16
|
+
*
|
|
17
|
+
* Severity: critical
|
|
18
|
+
* Applies to: all components
|
|
19
|
+
*/
|
|
20
|
+
export declare class ComponentPropsValidationRule extends BaseLintRule {
|
|
21
|
+
get Name(): string;
|
|
22
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
23
|
+
Test(ast: t.File, componentName: string, componentSpec?: ComponentSpec, _options?: LinterOptions): Violation[];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=component-props-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-props-validation.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/component-props-validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,qBACa,4BAA6B,SAAQ,YAAY;IAC5D,IAAI,IAAI,WAA2C;IACnD,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE;CAgN/G"}
|
|
@@ -0,0 +1,228 @@
|
|
|
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 * as t from '@babel/types';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: component-props-validation
|
|
13
|
+
*
|
|
14
|
+
* Validates that components only accept declared props from:
|
|
15
|
+
* - Standard props (utilities, styles, components, callbacks, savedUserSettings, onSaveUserSettings)
|
|
16
|
+
* - React special props (children)
|
|
17
|
+
* - Spec-defined properties
|
|
18
|
+
* - Spec-defined events (with 'on' prefix convention)
|
|
19
|
+
*
|
|
20
|
+
* Also checks that required props are present.
|
|
21
|
+
*
|
|
22
|
+
* Severity: critical
|
|
23
|
+
* Applies to: all components
|
|
24
|
+
*/
|
|
25
|
+
let ComponentPropsValidationRule = class ComponentPropsValidationRule extends BaseLintRule {
|
|
26
|
+
get Name() { return 'component-props-validation'; }
|
|
27
|
+
get AppliesTo() { return 'all'; }
|
|
28
|
+
Test(ast, componentName, componentSpec, _options) {
|
|
29
|
+
const violations = [];
|
|
30
|
+
const standardProps = new Set(['utilities', 'styles', 'components', 'callbacks', 'savedUserSettings', 'onSaveUserSettings']);
|
|
31
|
+
// React special props that are automatically provided by React
|
|
32
|
+
const reactSpecialProps = new Set(['children']);
|
|
33
|
+
// Build set of allowed props: standard props + React special props + componentSpec properties + events
|
|
34
|
+
const allowedProps = new Set([...standardProps, ...reactSpecialProps]);
|
|
35
|
+
// Track required props separately for validation
|
|
36
|
+
const requiredProps = new Set();
|
|
37
|
+
// Add props from componentSpec.properties if they exist
|
|
38
|
+
const specDefinedProps = [];
|
|
39
|
+
if (componentSpec?.properties) {
|
|
40
|
+
for (const prop of componentSpec.properties) {
|
|
41
|
+
if (prop.name) {
|
|
42
|
+
allowedProps.add(prop.name);
|
|
43
|
+
specDefinedProps.push(prop.name);
|
|
44
|
+
if (prop.required) {
|
|
45
|
+
requiredProps.add(prop.name);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Add events from componentSpec.events if they exist
|
|
51
|
+
const specDefinedEvents = [];
|
|
52
|
+
if (componentSpec?.events) {
|
|
53
|
+
for (const event of componentSpec.events) {
|
|
54
|
+
if (event.name) {
|
|
55
|
+
const onPrefixedName = 'on' + event.name.charAt(0).toUpperCase() + event.name.slice(1);
|
|
56
|
+
allowedProps.add(event.name);
|
|
57
|
+
allowedProps.add(onPrefixedName);
|
|
58
|
+
specDefinedEvents.push(onPrefixedName);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validate destructured props from a parameter pattern.
|
|
64
|
+
*/
|
|
65
|
+
const validateProps = (param, line, column) => {
|
|
66
|
+
const invalidProps = [];
|
|
67
|
+
const allProps = [];
|
|
68
|
+
for (const prop of param.properties) {
|
|
69
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) {
|
|
70
|
+
const propName = prop.key.name;
|
|
71
|
+
allProps.push(propName);
|
|
72
|
+
if (!allowedProps.has(propName)) {
|
|
73
|
+
invalidProps.push(propName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Check for missing required props
|
|
78
|
+
const missingRequired = Array.from(requiredProps).filter((prop) => !allProps.includes(prop) && !standardProps.has(prop));
|
|
79
|
+
// Report missing required props
|
|
80
|
+
if (missingRequired.length > 0) {
|
|
81
|
+
violations.push({
|
|
82
|
+
rule: 'component-props-validation',
|
|
83
|
+
severity: 'critical',
|
|
84
|
+
line,
|
|
85
|
+
column,
|
|
86
|
+
message: `Component "${componentName}" is missing required props: ${missingRequired.join(', ')}. These props are marked as required in the component specification.`,
|
|
87
|
+
suggestion: {
|
|
88
|
+
text: 'Components can only accept standard props and props explicitly defined in the component spec. The spec is provided by the architect and cannot be modified - your code must match the spec exactly.',
|
|
89
|
+
example: `// ❌ WRONG - Component with undeclared props:
|
|
90
|
+
function MyComponent({ utilities, styles, components, customers, orders, selectedId }) {
|
|
91
|
+
// ERROR: customers, orders, selectedId are NOT in the spec
|
|
92
|
+
// The spec defines what props are allowed - you cannot add new ones
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ✅ CORRECT - Use only standard props and props defined in the spec:
|
|
96
|
+
function MyComponent({ utilities, styles, components, callbacks, savedUserSettings, onSaveUserSettings }) {
|
|
97
|
+
// If you need data like customers/orders, load it internally using utilities
|
|
98
|
+
const [customers, setCustomers] = useState([]);
|
|
99
|
+
const [orders, setOrders] = useState([]);
|
|
100
|
+
const [selectedId, setSelectedId] = useState(savedUserSettings?.selectedId);
|
|
101
|
+
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const loadData = async () => {
|
|
104
|
+
try {
|
|
105
|
+
// Load customers data internally
|
|
106
|
+
const result = await utilities.rv.RunView({
|
|
107
|
+
EntityName: 'Customers',
|
|
108
|
+
Fields: ['ID', 'Name', 'Status']
|
|
109
|
+
});
|
|
110
|
+
if (result?.Success) {
|
|
111
|
+
setCustomers(result.Results);
|
|
112
|
+
}
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.error('Failed to load data:', error);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
loadData();
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
return <div>{/* Use state variables, not props */}</div>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// NOTE: If the spec DOES define additional props (e.g., customers, orders),
|
|
124
|
+
// then you MUST accept and use them. Check the spec's properties array
|
|
125
|
+
// to see what props are required/optional beyond the standard ones.`,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Only report if there are non-allowed props
|
|
130
|
+
if (invalidProps.length > 0) {
|
|
131
|
+
let message;
|
|
132
|
+
if (specDefinedProps.length > 0 || specDefinedEvents.length > 0) {
|
|
133
|
+
message =
|
|
134
|
+
`Component "${componentName}" accepts undeclared props: ${invalidProps.join(', ')}. ` +
|
|
135
|
+
`This component can only accept: ` +
|
|
136
|
+
`(1) Standard props: ${Array.from(standardProps).join(', ')}, ` +
|
|
137
|
+
(specDefinedProps.length > 0 ? `(2) Spec-defined props: ${specDefinedProps.join(', ')}, ` : '') +
|
|
138
|
+
(specDefinedEvents.length > 0 ? `(3) Spec-defined events: ${specDefinedEvents.join(', ')}, ` : '') +
|
|
139
|
+
`(4) React props: ${Array.from(reactSpecialProps).join(', ')}. ` +
|
|
140
|
+
`Any additional props must be defined in the component spec's properties or events array.`;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
message =
|
|
144
|
+
`Component "${componentName}" accepts undeclared props: ${invalidProps.join(', ')}. ` +
|
|
145
|
+
`This component can only accept: ` +
|
|
146
|
+
`(1) Standard props: ${Array.from(standardProps).join(', ')}, ` +
|
|
147
|
+
`(2) React props: ${Array.from(reactSpecialProps).join(', ')}. ` +
|
|
148
|
+
`To accept additional props, they must be defined in the component spec's properties or events array.`;
|
|
149
|
+
}
|
|
150
|
+
violations.push({
|
|
151
|
+
rule: 'component-props-validation',
|
|
152
|
+
severity: 'critical',
|
|
153
|
+
line,
|
|
154
|
+
column,
|
|
155
|
+
message,
|
|
156
|
+
suggestion: {
|
|
157
|
+
text: 'Components can only accept standard props and props explicitly defined in the component spec. The spec is provided by the architect and cannot be modified - your code must match the spec exactly.',
|
|
158
|
+
example: `// ❌ WRONG - Component with undeclared props:
|
|
159
|
+
function MyComponent({ utilities, styles, components, customers, orders, selectedId }) {
|
|
160
|
+
// ERROR: customers, orders, selectedId are NOT in the spec
|
|
161
|
+
// The spec defines what props are allowed - you cannot add new ones
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ✅ CORRECT - Use only standard props and props defined in the spec:
|
|
165
|
+
function MyComponent({ utilities, styles, components, callbacks, savedUserSettings, onSaveUserSettings }) {
|
|
166
|
+
// If you need data like customers/orders, load it internally using utilities
|
|
167
|
+
const [customers, setCustomers] = useState([]);
|
|
168
|
+
const [orders, setOrders] = useState([]);
|
|
169
|
+
const [selectedId, setSelectedId] = useState(savedUserSettings?.selectedId);
|
|
170
|
+
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
const loadData = async () => {
|
|
173
|
+
try {
|
|
174
|
+
// Load customers data internally
|
|
175
|
+
const result = await utilities.rv.RunView({
|
|
176
|
+
EntityName: 'Customers',
|
|
177
|
+
Fields: ['ID', 'Name', 'Status']
|
|
178
|
+
});
|
|
179
|
+
if (result?.Success) {
|
|
180
|
+
setCustomers(result.Results);
|
|
181
|
+
}
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.error('Failed to load data:', error);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
loadData();
|
|
187
|
+
}, []);
|
|
188
|
+
|
|
189
|
+
return <div>{/* Use state variables, not props */}</div>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// NOTE: If the spec DOES define additional props (e.g., customers, orders),
|
|
193
|
+
// then you MUST accept and use them. Check the spec's properties array
|
|
194
|
+
// to see what props are required/optional beyond the standard ones.`,
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
traverse(ast, {
|
|
200
|
+
FunctionDeclaration(path) {
|
|
201
|
+
if (path.node.id && path.node.id.name === componentName && path.node.params[0]) {
|
|
202
|
+
const param = path.node.params[0];
|
|
203
|
+
if (t.isObjectPattern(param)) {
|
|
204
|
+
validateProps(param, path.node.loc?.start.line || 0, path.node.loc?.start.column || 0);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
// Also check arrow function components
|
|
209
|
+
VariableDeclarator(path) {
|
|
210
|
+
if (t.isIdentifier(path.node.id) && path.node.id.name === componentName) {
|
|
211
|
+
const init = path.node.init;
|
|
212
|
+
if (t.isArrowFunctionExpression(init) && init.params[0]) {
|
|
213
|
+
const param = init.params[0];
|
|
214
|
+
if (t.isObjectPattern(param)) {
|
|
215
|
+
validateProps(param, init.loc?.start.line || 0, init.loc?.start.column || 0);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
return violations;
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
ComponentPropsValidationRule = __decorate([
|
|
225
|
+
RegisterClass(BaseLintRule, 'component-props-validation')
|
|
226
|
+
], ComponentPropsValidationRule);
|
|
227
|
+
export { ComponentPropsValidationRule };
|
|
228
|
+
//# sourceMappingURL=component-props-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-props-validation.js","sourceRoot":"","sources":["../../src/runtime-rules/component-props-validation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAK5C;;;;;;;;;;;;;GAaG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,YAAY;IAC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CAAuC;YACvC,kBAAkB,CAAC,IAAoC;gBACrD,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;oBAC5B,IAAI,CAAC,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;wBACxD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;wBAC7B,IAAI,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;4BAC7B,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;wBAC/E,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AApNY,4BAA4B;IADxC,aAAa,CAAC,YAAY,EAAE,4BAA4B,CAAC;GAC7C,4BAA4B,CAoNxC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
5
|
+
/**
|
|
6
|
+
* Rule: component-usage-without-destructuring
|
|
7
|
+
*
|
|
8
|
+
* Detects when a component dependency is used directly in JSX without first
|
|
9
|
+
* being destructured from the components prop. Components must either be
|
|
10
|
+
* destructured or accessed via components.Name syntax.
|
|
11
|
+
*
|
|
12
|
+
* Severity: critical
|
|
13
|
+
* Applies to: all components
|
|
14
|
+
*/
|
|
15
|
+
export declare class ComponentUsageWithoutDestructuringRule extends BaseLintRule {
|
|
16
|
+
get Name(): string;
|
|
17
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
18
|
+
Test(ast: t.File, componentName: string, componentSpec?: ComponentSpec): Violation[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=component-usage-without-destructuring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-usage-without-destructuring.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/component-usage-without-destructuring.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5E;;;;;;;;;GASG;AACH,qBACa,sCAAuC,SAAQ,YAAY;IACtE,IAAI,IAAI,WAAsD;IAC9D,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,EAAE;CAwGrF"}
|
|
@@ -0,0 +1,124 @@
|
|
|
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 * as t from '@babel/types';
|
|
9
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
10
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: component-usage-without-destructuring
|
|
13
|
+
*
|
|
14
|
+
* Detects when a component dependency is used directly in JSX without first
|
|
15
|
+
* being destructured from the components prop. Components must either be
|
|
16
|
+
* destructured or accessed via components.Name syntax.
|
|
17
|
+
*
|
|
18
|
+
* Severity: critical
|
|
19
|
+
* Applies to: all components
|
|
20
|
+
*/
|
|
21
|
+
let ComponentUsageWithoutDestructuringRule = class ComponentUsageWithoutDestructuringRule extends BaseLintRule {
|
|
22
|
+
get Name() { return 'component-usage-without-destructuring'; }
|
|
23
|
+
get AppliesTo() { return 'all'; }
|
|
24
|
+
Test(ast, componentName, componentSpec) {
|
|
25
|
+
const violations = [];
|
|
26
|
+
// Skip if no dependencies
|
|
27
|
+
if (!componentSpec?.dependencies || componentSpec.dependencies.length === 0) {
|
|
28
|
+
return violations;
|
|
29
|
+
}
|
|
30
|
+
// Track dependency names
|
|
31
|
+
const dependencyNames = new Set(componentSpec.dependencies.map((d) => d.name).filter(Boolean));
|
|
32
|
+
// Track what's been destructured from components prop
|
|
33
|
+
const destructuredComponents = new Set();
|
|
34
|
+
traverse(ast, {
|
|
35
|
+
// Track destructuring from components
|
|
36
|
+
VariableDeclarator(path) {
|
|
37
|
+
if (t.isObjectPattern(path.node.id) && t.isIdentifier(path.node.init)) {
|
|
38
|
+
// Check if destructuring from 'components'
|
|
39
|
+
if (path.node.init.name === 'components') {
|
|
40
|
+
for (const prop of path.node.id.properties) {
|
|
41
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key)) {
|
|
42
|
+
const name = prop.key.name;
|
|
43
|
+
if (dependencyNames.has(name)) {
|
|
44
|
+
destructuredComponents.add(name);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
// Also check function parameter destructuring
|
|
52
|
+
FunctionDeclaration(path) {
|
|
53
|
+
if (path.node.id && path.node.id.name === componentName && path.node.params[0]) {
|
|
54
|
+
const param = path.node.params[0];
|
|
55
|
+
if (t.isObjectPattern(param)) {
|
|
56
|
+
for (const prop of param.properties) {
|
|
57
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'components') {
|
|
58
|
+
// Check for nested destructuring like { components: { A, B } }
|
|
59
|
+
if (t.isObjectPattern(prop.value)) {
|
|
60
|
+
for (const innerProp of prop.value.properties) {
|
|
61
|
+
if (t.isObjectProperty(innerProp) && t.isIdentifier(innerProp.key)) {
|
|
62
|
+
const name = innerProp.key.name;
|
|
63
|
+
if (dependencyNames.has(name)) {
|
|
64
|
+
destructuredComponents.add(name);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// Check JSX usage
|
|
75
|
+
JSXElement(path) {
|
|
76
|
+
const openingElement = path.node.openingElement;
|
|
77
|
+
// Check for direct component usage (e.g., <ComponentName>)
|
|
78
|
+
if (t.isJSXIdentifier(openingElement.name)) {
|
|
79
|
+
const name = openingElement.name.name;
|
|
80
|
+
// Check if this is one of our dependencies being used directly
|
|
81
|
+
if (dependencyNames.has(name) && !destructuredComponents.has(name)) {
|
|
82
|
+
violations.push({
|
|
83
|
+
rule: 'component-usage-without-destructuring',
|
|
84
|
+
severity: 'critical',
|
|
85
|
+
line: openingElement.loc?.start.line || 0,
|
|
86
|
+
column: openingElement.loc?.start.column || 0,
|
|
87
|
+
message: `Component "${name}" used without destructuring. Either destructure it from components prop (const { ${name} } = components;) or use <components.${name} />`,
|
|
88
|
+
code: `<${name}>`,
|
|
89
|
+
suggestion: {
|
|
90
|
+
text: 'Components must be properly accessed - either destructure from components prop or use dot notation',
|
|
91
|
+
example: `// ❌ WRONG - Using component without destructuring:
|
|
92
|
+
function MyComponent({ components }) {
|
|
93
|
+
return <AccountList />; // Error: AccountList not destructured
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ✅ CORRECT - Option 1: Destructure from components
|
|
97
|
+
function MyComponent({ components }) {
|
|
98
|
+
const { AccountList } = components;
|
|
99
|
+
return <AccountList />;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ✅ CORRECT - Option 2: Use dot notation
|
|
103
|
+
function MyComponent({ components }) {
|
|
104
|
+
return <components.AccountList />;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ✅ CORRECT - Option 3: Destructure in function parameters
|
|
108
|
+
function MyComponent({ components: { AccountList } }) {
|
|
109
|
+
return <AccountList />;
|
|
110
|
+
}`,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
return violations;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
ComponentUsageWithoutDestructuringRule = __decorate([
|
|
121
|
+
RegisterClass(BaseLintRule, 'component-usage-without-destructuring')
|
|
122
|
+
], ComponentUsageWithoutDestructuringRule);
|
|
123
|
+
export { ComponentUsageWithoutDestructuringRule };
|
|
124
|
+
//# sourceMappingURL=component-usage-without-destructuring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-usage-without-destructuring.js","sourceRoot":"","sources":["../../src/runtime-rules/component-usage-without-destructuring.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAI5C;;;;;;;;;G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'../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
export declare class DataResultValidationRule extends BaseLintRule {
|
|
5
|
+
get Name(): string;
|
|
6
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
7
|
+
Test(ast: t.File): Violation[];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=data-result-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-result-validation.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/data-result-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;AAkXhD,qBACa,wBAAyB,SAAQ,YAAY;IACxD,IAAI,IAAI,WAAuC;IAC/C,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,EAAE;CA6d/B"}
|