Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
grunt-lesslint
Advanced tools
Readme
Lint your LESS files using CSS Lint from Grunt.
This plugin compiles your LESS files, runs the generated CSS through CSS Lint, and outputs the offending LESS line for any CSS Lint errors found.
npm install grunt-lesslint
npm install
grunt
to compile the CoffeeScript codegrunt test
to run the specsAdd the following to your Gruntfile.coffee
:
grunt.initConfig
lesslint:
src: ['src/**/*.less']
grunt.loadNpmTasks('grunt-lesslint')
Then run grunt lesslint
to lint all the .less
files under src/
.
By default the plugin uses the less
and csslint
config settings to
configure the LESS parser and the CSS Lint validator.
You can configure the CSS Lint validator, such as for disabling certain rules
or loading a .csslintrc
file, by adding a csslint
option value:
lesslint:
src: ['less/*.less']
options:
csslint:
'known-properties': false
csslintrc: '.csslintrc'
The failOnWarning
configuration option is now available to allow any failing
lint rules set to "warn" to not fail the grunt task.
To maintain backwards-compatibility:
failOnWarning: true
, which will continue
to fail the grunt task on any failed rule. When using the default option, the
following example output shows the task failure due to failed lint rules
configured as "warnings": >> 58 lint issues in 167 files (0 errors, 58 warnings)
Warning: Task "lesslint" failed. Use --force to continue.
failOnError: false
will act as a complete override for both
settings: don't fail grunt task if EITHER lint rule warning(s) or error(s)
are found. Example Config: lesslint:
src: ['less/*.less']
options:
csslint:
'known-properties': true
csslintrc: '.csslintrc'
failOnError: false
By setting failOnWarning: false
, any failing rule configured
to "warn" will no longer fail the grunt task:
lesslint:
src: ['less/*.less']
options:
csslint:
'known-properties': true
csslintrc: '.csslintrc'
failOnWarning: false
This example's task output shows the task completing without failure, even when there are failed lint rules configured as "warnings":
>> 58 lint issues in 167 files (0 errors, 58 warnings)
Done, without errors.
Notes:
The new task summary output is borrowed from equivalent output used by eslint:
✖ 31 problems (0 errors, 31 warnings)
This option is meant to afford large projects the recourse of a staged adoption strategy of specific CSS rules. New rules may be activated to trigger a warning notification across teams without breaking the build and deployment. Once existing infractions are addressed, those rules would then be configured from "warning" setting to "error", to finalize their enforcement (by blocking any subsequent build attempts).
You can configure the LESS parser, such as for adding include paths,
by adding a less
option value:
lesslint:
src: ['less/*.less']
options:
less:
paths: ['includes']
By default, this plugin does not include any lint errors from imported files in the output.
You can enable this by adding an imports
configuration option:
lesslint:
src: ['src/**/*.less']
options:
imports: ['imports/**/*.less']
This plugin provides the same output formatter options as the CSS Lint plugin and can be configured similarly:
lesslint:
options:
formatters: [
id: 'csslint-xml'
dest: 'report/lesslint.xml'
]
It is possible to create and use your own custom rules. To create rules, please refer to the official CSSLint guidelines. The only addition is that each custom rule file must import CSSLint
using CSSLint = require('grunt-lesslint').CSSLint
.
You can enable your custom rules by adding a customRules
configuration option:
lesslint:
options:
customRules: ['lint-rules/less/**/*.coffee']
> grunt lesslint
Running "lesslint" (lesslint) task
static/editor.less (1)
Values of 0 shouldn't have units specified. You don't need to specify units when a value is 0. (zero-units)
>> 14: line-height: 0px;
>> 1 linting error in 56 files.
options
is no longer passed to the LESS compiler. options.less
is passed instead, as described by the documentation.FAQs
Grunt task for validating LESS files with CSS Lint
The npm package grunt-lesslint receives a total of 1,633 weekly downloads. As such, grunt-lesslint popularity was classified as popular.
We found that grunt-lesslint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.