Class: Browsable::Analyzers::Javascript
- Defined in:
- lib/browsable/analyzers/javascript.rb
Overview
Audits JavaScript by shelling out to eslint with eslint-plugin-compat configured for the project’s target. As with CSS, browsable supplies the config and eslint (with its bundled compat data) does the reasoning.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Browsable::Analyzers::Base
Instance Method Details
#analyze(files) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/browsable/analyzers/javascript.rb', line 14 def analyze(files) return [] if files.empty? # TODO(v0.2): emit an eslint 9 flat config (eslint.config.mjs) and # detect which config format the installed eslint expects. argv = ["eslint", "--no-eslintrc", "--config", write_eslintrc, "--format", "json", *files] parse(shell_out(argv, dry_run_key: "BROWSABLE_DRY_RUN_JS")) end |
#required_tools ⇒ Object
12 |
# File 'lib/browsable/analyzers/javascript.rb', line 12 def required_tools = ["eslint"] |