Class: LinterChanges::Linter::Eslint::Adapter

Inherits:
Base
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/linter_changes/linter/eslint/adapter.rb

Constant Summary collapse

EXTENSIONS =

ESLint no ofrece un equivalente a bin/rubocop --list-target-files, asi que derivamos los archivos objetivo filtrando los cambiados por extension. Base#run los intersecta con los archivos del diff, de modo que solo se linteara lo modificado. Los archivos en .eslintignore que pasen este filtro son descartados por el propio ESLint.

T.let(%w[.js .jsx .ts .tsx .vue .mjs .cjs].freeze, T::Array[String])

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#changed_files, #config_changed?, #initialize, #run

Constructor Details

This class inherits a constructor from LinterChanges::Linter::Base

Instance Method Details

#list_target_filesObject



17
18
19
# File 'lib/linter_changes/linter/eslint/adapter.rb', line 17

def list_target_files
  changed_files.select { |file| EXTENSIONS.include?(File.extname(file)) }
end