Created Javascript from Coffeescript not ready? & # 8594; Throw Lint Error in Yeoman / Grunt

I am currently trying to improve my workflow for building a web application. When Yeoman is installed, the grunt command gives me a good way to combine and reduce my javascript files. My main.js file is generated from a large number of coffeescript files, which I do manually before. I do not use the integrated coffeescript compilation method due to file dependencies. (this is normal)

But here is the problem: when I now try to run "grunt", it gives me "lint" errors from my generated js file, for example:

line 3   col 3    Missing "use strict" statement.
line 3   col 3    Expected 'var' to have an indentation at 5 instead at 3.
line 4   col 102  Expected '{' and instead saw 'child'.
line 4   col 233  A constructor name should start with an uppercase letter.

Warning: Task "jshint:all" failed. Use --force to continue.

if I -force continue it, main.js in the current dest folder is still empty

What can I do? I thought the compiled coffeescript file "jint-ready is ready" javascript?

To compile my coffeescript files, I use "rehab": https://www.npmjs.org/package/rehab

which this Cakefile provides me with:

{exec, spawn} = require 'child_process'
Rehab = require 'rehab'

build = ->
      console.log "Building project from src/*.coffee to app/scripts/main.js"

      files = new Rehab().process 'src'
      files = files.join " "

      join_to_single_file = "--join app/scripts/main.js"
      compile_from_files = "--compile #{files}"

      exec "coffee #{join_to_single_file} #{compile_from_files}", (err, stdout, stderr) ->
        throw err if err

task 'build', 'Build coffee2js using Rehab', sbuild = ->
  build()

UPDATE:

If I understand correctly, the main.js file will never pass jshint, so do I need to remove the check from yoman / grunt in order to continue? I deleted this line from my gruntfile.js file:

// Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
        options: {
            jshintrc: '.jshintrc',
            reporter: require('jshint-stylish')
        },
        all: [
            'Gruntfile.js',
          // removed  '<%= yeoman.app %>/scripts/{,*/}*.js',
            '!<%= yeoman.app %>/scripts/vendor/*',
            'test/spec/{,*/}*.js'
        ]
    },

Now I have no errors when running "grunt", but my output in the dest folder still contains an empty main.js file: (

+4
source share
1 answer

, Coffeescript , jslint. ( , ). . JavaScript Lint, , Coffeescript Github.

coffeelint, ( Grunt).

Coffeelint , , , jslint. (Coffeelint - ).

Coffeescript coffeelint , coffee-jshint. js * hint * Javascript ( , ), Javascript, Coffeescript. -jshint jshint, , .

+4

Source: https://habr.com/ru/post/1529693/


All Articles