Sitelet https://github.com/github/eslint-plugin-github/issues/228
Skip to content

New rule: Ban top-level querying in module.聽#228

Description

@koddsson

Querying should be wrapped in event listeners such as document.addEventListener('DOMContentLoaded', ...) or a Web Component.

馃憥馃徎 Examples of bad code.

const el = document.querySelector('.my-element')

馃憤馃徎 Example of good code.

document.addEventListener('DOMContentLoaded', function() {
  const el = document.querySelector('.my-element')
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions