postcss / postcss-bem-linter

A BEM linter for postcss
MIT License
572 stars 35 forks source link

Postcss 4.1 #36

Closed davidtheclark closed 9 years ago

davidtheclark commented 9 years ago

Address #32. Upgrades to PostCSS 4.1, which involves

Most of the work was in rewriting tests so they worked with async. Then changing error throwing to warning registering.

I made the plugin postcss-log-warnings so that this plugin could just register warnings and then that one would log them to the console. Take a look at it and see what you think.

Here's a simple example of using the log-warnings plugin. You can make a JS file with this content and put it in the base directory of bem-linter and run it to see what the console warnings look like.

var postcss = require('postcss');
var logWarnings = require('postcss-log-warnings');
var linter = require('./index');
var fs = require('fs');

var css = fs.readFileSync('test/fixtures/bem-valid.css', 'utf8');

postcss()
  .use(linter())
  .use(logWarnings())
  .process(css, { from: 'test/fixtures/bem-valid.css' })
  .then(function(result) {
    console.log('finished');
  });

I also updated a couple of dependencies.