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

eslint-plugin harden-exports rule mishandles many exports #2390

Open
gibson042 opened this issue Jul 30, 2024 · 0 comments
Open

eslint-plugin harden-exports rule mishandles many exports #2390

gibson042 opened this issue Jul 30, 2024 · 0 comments

Comments

@gibson042
Copy link
Contributor

(Originally posted by @gibson042 in #2387 (comment) )

Non-comprehensive list:

  • export const { propName: exportName } = objWithPropName (prop.key.name of propName: exportName pulls propName, whereas we should pull prop.value.name to ensure the presence of harden(exportName)) and
  • export const { name, ...rest } = obj (object rest) and
  • export const { name, parent: { subName } } (nested patterns) and
  • export const [ exportName1, … ] = array (declaration.id.type === 'ArrayPattern' is just skipped entirely)

The linked comment proposes a fix in the form of a pushDeclaredNames helper that handles default assignment and arbitrarily nested destructuring patterns, to be used in combination with post hoc verification of the style already employed for "should be followed by a call to 'harden'" complaints (i.e., collect all declarations in one phase and validate their conformance in a second phase).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant