sasstools / sass-lint

Pure Node.js Sass linting
MIT License
1.77k stars 533 forks source link

Make formatters pluggable / Add formatter for VSO (aka TFS, VSTS) #735

Open mattbrooks2010 opened 8 years ago

mattbrooks2010 commented 8 years ago

FEATURE REQUEST

Add a new formatter to support VSO / TFS integration.

PROPOSED SOLUTION

Implement a new 'VSO' formatter, either built-in or as a plugin. Both options require changes to the way sass-lint is currently implemented (see status below).

The solution would be to emit VSO logging commands, which are similar to TeamCity service messages.

STATUS

Blocked because formatters are loaded directly from ESLint Core. The ESLint team are no longer adding new formatters to ESLint Core.

Please see https://github.com/eslint/eslint/issues/6262.

DanPurdy commented 8 years ago

Thanks @mattbrooks2010 I'm not sure why they were directly using the eslint ones, I think it was a stop gap to get support for formatters before and it's just never been updated since I've been on board 😕 You're right though this definitely needs rectifying soon.

WIll look into it.

mattbrooks2010 commented 7 years ago

The ESLint team are no longer adding new formatters directly to ESLint Core.

It may therefore be worth making a simple change to sassLint.format to:

  1. Retain support for existing ESLint formatters and existing user configurations, at least in the short term.
  2. Allow additional formatters to be developed as standalone packages and used in an intuitive manner.

My suggestion is to hardcode the names of the 14 existing ESLint formatters to support (1) above and establish a new convention for referencing formatter packages for (2). This new convention would only be invoked / applied if the requested formatter name didn't match one of the 14 ESLint formatters for (1).

A couple of alternatives for (2) based on the existing code would be:

// Load formatter packages using formatter name directly
var formatted = require(config.options.formatter);
return formatted(results);

// Load formatter packages by applying a convention to the formatter name
var formatted = require(`sass-lint-formatter-${config.options.formatter}`);
return formatted(results);

// Load formatter packages by applying an alternative convention
var formatted = require(`sass-lint-${config.options.formatter}`);
return formatted(results);

Thoughts?

webdevnerdstuff commented 6 years ago

I would be really psyched if we could get the scss-lint formatter onto sass-lint.

Personally I find the ESLint formatters to be extremely lacking in this area. You would think they would at least change the color of the file name to make it easier to pick it out from all of the other mundane white text everywhere. When you are dealing with many SCSS and JS files all being linted on large projects it makes using linters in the CLI a major step down. It's painful when "upgrades" seem lack the good stuff from past implementations.