Class: Lintrunner::Parser::Eslint
- Defined in:
- lib/lintrunner/parser/eslint.rb
Instance Method Summary collapse
-
#parse(output, exit_code, options = {}) ⇒ Object
Example output of eslint (using the compact formatter): app/javascripts/delivery_page/components/add_guests.js: line 256, col 5, Error - Missing semicolon.
Instance Method Details
#parse(output, exit_code, options = {}) ⇒ Object
Example output of eslint (using the compact formatter): app/javascripts/delivery_page/components/add_guests.js: line 256, col 5, Error - Missing semicolon. (semi) app/javascripts/delivery_page/components/add_guests.js: line 277, col 18, Error - Props should be sorted alphabetically (react/jsx-sort-props)
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lintrunner/parser/eslint.rb', line 8 def parse(output, exit_code, = {}) return [] unless exit_code == 1 = [] output.each_line do |line| match = /(?<filename>.*): line (?<line>\d*), .*Error - (?<description>.*) \((?<name>.*)\)/.match(line) if match << Lintrunner::Message.new( filename: [:filename] || match[:filename], line: match["line"].to_i, name: match["name"], description: match["description"]) end end end |