Skip to content

gulp-csslint is not picking up my .csslintrc #63

@Nightfirecat

Description

@Nightfirecat

Test case:

$ ls -A
.csslintrc  gulpfile.js  node_modules  package.json  test.css  yarn.lock

$ cat package.json
{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "gulp": "^4.0.0",
    "gulp-csslint": "^1.0.1"
  }
}

$ cat test.css
.foo.bar {
  width: 300px
}

.foo > h1 {
  color: grey
}

.bar > h1 {
  color: blue
}

.foo {
  border: 2px solid black;
  width: 20px
}

$ cat gulpfile.js
const gulp    = require('gulp'),
      csslint = require('gulp-csslint');

gulp.task('css', function() {
        return gulp.src('test.css')
                .pipe(csslint('.csslintrc'))
                .pipe(csslint.formatter());
});

Expected output: (using csslint CLI tool)

$ csslint test.css


csslint: There are 2 problems in D:\Documents\git\test\test.css.

test.css
1: warning at line 5, col 8
Heading (h1) should not be qualified.
.foo > h1 {

test.css
2: warning at line 9, col 8
Heading (h1) should not be qualified.
.bar > h1 {

Actual output (using gulp task)

$ gulp css
[09:58:31] Using gulpfile D:\Documents\git\test\gulpfile.js
[09:58:31] Starting 'css'...


csslint: There are 6 problems in D:\Documents\git\test\test.css.

test.css
1: warning at line 1, col 1
Adjoining classes: .foo.bar
.foo.bar {

test.css
2: warning at line 5, col 8
Heading (h1) should not be qualified.
.foo > h1 {

test.css
3: warning at line 9, col 8
Heading (h1) should not be qualified.
.bar > h1 {

test.css
4: warning at line 9, col 8
Heading (h1) has already been defined.
.bar > h1 {

test.css
5: warning at line 14, col 3
Using width with border can sometimes make elements larger than you expect.
  border: 2px solid black;

test.css
6: warning
You have 2 h1s defined in this stylesheet.[09:58:32] Finished 'css' after 48 ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions