rrdelaney / jadelint

:dragon: A linter for the Jade templating language
https://rrdelaney.github.io/jadelint
MIT License
6 stars 1 forks source link

Improved file context messages needed #19

Open fpedroza opened 8 years ago

fpedroza commented 8 years ago

When running jadelint on a directory, it would be helpful to include more context in the the warnings and deprecation sections. Here's what I see:

Deprecated method of calling mixins, use +name syntax (undefined line 73) Deprecated method of calling mixins, use +name syntax (undefined line 78) Warning: missing space before text for line 118 of jade file "undefined" Deprecated method of calling mixins, use +name syntax (undefined line 38) Deprecated method of calling mixins, use +name syntax (undefined line 114) Deprecated method of calling mixins, use +name syntax (undefined line 28) Deprecated method of calling mixins, use +name syntax (undefined line 33) Deprecated method of calling mixins, use +name syntax (undefined line 35) Deprecated method of calling mixins, use +name syntax (undefined line 37) Deprecated method of calling mixins, use +name syntax (undefined line 39) Deprecated method of calling mixins, use +name syntax (undefined line 75) Deprecated method of calling mixins, use +name syntax (undefined line 24) Deprecated method of calling mixins, use +name syntax (undefined line 60) Deprecated method of calling mixins, use +name syntax (undefined line 65) Deprecated method of calling mixins, use +name syntax (undefined line 67) Deprecated method of calling mixins, use +name syntax (undefined line 69) Deprecated method of calling mixins, use +name syntax (undefined line 71) Deprecated method of calling mixins, use +name syntax (undefined line 140) Deprecated method of calling mixins, use +name syntax (undefined line 184) Warning: missing space before text for line 101 of jade file "undefined" Warning: missing space before text for line 157 of jade file "undefined" Deprecated method of calling mixins, use +name syntax (undefined line 63) Deprecated method of calling mixins, use +name syntax (undefined line 68) Deprecated method of calling mixins, use +name syntax (undefined line 20)

I also don't understand the messages about jade file "undefined".

rrdelaney commented 8 years ago

Can you give an example of the exact command you ran and what you ran it on?

fpedroza commented 8 years ago

My root jade directory is called views. Here's the output of running the tree command in that directory (trimmed for brevity).

.
├── assessment
│   ├── nolayout
│   │   ├── assessment-casechallenge-full.jade
│   │   ├── ...
│   ├── assessment-casechallenge-full.jade
│   ├── ...
├── assignment
│   ├── assignmentStatusDropdown.jade
│   ├── ...
├── bio
│   ├── biography.jade
│   ├── ...
├── browser
│   └── faculty
│       ├── assignment
│       │   ├── assessmentLessonRow.jade
│       │   ├── ...
│       ├── assignmentAssign
│       │   └── assignConfirm.jade
│       ├── assignmentlessons
│       │   ├── folder.jade
│       │   └── lesson.jade
│       ├── assignments
│       │   ├── assignmentTemplate.jade
│       │   └── assignmentTemplateDetail.jade
│       └── curriculum
│           ├── folder.jade
│           ├── ...
├── dashboard
│   ├── item-completed.jade
│   ├── ...
├── document
│   ├── document.jade
│   ├── ...
├── faculty
│   ├── assignment
│   │   ├── facultyAssignmentDueDateModal.jade
│   │   └── facultyAssignmentManage.jade
│   ├── assignmentlessons
│   │   └── assignmentLessons.jade
│   ├── assignments
│   │   └── assignmentTemplates.jade
│   └── curriculum
│       └── curriculum.jade
├── help
│   ├── bootstrapHelpNav.jade
│   └── helpNav.jade
├── includes
│   ├── breadcrumbs.jade
│   ├── ...
├── layout
│   ├── assessmentLayout.jade
│   ├── ...
├── login
│   └── login.jade
├── product
│   ├── curriculum.jade
│   ├── ...
├── report
│   ├── facultyReportingResident.jade
│   ├── ...
├── user
│   ├── changePassword.jade
│   ├── ...
└── error.jade

25 directories, 116 files

So there's a lot of files and nested directories. I then run this: $(npm bin)/jadelint . and here's the output:

Deprecated method of calling mixins, use `+name` syntax (undefined line 73)
Deprecated method of calling mixins, use `+name` syntax (undefined line 78)
Warning: missing space before text for line 118 of jade file "undefined"
Deprecated method of calling mixins, use `+name` syntax (undefined line 38)
Deprecated method of calling mixins, use `+name` syntax (undefined line 114)
Deprecated method of calling mixins, use `+name` syntax (undefined line 184)
Warning: missing space before text for line 101 of jade file "undefined"
Warning: missing space before text for line 157 of jade file "undefined"
Deprecated method of calling mixins, use `+name` syntax (undefined line 28)
Deprecated method of calling mixins, use `+name` syntax (undefined line 33)
Deprecated method of calling mixins, use `+name` syntax (undefined line 35)
Deprecated method of calling mixins, use `+name` syntax (undefined line 37)
Deprecated method of calling mixins, use `+name` syntax (undefined line 39)
Deprecated method of calling mixins, use `+name` syntax (undefined line 76)
Deprecated method of calling mixins, use `+name` syntax (undefined line 60)
Deprecated method of calling mixins, use `+name` syntax (undefined line 65)
Deprecated method of calling mixins, use `+name` syntax (undefined line 67)
Deprecated method of calling mixins, use `+name` syntax (undefined line 69)
Deprecated method of calling mixins, use `+name` syntax (undefined line 71)
Deprecated method of calling mixins, use `+name` syntax (undefined line 140)
Deprecated method of calling mixins, use `+name` syntax (undefined line 63)
Deprecated method of calling mixins, use `+name` syntax (undefined line 68)
Deprecated method of calling mixins, use `+name` syntax (undefined line 19)
~/views/assignment/residentInProgressAssignmentList.jade
  ✖  line 13  Statements in code blocks must be valid JS
  ✖  line 19  Statements in code blocks must be valid JS
~/views/bio/biography.jade
  ⚠  line 13  Dont Use b Tags
~/views/layout/bootstrapLayout.jade
  ✖  line 2   HTML root requires a lang attribute
  ✖  line 51  Statements in code blocks must be valid JS
~/views/layout/bootstrapModalLayout.jade
  ✖  line 2  HTML root requires a lang attribute
~/views/layout/bootstrapPopoutLayout.jade
  ✖  line 2  HTML root requires a lang attribute
~/views/layout/layout.jade
  ✖  line 1  Only HTML doctypes are allowed
  ✖  line 2  HTML root requires a lang attribute
  ⚠  line 2  No xmlns attribute allowed
~/views/includes/breadcrumbs.jade
  ✖  line 7  Statements in code blocks must be valid JS
~/views/assessment/nolayout/assessment-mcq-full.jade
  ✖  line 7  Statements in code blocks must be valid JS
  ✖  line 9  Statements in code blocks must be valid JS
~/views/browser/faculty/assignments/assignmentTemplateDetail.jade
  ✖  line 56  Statements in code blocks must be valid JS
⚠  2 warnings
✖  12 errors

As you can see, half way into the output, the messages get useful. The output before that, however, is useless since there's no context.

rrdelaney commented 8 years ago

It might be a problem with the jade lexer or parser. I don't think those console.log's come from the linter.