Skip to content

Commit

Permalink
chore(lint): switch to semistandard
Browse files Browse the repository at this point in the history
  • Loading branch information
JaKXz committed Jan 12, 2017
1 parent f823745 commit 4d55fb4
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 621 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@
[![npm version](https://badge.fury.io/js/stylelint-webpack-plugin.svg)](https://badge.fury.io/js/stylelint-webpack-plugin)
[![Build Status](https://travis-ci.org/JaKXz/stylelint-webpack-plugin.svg?branch=master)](https://travis-ci.org/JaKXz/stylelint-webpack-plugin)
[![Coverage Status](https://coveralls.io/repos/github/JaKXz/stylelint-webpack-plugin/badge.svg?branch=master)](https://coveralls.io/github/JaKXz/stylelint-webpack-plugin?branch=master)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-red.svg)](https://github.com/Flet/semistandard)
[![Gitter](https://badges.gitter.im/stylelint-webpack-plugin/Lobby.svg)](https://gitter.im/stylelint-webpack-plugin/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

> ## Why you might want to use this plugin instead of [stylelint-loader](https://github.com/adrianhall/stylelint-loader)
Expand Down
6 changes: 3 additions & 3 deletions index.js
Expand Up @@ -9,7 +9,7 @@ var formatter = require('stylelint').formatters.string;
// Modules
var runCompilation = require('./lib/run-compilation');

function apply(options, compiler) {
function apply (options, compiler) {
options = options || {};
var context = options.context || compiler.context;

Expand All @@ -28,7 +28,7 @@ function apply(options, compiler) {
var runner = runCompilation.bind(this, options);

compiler.plugin('run', runner);
compiler.plugin('watch-run', function onWatchRun(watcher, callback) {
compiler.plugin('watch-run', function onWatchRun (watcher, callback) {
runner(watcher.compiler, callback);
});
}
Expand All @@ -39,7 +39,7 @@ function apply(options, compiler) {
* @param options - from webpack config, see defaults in `apply` function.
* @return {Object} the bound apply function
*/
module.exports = function stylelintWebpackPlugin(options) {
module.exports = function stylelintWebpackPlugin (options) {
return {
apply: apply.bind(this, options)
};
Expand Down
2 changes: 1 addition & 1 deletion lib/linter.js
Expand Up @@ -3,7 +3,7 @@
// Dependencies
var stylelint = require('stylelint');

function lint(options) {
function lint (options) {
return stylelint.lint(options);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/run-compilation.js
Expand Up @@ -10,12 +10,12 @@ var linter = require('./linter');
* @param compiler - the compiler object
* @param done - webpack callback
*/
module.exports = function runCompilation(options, compiler, done) {
module.exports = function runCompilation (options, compiler, done) {
var errors = [];
var warnings = [];

linter(options)
.then(function linterSuccess(lint) {
.then(function linterSuccess (lint) {
var results = lint.results;

warnings = results.filter(function (file) {
Expand All @@ -38,7 +38,7 @@ module.exports = function runCompilation(options, compiler, done) {
})
.catch(done);

compiler.plugin('compilation', function onCompilation(compilation) {
compiler.plugin('compilation', function onCompilation (compilation) {
if (warnings.length) {
compilation.warnings.push(chalk.yellow(options.formatter(warnings)));
warnings = [];
Expand Down
12 changes: 3 additions & 9 deletions package.json
Expand Up @@ -45,10 +45,10 @@
"mocha": "^3.1.0",
"npm-install-version": "^6.0.1",
"nyc": "^10.0.0",
"xo": "^0.16.0"
"semistandard": "^9.2.1"
},
"scripts": {
"pretest": "xo",
"pretest": "semistandard",
"test:webpack1": "WEBPACK_VERSION=1 nyc mocha",
"test:webpack2": "WEBPACK_VERSION=beta nyc mocha",
"test": "npm run test:webpack1 && npm run test:webpack2",
Expand All @@ -61,8 +61,7 @@
"text-summary"
]
},
"xo": {
"space": true,
"semistandard": {
"envs": [
"node",
"mocha"
Expand All @@ -71,10 +70,5 @@
"getPath",
"expect"
]
},
"greenkeeper": {
"ignore": [
"xo"
]
}
}
2 changes: 1 addition & 1 deletion test/helpers/pack.js
Expand Up @@ -8,7 +8,7 @@ var webpack = require('./webpack');
* @param testConfig - the plugin config being tested run through the webpack compiler
* @return {Promise} - rejects with both stats and the error if needed
*/
module.exports = function pack(testConfig) {
module.exports = function pack (testConfig) {
return new Promise(function (resolve, reject) {
var compiler = webpack(testConfig);
compiler.outputFileSystem = new MemoryFileSystem();
Expand Down

0 comments on commit 4d55fb4

Please sign in to comment.