mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-09 09:38:07 +08:00
17 lines
647 B
CoffeeScript
17 lines
647 B
CoffeeScript
fs = require('fs')
|
|
|
|
module.exports = (grunt) ->
|
|
grunt.registerMultiTask "eslintFixer", "Fixes eslint issues", ->
|
|
done = @async()
|
|
for fileset in @files
|
|
for file in fileset.src
|
|
content = fs.readFileSync(file, encoding: "utf8")
|
|
re1 = /(.*[^ ])=> (.*)/g
|
|
re2 = /(.*) =>([^ ].*)/g
|
|
eolRe = /\ +$/gm
|
|
replacer = (fullMatch, parens, rest) ->
|
|
return "#{parens} => #{rest}"
|
|
newContent = content.replace(re1, replacer)
|
|
newContent = newContent.replace(re2, replacer)
|
|
newContent = newContent.replace(eolRe, "")
|
|
fs.writeFileSync(file, newContent, encoding: 'utf8')
|