Mailspring/build/tasks/nylaslint-task.coffee
Ben Gotow f8c5f7b967 refactor(db): change ID system to have clientIDs and serverIDs
Summary: Major ID refactor

Test Plan: edgehill --test

Reviewers: bengotow, dillon

Differential Revision: https://phab.nylas.com/D1946
2015-08-28 11:24:29 -07:00

22 lines
711 B
CoffeeScript

path = require 'path'
fs = require 'fs-plus'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerMultiTask 'nylaslint', 'Check requires for file extensions compiled away', ->
done = @async()
regex = /require ['"].*\.(coffee|cjsx|jsx)['"]/i
for fileset in @files
grunt.log.writeln('Nylinting ' + fileset.src.length + ' files.')
# file.src is the list of all matching file names.
for f in fileset.src
content = fs.readFileSync(f, encoding:'utf8')
if regex.test(content)
done(new Error("#{f} contains a bad require including an coffee / cjsx / jsx extension. Remove the extension!"))
return
done(null)