sagiegurari / grunt-markdownlint

A grunt task for markdown style checker and lint tool.
Apache License 2.0
7 stars 2 forks source link

bug(registering): “No tasks were registered or unregistered” #25

Closed Kristinita closed 2 years ago

Kristinita commented 2 years ago

1. Summary

Possible grunt-markdownlint bug.

On the stage “Registering Gruntfile tasks” after

Loading "grunt-markdownlint.js" tasks…OK

+ markdownlint

Loading "linter.js" tasks…OK

I get in console:

>> No tasks were registered or unregistered.

I’m not getting it for any of my 50 Grunt plugins.

2. MCVE

This configuration on GitHub, Travis CI build for it.

  1. Gruntfile.coffee:

    module.exports = (grunt) ->
    
        grunt.loadNpmTasks('grunt-markdownlint')
        # [INFO] Or any another working Grunt plugins instead of “grunt-contrib-stylus”,
        # “grunt-purgecss” and “merge-source-maps”
        grunt.loadNpmTasks('grunt-contrib-stylus')
        grunt.loadNpmTasks('grunt-purgecss')
        grunt.loadNpmTasks('merge-source-maps')
    
        grunt.initConfig
    
            markdownlint:
                # [INFO] Or any another valid Markdown file
                src: ["KiraGoddess.md"]
    
  2. package.json:

    {
        "devDependencies": {
            "coffeescript": "^2.7.0",
            "grunt": "^1.5.3",
            "grunt-contrib-stylus": "^1.2.0",
            "grunt-markdownlint": "^3.1.5",
            "grunt-purgecss": "^5.0.0",
            "merge-source-maps": "^0.6.1"
        }
    }
    
  3. KiraGoddess.md:

    # Kira
    
    Goddess!
    
  4. The part of the .travis.yml:

    install:
    - npm install -g grunt-cli
    - npm install
    
    script:
    - grunt markdownlint --verbose --stack
    

3. Behavior

Travis CI link:

    Reading "Gruntfile.coffee" Gruntfile…OK

    Registering Gruntfile tasks.

    Registering "grunt-markdownlint" local Npm module tasks.

    Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-markdownlint/package.json…OK

    Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-markdownlint/package.json…OK

    Loading "grunt-markdownlint.js" tasks…OK

    + markdownlint

    Loading "linter.js" tasks…OK

+   >> No tasks were registered or unregistered.

    Registering "grunt-contrib-stylus" local Npm module tasks.

    Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-contrib-stylus/package.json…OK

    Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-contrib-stylus/package.json…OK

    Loading "stylus.js" tasks…OK

    + stylus

    Registering "grunt-purgecss" local Npm module tasks.

    Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-purgecss/package.json…OK

    Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-purgecss/package.json…OK

    Loading "purgecss.js" tasks…OK

    + purgecss

    Registering "merge-source-maps" local Npm module tasks.

    Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/merge-source-maps/package.json…OK

    Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/merge-source-maps/package.json…OK

    Loading "merge.js" tasks…OK

    + merge-source-maps

    Initializing config…OK

As you can see in this console output, Grunt generate unexpected message solely after grunt-markdownlint linter.js loading. After registering and loading other Grunt plugins, Grunt doesn’t generate this message.

4. Environment

  1. Operating system:

    1. Local — Microsoft Windows [Version 10.0.19041.1415]
    2. Travis CI — Ubuntu 22.04 LTS Jammy Jellyfish
  2. Node.js v18.9.0

  3. grunt-cli v1.3.2, grunt v1.5.3

  4. grunt-markdownlint 3.1.5

Thanks.

sagiegurari commented 2 years ago

I created a basic example here: https://github.com/sagiegurari/misc-test/tree/grunt-markdown-example

test it out as it works fine and compare it with your implementation.

Kristinita commented 2 years ago

Type: Reply 💬

  1. My issue isn’t a “question”. (Interesting, why developers often add the “question” label for issues that aren’t questions?)

  2. test it out as it works fine

    I run grunt markdownlint --verbose --stack for your configuration:

        D:\SashaForks\misc-test>grunt markdownlint --verbose --stack
        Initializing
        Command-line options: --verbose, --stack, --gruntfile=D:\SashaForks\misc-test\Gruntfile.js
    
        Reading "Gruntfile.js" Gruntfile...OK
    
        Registering Gruntfile tasks.
    
        Registering "grunt-markdownlint" local Npm module tasks.
        Reading D:\SashaForks\misc-test\node_modules\grunt-markdownlint\package.json...OK
        Parsing D:\SashaForks\misc-test\node_modules\grunt-markdownlint\package.json...OK
        Loading "grunt-markdownlint.js" tasks...OK
        + markdownlint
        Loading "linter.js" tasks...OK
    +   >> No tasks were registered or unregistered.
        Initializing config...OK
        Loading "Gruntfile.js" tasks...OK
        + default
    
        Running tasks: markdownlint
    
        Running "markdownlint" task
    
        Running "markdownlint:example1" (markdownlint) task
        Verifying property markdownlint.example1 exists in config...OK
        Files: README.md
        Options: config={"default":true,"line-length":false,"blanks-around-headers":false,"no-duplicate-header":false,"no-inline-html":false}
        >> 1 file lint free.
    
        Done.

    >> No tasks were registered or unregistered. still exists in console output.

  3. @sagiegurari, I clearly described what the problem is? Possibly, you misunderstood what the problem is. Should I add something to my issue?

    I’ll add that perhaps the problem is that the linter.js file of grunt-markdownlint is in the tasks directory, and Grunt defines it as a task. It looks like this file shouldn’t be in the tasks directory.

Thanks.

sagiegurari commented 2 years ago

that printout is only on verbose. it's not on normal output and not defined as warn/error. ya, i could move it to some sub dir or whatever, but, unless you run with verbose, is there an issue?

sagiegurari commented 2 years ago

@Kristinita bump