GithubHelp home page GithubHelp logo

schorfes / grunt-lintspaces Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 9.0 927 KB

A Grunt task for checking spaces in files.

Home Page: https://npmjs.com/package/grunt-lintspaces

License: MIT License

JavaScript 99.21% Python 0.79%

grunt-lintspaces's Introduction

Hey! πŸ‘¨β€πŸ’»

grunt-lintspaces's People

Contributors

ben-eb avatar dependabot[bot] avatar johankj avatar schorfes avatar yurks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

grunt-lintspaces's Issues

Make destructive changes

Instead of just warning. Why not fix things at the same time? I understand not everything can do this, but for something like newlines at the end of files it shouldn't be a problem.

New option to guess indentation

Try to guess the correct indentation using the following rules:

The indentation of the current line is correct when:

  • the amount of indentations is equal to the previous or
  • the amount of indentations is one less than the previous line or
  • the amount of indentations is one more than the previous line

The option should be set to false by default.
The output of this option should not end in a failed validation

Tries to read directories

The task tries to validate directories which results in the following error:
Warning: Unable to read "tests/files/comments" file (Error code: EISDIR).

Indentation detection not working well in html.erb files

I’ve setup lintspaces with the following:

lintspaces: {
            html: {
                src: [
                    '**/*.html.erb'
                ],
                options: {
                    newline: true,
                    trailingspaces: true,
                    indentation: 'spaces',
                    spaces: 2
                }
            },
        }
}

but when I run it, it does not detect any problems even though all my html.erb files are indented with 4 spaces instead of 2. I’m guessing that’s because 2 is a mulltiple of 4? Any way around that?

The newline detection does work though...

Lints spaces in comments, bug or feature?

First of all, great plugin; but it also lints (and fails) comment blocks such as this style of Laravel comments:

/*
 |---------------------------------------------------------------------
 | Comment text
 |---------------------------------------------------------------------
*/

And more of a documentation style syntax:

/**
 * Function name...
 * Description.....
 */

Are there any plans to ignore comment blocks in the future?

newlineMaximum failing

I get this error: "Maximum amount of newlines exceeded. Found 2 newlines, expected maximum is 3"

I want accept this kind of situation:

function pee(arg) {
  //
}


function poo(arg) {
  //
}

This works only when I set the newlineMaximum to 5 or higher.

Bump Junitwriter to 0.4.0

# Run  npm install [email protected]  to resolve 2 vulnerabilities
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Low           β”‚ Prototype pollution                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Package       β”‚ merge                                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Dependency of β”‚ junitwriter                                                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path          β”‚ junitwriter > merge                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ More info     β”‚ https://nodesecurity.io/advisories/722                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Low           β”‚ Prototype Pollution                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Package       β”‚ lodash                                                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Dependency of β”‚ junitwriter                                                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path          β”‚ junitwriter > xmlbuilder > lodash                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ More info     β”‚ https://nodesecurity.io/advisories/577                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

when running npm audit from master

Does not showCodes / showTypes beyond first file.

With the following config:

all: {
        src: [
            'Gruntfile.js',
            'grunt/**/*.js',
            'build-config/**/*.js',
            'webapp/**/*.js',
            '!webapp/vendor/**/*.js',
            'tests/**/*.js'
        ],

        options: {
            ignores: [
                'js-comments'
            ],
            showTypes: true,
            showCodes: true,
            editorconfig: '.editorconfig'
        }
    }

I get a number of errors, but the errors are only shown for the first file:

β˜“ webapp/module1/views/add.js
  L3: (warning) Expected an indentation at 4 instead of at 2. [INDENTATION_SPACES_AMOUNT]
  L4: (warning) Expected an indentation at 4 instead of at 2. [INDENTATION_SPACES_AMOUNT]
  L5: (warning) Expected an indentation at 4 instead of at 2. [INDENTATION_SPACES_AMOUNT]
  L33: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L34: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L36: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L37: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L38: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L40: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L41: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L42: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
  L43: (warning) Expected an indentation at 24 instead of at 22. [INDENTATION_SPACES_AMOUNT]
  L44: (warning) Expected an indentation at 20 instead of at 18. [INDENTATION_SPACES_AMOUNT]
β˜“ webapp/module1/views/edit.js
β˜“ webapp/module1/views/table.js
β˜“ webapp/module2/view.js
β˜“ webapp/module2/views/editing-app.js
β˜“ webapp/module3/app.js
β˜“ webapp/module3/views/filterCollectionView.js
...

Not an issue

... but I just wanna say: As a white space nazi I very very much appreciate this package!
πŸ‘

Thank you

Linting is very slow

Hey there,

I've been using this plugin in all my projects and never had issues until now.
I don't know why yet but it now takes almost a minute to lint 6 files:

Running "lintspaces:all" (lintspaces) task
Verifying property lintspaces.all exists in config...OK
Files: 1.0.0/js/module-1.js, 1.0.0/less/module-mixins.less, 1.0.0/less/settings.less, 1.0.0/html/footer.html, 1.0.0/html/header.html, 1.0.0/html/source.html
Options: showCodes=false, showTypes=false, showValid=false, editorconfig="../.editorconfig", ignores=["js-comments","c-comments","java-comments","as-comments","xml-comments","html-comments","python-comments","ruby-comments","applescript-comments"]
>> 6 lint free.

Each of those files don't have more than 35 lines of code in them.

  • 1.0.0/js/module-1.js [32 lines]
  • 1.0.0/less/module-mixins.less [35 lines]
  • 1.0.0/less/settings.less [11 lines]
  • 1.0.0/html/footer.html [3 lines]
  • 1.0.0/html/header.html [9 lines]
  • 1.0.0/html/source.html [1 line]

No minified code either so lines never exceed more than 160 characters per line (as per our style-guide)
...

And this is the .editorconfig

# editorconfig.org
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

[*.md]
trim_trailing_whitespace = false

Any idea?

problem with spaces

I use options in a grunt task:

less: {
src: [
'css/less/*/'
],
options: {
indentation: 'spaces',
spaces: 2
}
}

If I have 3 spaces it validate that indentation spaces are wrong,
If I have 4 it pass and it shouldn't

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.