Sha256: 7b4d66c1bf69da2d4cedf0173955ee9a636933ca75ce90609db1853168968f9f

Contents?: true

Size: 516 Bytes

Versions: 25

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  # Reports errors when trying to use parser-blocking script tags
  class ParserBlockingJavaScript < HtmlCheck
    severity :error
    categories :html, :performance
    doc docs_url(__FILE__)

    def on_script(node)
      return unless node.attributes["src"]
      return if node.attributes["defer"] || node.attributes["async"] || node.attributes["type"] == "module"

      add_offense("Missing async or defer attribute on script tag", node: node)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
theme-check-1.15.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.14.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.13.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.12.1 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.12.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.11.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.10.3 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.10.2 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.10.1 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.10.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.9.2 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.9.1 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.9.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.8.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.7.2 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.7.1 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.7.0 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.6.2 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.6.1 lib/theme_check/checks/parser_blocking_javascript.rb
theme-check-1.6.0 lib/theme_check/checks/parser_blocking_javascript.rb