Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to prevent dynamic tag usage with createElement #8651

Closed
2 of 6 tasks
jcfranco opened this issue Jan 26, 2024 · 2 comments
Closed
2 of 6 tasks

Add rule to prevent dynamic tag usage with createElement #8651

jcfranco opened this issue Jan 26, 2024 · 2 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. Calcite (dev) Issues logged by Calcite developers. enhancement Issues tied to a new feature or request. eslint-plugin-calcite-components Issues specific to the @esri/eslint-plugin-calcite-components package. estimate - 3 A day or two of work, likely requires updates to tests. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@jcfranco
Copy link
Member

Check existing issues

Description

Stems from #8648 (comment).

Dynamic tags passed to document.createElement prevent the Stencil build from auto-defining them. This rule should help ensure static element tag usage.

Acceptance Criteria

Code like the following is flagged

const tag = someCondition ? "my-component-1" : "my-component-2";
const el = document.createElement(tag);

and the following is fine

const el = someCondition ? 
  document.createElement("my-component-1") : 
  document.createElement("my-component-2");

Relevant Info

No response

Which Component

Any component that is dynamically creating supporting components.

Example Use Case

No response

Priority impact

p4 - not time sensitive

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

Calcite (dev)

@jcfranco jcfranco added enhancement Issues tied to a new feature or request. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jan 26, 2024
@github-actions github-actions bot added impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive eslint-plugin-calcite-components Issues specific to the @esri/eslint-plugin-calcite-components package. Calcite (dev) Issues logged by Calcite developers. labels Jan 26, 2024
@jcfranco jcfranco added 2 - in development Issues that are actively being worked on. and removed 0 - new New issues that need assignment. labels Jan 26, 2024
@jcfranco jcfranco self-assigned this Jan 26, 2024
@jcfranco jcfranco added p - medium Issue is non core or affecting less that 60% of people using the library estimate - 3 A day or two of work, likely requires updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive needs triage Planning workflow - pending design/dev review. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. labels Jan 26, 2024
@jcfranco jcfranco added the impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive label Jan 26, 2024
jcfranco added a commit that referenced this issue Jan 26, 2024
**Related Issue:** #8651

## Summary

This adds a custom ESLint rule to ensure Stencil bundles and
auto-defines child components created via `document.createElement`.
@jcfranco jcfranco added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels Jan 26, 2024
Copy link
Contributor

Installed and assigned for verification.

@DitwanP
Copy link
Contributor

DitwanP commented Jan 31, 2024

🍠 Verified locally on main

The rule is doing what rules do. 🛑
Screenshot 2024-01-31 at 1 37 47 PM

@DitwanP DitwanP closed this as completed Jan 31, 2024
@DitwanP DitwanP added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. Calcite (dev) Issues logged by Calcite developers. enhancement Issues tied to a new feature or request. eslint-plugin-calcite-components Issues specific to the @esri/eslint-plugin-calcite-components package. estimate - 3 A day or two of work, likely requires updates to tests. impact - p3 - not time sensitive User set priority impact status of p3 - not time sensitive p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

3 participants