@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,88 @@
|
|
|
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: library-variable-names
|
|
13
|
+
*
|
|
14
|
+
* Ensures correct usage of library global variables. Libraries must be accessed
|
|
15
|
+
* using unwrapComponents with the correct global variable name as specified in
|
|
16
|
+
* the component spec.
|
|
17
|
+
*
|
|
18
|
+
* Prevents:
|
|
19
|
+
* - Using incorrect library global variable names
|
|
20
|
+
* - Self-assignment of library globals (const chroma = chroma)
|
|
21
|
+
*
|
|
22
|
+
* Severity: critical
|
|
23
|
+
* Applies to: all components
|
|
24
|
+
*/
|
|
25
|
+
let LibraryVariableNamesRule = class LibraryVariableNamesRule extends BaseLintRule {
|
|
26
|
+
get Name() { return 'library-variable-names'; }
|
|
27
|
+
get AppliesTo() { return 'all'; }
|
|
28
|
+
Test(ast, _componentName, componentSpec) {
|
|
29
|
+
const violations = [];
|
|
30
|
+
// Build a map of library names to their globalVariables
|
|
31
|
+
const libraryGlobals = new Map();
|
|
32
|
+
if (componentSpec?.libraries) {
|
|
33
|
+
for (const lib of componentSpec.libraries) {
|
|
34
|
+
// Skip empty library objects or those without required fields
|
|
35
|
+
if (lib.name && lib.globalVariable) {
|
|
36
|
+
// Store both the exact name and lowercase for comparison
|
|
37
|
+
libraryGlobals.set(lib.name.toLowerCase(), lib.globalVariable);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
traverse(ast, {
|
|
42
|
+
VariableDeclarator(path) {
|
|
43
|
+
// Check for destructuring from a variable (library global)
|
|
44
|
+
if (t.isObjectPattern(path.node.id) && t.isIdentifier(path.node.init)) {
|
|
45
|
+
const sourceVar = path.node.init.name;
|
|
46
|
+
// Check if this looks like a library name (case-insensitive match)
|
|
47
|
+
const matchedLib = Array.from(libraryGlobals.entries()).find(([libName, globalVar]) => sourceVar.toLowerCase() === libName || sourceVar.toLowerCase() === globalVar.toLowerCase());
|
|
48
|
+
if (matchedLib) {
|
|
49
|
+
const [, correctGlobal] = matchedLib;
|
|
50
|
+
if (sourceVar !== correctGlobal) {
|
|
51
|
+
violations.push({
|
|
52
|
+
rule: 'library-variable-names',
|
|
53
|
+
severity: 'critical',
|
|
54
|
+
line: path.node.loc?.start.line || 0,
|
|
55
|
+
column: path.node.loc?.start.column || 0,
|
|
56
|
+
message: `Incorrect library global variable "${sourceVar}". Use unwrapComponents with the correct global: "const { ... } = unwrapComponents(${correctGlobal}, [...]);"`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Check for self-assignment (const chroma = chroma)
|
|
62
|
+
if (t.isIdentifier(path.node.id) && t.isIdentifier(path.node.init)) {
|
|
63
|
+
const idName = path.node.id.name;
|
|
64
|
+
const initName = path.node.init.name;
|
|
65
|
+
if (idName === initName) {
|
|
66
|
+
// Check if this is a library global
|
|
67
|
+
const isLibraryGlobal = Array.from(libraryGlobals.values()).some((global) => global === idName);
|
|
68
|
+
if (isLibraryGlobal) {
|
|
69
|
+
violations.push({
|
|
70
|
+
rule: 'library-variable-names',
|
|
71
|
+
severity: 'critical',
|
|
72
|
+
line: path.node.loc?.start.line || 0,
|
|
73
|
+
column: path.node.loc?.start.column || 0,
|
|
74
|
+
message: `Self-assignment of library global "${idName}". This variable is already available as a global from the library. Remove this line entirely - the library global is already accessible.`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
return violations;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
LibraryVariableNamesRule = __decorate([
|
|
85
|
+
RegisterClass(BaseLintRule, 'library-variable-names')
|
|
86
|
+
], LibraryVariableNamesRule);
|
|
87
|
+
export { LibraryVariableNamesRule };
|
|
88
|
+
//# sourceMappingURL=library-variable-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-variable-names.js","sourceRoot":"","sources":["../../src/runtime-rules/library-variable-names.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;;;;;;;;;;;;;GAaG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,YAAY;IACxD,IAAI,IAAI,KAAK,OAAO,wBAAwB,CAAC,CAAC,CAAC;IAC/C,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,cAAsB,EAAE,aAA6B;QACrE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,wDAAwD;QACxD,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;QACjD,IAAI,aAAa,EAAE,SAAS,EAAE,CAAC;YAC7B,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;gBAC1C,8DAA8D;gBAC9D,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;oBACnC,yDAAyD;oBACzD,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;g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AC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;oBACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oBAErC,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;wBACxB,oCAAoC;wBACpC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;wBAEhG,IAAI,eAAe,EAAE,CAAC;4BACpB,UAAU,CAAC,IAAI,CAAC;gCACd,IAAI,EAAE,wBAAwB;gCAC9B,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,sCAAsC,MAAM,2IAA2I;6BACjM,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AArEY,wBAAwB;IADpC,aAAa,CAAC,YAAY,EAAE,wBAAwB,CAAC;GACzC,wBAAwB,CAqEpC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rule: no-child-implementation
|
|
6
|
+
*
|
|
7
|
+
* Ensures that root component files do not contain child component implementations.
|
|
8
|
+
* Root components should only reference child components, not implement them.
|
|
9
|
+
*
|
|
10
|
+
* Severity: critical
|
|
11
|
+
* Applies to: root components only
|
|
12
|
+
*/
|
|
13
|
+
export declare class NoChildImplementationRule extends BaseLintRule {
|
|
14
|
+
get Name(): string;
|
|
15
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
16
|
+
Test(ast: t.File, componentName: string): Violation[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=no-child-implementation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-child-implementation.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/no-child-implementation.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;AAEhD;;;;;;;;GAQG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IACzD,IAAI,IAAI,WAAwC;IAChD,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAmB;IAE5D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE;CAkCtD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { BaseLintRule } from '../lint-rule.js';
|
|
10
|
+
/**
|
|
11
|
+
* Rule: no-child-implementation
|
|
12
|
+
*
|
|
13
|
+
* Ensures that root component files do not contain child component implementations.
|
|
14
|
+
* Root components should only reference child components, not implement them.
|
|
15
|
+
*
|
|
16
|
+
* Severity: critical
|
|
17
|
+
* Applies to: root components only
|
|
18
|
+
*/
|
|
19
|
+
let NoChildImplementationRule = class NoChildImplementationRule extends BaseLintRule {
|
|
20
|
+
get Name() { return 'no-child-implementation'; }
|
|
21
|
+
get AppliesTo() { return 'root'; }
|
|
22
|
+
Test(ast, componentName) {
|
|
23
|
+
const violations = [];
|
|
24
|
+
const rootFunctionName = componentName;
|
|
25
|
+
const declaredFunctions = [];
|
|
26
|
+
// First pass: collect all function declarations
|
|
27
|
+
traverse(ast, {
|
|
28
|
+
FunctionDeclaration(path) {
|
|
29
|
+
if (path.node.id) {
|
|
30
|
+
declaredFunctions.push(path.node.id.name);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
// If there are multiple function declarations and they look like components
|
|
35
|
+
// (start with capital letter), it's likely implementing children
|
|
36
|
+
const componentFunctions = declaredFunctions.filter((name) => name !== rootFunctionName && /^[A-Z]/.test(name));
|
|
37
|
+
if (componentFunctions.length > 0) {
|
|
38
|
+
violations.push({
|
|
39
|
+
rule: 'no-child-implementation',
|
|
40
|
+
severity: 'critical',
|
|
41
|
+
line: 1,
|
|
42
|
+
column: 0,
|
|
43
|
+
message: `Root component file contains child component implementations: ${componentFunctions.join(', ')}. Root should only reference child components, not implement them.`,
|
|
44
|
+
suggestion: {
|
|
45
|
+
text: 'Remove child component implementations. Only the root component function should be in this file',
|
|
46
|
+
example: 'Move child component functions to separate generation requests',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return violations;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
NoChildImplementationRule = __decorate([
|
|
54
|
+
RegisterClass(BaseLintRule, 'no-child-implementation')
|
|
55
|
+
], NoChildImplementationRule);
|
|
56
|
+
export { NoChildImplementationRule };
|
|
57
|
+
//# sourceMappingURL=no-child-implementation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-child-implementation.js","sourceRoot":"","sources":["../../src/runtime-rules/no-child-implementation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C;;;;;;;;GAQG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,YAAY;IACzD,IAAI,IAAI,KAAK,OAAO,yBAAyB,CAAC,CAAC,CAAC;IAChD,IAAI,SAAS,KAA+B,OAAO,MAAM,CAAC,CAAC,CAAC;IAE5D,IAAI,CAAC,GAAW,EAAE,aAAqB;QACrC,MAAM,UAAU,GAAgB,EAAE,CAAC;QACnC,MAAM,gBAAgB,GAAG,aAAa,CAAC;QACvC,MAAM,iBAAiB,GAAa,EAAE,CAAC;QAEvC,gDAAgD;QAChD,QAAQ,CAAC,GAAG,EAAE;YACZ,mBAAmB,CAAC,IAAqC;gBACvD,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;oBACjB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QAEH,4EAA4E;QAC5E,iEAAiE;QACjE,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,gBAAgB,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAEhH,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,UAAU,CAAC,IAAI,CAAC;gBACd,IAAI,EAAE,yBAAyB;gBAC/B,QAAQ,EAAE,UAAU;gBACpB,IAAI,EAAE,CAAC;gBACP,MAAM,EAAE,CAAC;gBACT,OAAO,EAAE,iEAAiE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,oEAAoE;gBAC3K,UAAU,EAAE;oBACV,IAAI,EAAE,iGAAiG;oBACvG,OAAO,EAAE,gEAAgE;iBAC1E;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAtCY,yBAAyB;IADrC,aAAa,CAAC,YAAY,EAAE,yBAAyB,CAAC;GAC1C,yBAAyB,CAsCrC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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: no-data-prop
|
|
7
|
+
*
|
|
8
|
+
* Discourages the use of generic 'data' prop names in favor of more specific
|
|
9
|
+
* names like 'items', 'customers', etc. This improves code clarity and makes
|
|
10
|
+
* the component's purpose more explicit.
|
|
11
|
+
*
|
|
12
|
+
* Skips chart/visualization components that legitimately need generic data props.
|
|
13
|
+
*
|
|
14
|
+
* Severity: low (opinion-based style preference, not a functional issue)
|
|
15
|
+
* Applies to: all components
|
|
16
|
+
*/
|
|
17
|
+
export declare class NoDataPropRule extends BaseLintRule {
|
|
18
|
+
get Name(): string;
|
|
19
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
20
|
+
Test(ast: t.File, componentName: string, componentSpec?: ComponentSpec): Violation[];
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=no-data-prop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-data-prop.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/no-data-prop.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;;;;;;;;;;;GAWG;AACH,qBACa,cAAe,SAAQ,YAAY;IAC9C,IAAI,IAAI,WAA6B;IACrC,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;CAsFrF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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: no-data-prop
|
|
13
|
+
*
|
|
14
|
+
* Discourages the use of generic 'data' prop names in favor of more specific
|
|
15
|
+
* names like 'items', 'customers', etc. This improves code clarity and makes
|
|
16
|
+
* the component's purpose more explicit.
|
|
17
|
+
*
|
|
18
|
+
* Skips chart/visualization components that legitimately need generic data props.
|
|
19
|
+
*
|
|
20
|
+
* Severity: low (opinion-based style preference, not a functional issue)
|
|
21
|
+
* Applies to: all components
|
|
22
|
+
*/
|
|
23
|
+
let NoDataPropRule = class NoDataPropRule extends BaseLintRule {
|
|
24
|
+
get Name() { return 'no-data-prop'; }
|
|
25
|
+
get AppliesTo() { return 'all'; }
|
|
26
|
+
Test(ast, componentName, componentSpec) {
|
|
27
|
+
const violations = [];
|
|
28
|
+
// Skip this rule for chart/visualization components that legitimately need generic data props
|
|
29
|
+
// These are reusable components designed to work with any entity type
|
|
30
|
+
const isChartComponent = componentSpec?.type === 'chart' ||
|
|
31
|
+
componentName.toLowerCase().includes('chart') ||
|
|
32
|
+
componentName.toLowerCase().includes('graph') ||
|
|
33
|
+
componentName.toLowerCase().includes('visualization') ||
|
|
34
|
+
componentName.toLowerCase().includes('grid') ||
|
|
35
|
+
componentName.toLowerCase().includes('table');
|
|
36
|
+
if (isChartComponent) {
|
|
37
|
+
return violations; // Skip - generic data prop is expected for chart components
|
|
38
|
+
}
|
|
39
|
+
traverse(ast, {
|
|
40
|
+
// Check function parameters for 'data' prop
|
|
41
|
+
FunctionDeclaration(path) {
|
|
42
|
+
if (path.node.id && path.node.id.name === componentName && path.node.params[0]) {
|
|
43
|
+
const param = path.node.params[0];
|
|
44
|
+
if (t.isObjectPattern(param)) {
|
|
45
|
+
for (const prop of param.properties) {
|
|
46
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'data') {
|
|
47
|
+
violations.push({
|
|
48
|
+
rule: 'no-data-prop',
|
|
49
|
+
severity: 'low', // Opinion-based style preference, not a functional issue
|
|
50
|
+
line: prop.loc?.start.line || 0,
|
|
51
|
+
column: prop.loc?.start.column || 0,
|
|
52
|
+
message: `Component "${componentName}" accepts generic 'data' prop. Consider using more specific prop names like 'items', 'customers', etc. for clarity.`,
|
|
53
|
+
code: 'data prop in component signature',
|
|
54
|
+
suggestion: {
|
|
55
|
+
text: 'Replace generic data prop with specific named props',
|
|
56
|
+
example: `// Instead of:
|
|
57
|
+
function Component({ data, savedUserSettings, onSaveUserSettings }) {
|
|
58
|
+
return <div>{data.items.map(...)}</div>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Use specific props:
|
|
62
|
+
function Component({ items, customers, savedUserSettings, onSaveUserSettings }) {
|
|
63
|
+
// Component owns its state
|
|
64
|
+
const [selectedItemId, setSelectedItemId] = useState(
|
|
65
|
+
savedUserSettings?.selectedItemId
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
return <div>{items.map(...)}</div>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Load data using utilities:
|
|
72
|
+
const result = await utilities.rv.RunView({ entityName: 'Items' });`,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
// Also check arrow functions
|
|
81
|
+
VariableDeclarator(path) {
|
|
82
|
+
if (t.isIdentifier(path.node.id) && path.node.id.name === componentName) {
|
|
83
|
+
const init = path.node.init;
|
|
84
|
+
if (t.isArrowFunctionExpression(init) && init.params[0]) {
|
|
85
|
+
const param = init.params[0];
|
|
86
|
+
if (t.isObjectPattern(param)) {
|
|
87
|
+
for (const prop of param.properties) {
|
|
88
|
+
if (t.isObjectProperty(prop) && t.isIdentifier(prop.key) && prop.key.name === 'data') {
|
|
89
|
+
violations.push({
|
|
90
|
+
rule: 'no-data-prop',
|
|
91
|
+
severity: 'low', // Opinion-based style preference, not a functional issue
|
|
92
|
+
line: prop.loc?.start.line || 0,
|
|
93
|
+
column: prop.loc?.start.column || 0,
|
|
94
|
+
message: `Component "${componentName}" accepts generic 'data' prop. Consider using more specific prop names like 'items', 'customers', etc. for clarity.`,
|
|
95
|
+
code: 'data prop in component signature',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
return violations;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
NoDataPropRule = __decorate([
|
|
108
|
+
RegisterClass(BaseLintRule, 'no-data-prop')
|
|
109
|
+
], NoDataPropRule);
|
|
110
|
+
export { NoDataPropRule };
|
|
111
|
+
//# sourceMappingURL=no-data-prop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-data-prop.js","sourceRoot":"","sources":["../../src/runtime-rules/no-data-prop.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;;;;;;;;;;;GAWG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,YAAY;IAC9C,IAAI,IAAI,KAAK,OAAO,cAAc,CAAC,CAAC,CAAC;IACrC,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB,EAAE,aAA6B;QACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,8FAA8F;QAC9F,sEAAsE;QACtE,MAAM,gBAAgB,GACpB,aAAa,EAAE,IAAI,KAAK,OAAO;YAC/B,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC7C,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC7C,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;YACrD,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5C,aAAa,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,OAAO,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
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rule: no-export-statements
|
|
6
|
+
*
|
|
7
|
+
* Ensures that interactive components do not contain export statements.
|
|
8
|
+
* Components are self-contained and should not export values.
|
|
9
|
+
*
|
|
10
|
+
* Severity: critical
|
|
11
|
+
* Applies to: all components
|
|
12
|
+
*/
|
|
13
|
+
export declare class NoExportStatementsRule extends BaseLintRule {
|
|
14
|
+
get Name(): string;
|
|
15
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
16
|
+
Test(ast: t.File, componentName: string): Violation[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=no-export-statements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-export-statements.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/no-export-statements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD;;;;;;;;GAQG;AACH,qBACa,sBAAuB,SAAQ,YAAY;IACtD,IAAI,IAAI,WAAqC;IAC7C,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,GAAG,SAAS,EAAE;CAkJtD"}
|
|
@@ -0,0 +1,143 @@
|
|
|
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 * as t from '@babel/types';
|
|
8
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
9
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
10
|
+
import { traverse, createViolation, truncateCode } from '../lint-utils.js';
|
|
11
|
+
/**
|
|
12
|
+
* Rule: no-export-statements
|
|
13
|
+
*
|
|
14
|
+
* Ensures that interactive components do not contain export statements.
|
|
15
|
+
* Components are self-contained and should not export values.
|
|
16
|
+
*
|
|
17
|
+
* Severity: critical
|
|
18
|
+
* Applies to: all components
|
|
19
|
+
*/
|
|
20
|
+
let NoExportStatementsRule = class NoExportStatementsRule extends BaseLintRule {
|
|
21
|
+
get Name() { return 'no-export-statements'; }
|
|
22
|
+
get AppliesTo() { return 'all'; }
|
|
23
|
+
Test(ast, componentName) {
|
|
24
|
+
const violations = [];
|
|
25
|
+
// Track if we're inside the main function and where it ends
|
|
26
|
+
let mainFunctionEnd = 0;
|
|
27
|
+
// First pass: find the main component function
|
|
28
|
+
traverse(ast, {
|
|
29
|
+
FunctionDeclaration(path) {
|
|
30
|
+
if (path.node.id?.name === componentName) {
|
|
31
|
+
mainFunctionEnd = path.node.loc?.end.line || 0;
|
|
32
|
+
path.stop(); // Stop traversing once we find it
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
FunctionExpression(path) {
|
|
36
|
+
// Check for function expressions assigned to const/let/var
|
|
37
|
+
const parent = path.parent;
|
|
38
|
+
if (t.isVariableDeclarator(parent) && t.isIdentifier(parent.id) && parent.id.name === componentName) {
|
|
39
|
+
mainFunctionEnd = path.node.loc?.end.line || 0;
|
|
40
|
+
path.stop();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
ArrowFunctionExpression(path) {
|
|
44
|
+
// Check for arrow functions assigned to const/let/var
|
|
45
|
+
const parent = path.parent;
|
|
46
|
+
if (t.isVariableDeclarator(parent) && t.isIdentifier(parent.id) && parent.id.name === componentName) {
|
|
47
|
+
mainFunctionEnd = path.node.loc?.end.line || 0;
|
|
48
|
+
path.stop();
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
// Second pass: check for export statements
|
|
53
|
+
traverse(ast, {
|
|
54
|
+
ExportNamedDeclaration(path) {
|
|
55
|
+
const line = path.node.loc?.start.line || 0;
|
|
56
|
+
violations.push(createViolation('no-export-statements', 'critical', path.node, `Component "${componentName}" contains an export statement${mainFunctionEnd > 0 && line > mainFunctionEnd ? ' after the component function' : ''}. Interactive components are self-contained and cannot export values.`, truncateCode(path.toString()), {
|
|
57
|
+
text: 'Remove all export statements. The component function should be the only code, not exported.',
|
|
58
|
+
example: `// ❌ WRONG - Using export:
|
|
59
|
+
export function MyComponent({ utilities }) {
|
|
60
|
+
return <div>Hello</div>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const helper = () => {};
|
|
64
|
+
export default MyComponent;
|
|
65
|
+
|
|
66
|
+
// ✅ CORRECT - Just the function, no exports:
|
|
67
|
+
function MyComponent({ utilities, styles, components }) {
|
|
68
|
+
// Helper functions defined inside if needed
|
|
69
|
+
const helper = () => {
|
|
70
|
+
// ...
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return <div>Hello</div>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// The component is self-contained.
|
|
77
|
+
// No exports needed - the host environment
|
|
78
|
+
// will execute the function directly.`,
|
|
79
|
+
}));
|
|
80
|
+
},
|
|
81
|
+
ExportDefaultDeclaration(path) {
|
|
82
|
+
const line = path.node.loc?.start.line || 0;
|
|
83
|
+
violations.push(createViolation('no-export-statements', 'critical', path.node, `Component "${componentName}" contains an export default statement${mainFunctionEnd > 0 && line > mainFunctionEnd ? ' after the component function' : ''}. Interactive components are self-contained and cannot export values.`, truncateCode(path.toString()), {
|
|
84
|
+
text: 'Remove all export statements. The component function should be the only code, not exported.',
|
|
85
|
+
example: `// ❌ WRONG - Using export:
|
|
86
|
+
export function MyComponent({ utilities }) {
|
|
87
|
+
return <div>Hello</div>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const helper = () => {};
|
|
91
|
+
export default MyComponent;
|
|
92
|
+
|
|
93
|
+
// ✅ CORRECT - Just the function, no exports:
|
|
94
|
+
function MyComponent({ utilities, styles, components }) {
|
|
95
|
+
// Helper functions defined inside if needed
|
|
96
|
+
const helper = () => {
|
|
97
|
+
// ...
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return <div>Hello</div>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// The component is self-contained.
|
|
104
|
+
// No exports needed - the host environment
|
|
105
|
+
// will execute the function directly.`,
|
|
106
|
+
}));
|
|
107
|
+
},
|
|
108
|
+
ExportAllDeclaration(path) {
|
|
109
|
+
const line = path.node.loc?.start.line || 0;
|
|
110
|
+
violations.push(createViolation('no-export-statements', 'critical', path.node, `Component "${componentName}" contains an export * statement${mainFunctionEnd > 0 && line > mainFunctionEnd ? ' after the component function' : ''}. Interactive components are self-contained and cannot export values.`, truncateCode(path.toString()), {
|
|
111
|
+
text: 'Remove all export statements. The component function should be the only code, not exported.',
|
|
112
|
+
example: `// ❌ WRONG - Using export:
|
|
113
|
+
export function MyComponent({ utilities }) {
|
|
114
|
+
return <div>Hello</div>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const helper = () => {};
|
|
118
|
+
export default MyComponent;
|
|
119
|
+
|
|
120
|
+
// ✅ CORRECT - Just the function, no exports:
|
|
121
|
+
function MyComponent({ utilities, styles, components }) {
|
|
122
|
+
// Helper functions defined inside if needed
|
|
123
|
+
const helper = () => {
|
|
124
|
+
// ...
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return <div>Hello</div>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// The component is self-contained.
|
|
131
|
+
// No exports needed - the host environment
|
|
132
|
+
// will execute the function directly.`,
|
|
133
|
+
}));
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
return violations;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
NoExportStatementsRule = __decorate([
|
|
140
|
+
RegisterClass(BaseLintRule, 'no-export-statements')
|
|
141
|
+
], NoExportStatementsRule);
|
|
142
|
+
export { NoExportStatementsRule };
|
|
143
|
+
//# sourceMappingURL=no-export-statements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-export-statements.js","sourceRoot":"","sources":["../../src/runtime-rules/no-export-statements.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAY,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElF;;;;;;;;GAQG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,YAAY;IACtD,IAAI,IAAI,KAAK,OAAO,sBAAsB,CAAC,CAAC,CAAC;IAC7C,IAAI,SAAS,KAA+B,OAAO,KAAK,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,GAAW,EAAE,aAAqB;QACrC,MAAM,UAAU,GAAgB,EAAE,CAAC;QAEnC,4DAA4D;QAC5D,IAAI,eAAe,GAAG,CAAC,CAAC;QAExB,+CAA+C;QAC/C,QAAQ,CAAC,GAAG,EAAE;YACZ,mBAAmB,CAAC,IAAqC;gBACvD,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,KAAK,aAAa,EAAE,CAAC;oBACzC,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,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;;;;;;;;;;;;;uCAoBgB;iBAC1B,CACF,CACF,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAtJY,sBAAsB;IADlC,aAAa,CAAC,YAAY,EAAE,sBAAsB,CAAC;GACvC,sBAAsB,CAsJlC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as t from '@babel/types';
|
|
2
|
+
import { BaseLintRule } from '../lint-rule.js';
|
|
3
|
+
import { Violation } from '../component-linter.js';
|
|
4
|
+
/**
|
|
5
|
+
* Rule: no-iife-wrapper
|
|
6
|
+
*
|
|
7
|
+
* Ensures that component code is not wrapped in an IIFE (Immediately Invoked Function Expression).
|
|
8
|
+
* Components should be defined as plain functions.
|
|
9
|
+
*
|
|
10
|
+
* Severity: critical
|
|
11
|
+
* Applies to: all components
|
|
12
|
+
*/
|
|
13
|
+
export declare class NoIifeWrapperRule extends BaseLintRule {
|
|
14
|
+
get Name(): string;
|
|
15
|
+
get AppliesTo(): 'all' | 'child' | 'root';
|
|
16
|
+
Test(ast: t.File): Violation[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=no-iife-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-iife-wrapper.d.ts","sourceRoot":"","sources":["../../src/runtime-rules/no-iife-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGhD;;;;;;;;GAQG;AACH,qBACa,iBAAkB,SAAQ,YAAY;IACjD,IAAI,IAAI,WAAgC;IACxC,IAAI,SAAS,IAAI,KAAK,GAAG,OAAO,GAAG,MAAM,CAAkB;IAE3D,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,EAAE;CAwO/B"}
|