schorfes / grunt-lintspaces Goto Github PK
View Code? Open in Web Editor NEWA Grunt task for checking spaces in files.
Home Page: https://npmjs.com/package/grunt-lintspaces
License: MIT License
A Grunt task for checking spaces in files.
Home Page: https://npmjs.com/package/grunt-lintspaces
License: MIT License
Show at the end of executed task the number of checked files.
E.x. node_modules
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.
Is it possible to somehow set an option so the grunt job is not aborted when trailing whitespaces are found, but a warning is still produced, so I know that is the case?
Try to guess the correct indentation using the following rules:
The indentation of the current line is correct when:
The option should be set to false by default.
The output of this option should not end in a failed validation
The task tries to validate directories which results in the following error:
Warning: Unable to read "tests/files/comments" file (Error code: EISDIR).
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...
What do you think of this 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?
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.
Add an extra option for useless empty lines at the beginning of a file.
This style of comment seems to be ignored when using ignores: ['js-comments'].
/*
I'm a comment and I cause issues!
*/
I've added to the JS comments tests and I'll take a look at fixing it, but in the mean time, does anyone have any comments (a pun I didn't intend!) on adding this?
https://github.com/adrianblynch/grunt-lintspaces/blob/master/tests/files/comments/comments.js
# 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
Add an extra option for a maximum amount of newlines between code blocks.
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
...
When i use
options: {
ignore: [
"js-comments"
],
newlineMaximum: 1
}
the ignored comments are counted as new lines. And i get an newlineMaximum error.
What can i do?
... but I just wanna say: As a white space nazi I very very much appreciate this package!
π
Thank you
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.
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?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.