New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-stylelint

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-stylelint - npm Package Compare versions

Comparing version 1.0.0-beta.0 to 1.0.0-beta.1

15

dist/index.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = gulpStylelint;
var _stylelint = require('stylelint');

@@ -53,3 +48,3 @@

*/
function gulpStylelint() {
module.exports = function gulpStylelint() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

@@ -82,6 +77,6 @@

// Remove the stylelint options that cannot be used:
delete lintOptions.files; // css code will be provided by gulp
delete lintOptions.files; // css code will be provided by gulp instead
delete lintOptions.formatter; // formatters are defined in the `reporters` option
// Remove gulp-stylelint options:
// Remove gulp-stylelint options so that they don't interfere with stylelint options:
delete lintOptions.reportOutputDir;

@@ -162,3 +157,3 @@ delete lintOptions.reporters;

return _through2.default.obj(onFile, onStreamEnd);
}
};

@@ -174,2 +169,2 @@ /**

*/
gulpStylelint.formatters = formatters;
module.exports.formatters = formatters;

@@ -74,2 +74,5 @@ 'use strict';

};
}
} /**
* Gulp stylelint reporter factory.
* @module gulp-stylelint/reporter-factory
*/

@@ -24,9 +24,11 @@ 'use strict';

var _promise2 = _interopRequireDefault(_promise);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var mkdir = _promise2.default.denodeify(_mkdirp2.default);
var writeFile = _promise2.default.denodeify(_fs2.default.writeFile);
var mkdir = (0, _promise.denodeify)(_mkdirp2.default); /**
* Gulp stylelint writer.
* @module gulp-stylelint/writer
*/
var writeFile = (0, _promise.denodeify)(_fs2.default.writeFile);
/**

@@ -33,0 +35,0 @@ * Creates the output folder and writes formatted text to a file.

{
"name": "gulp-stylelint",
"version": "1.0.0-beta.0",
"version": "1.0.0-beta.1",
"description": "Gulp plugin for running Stylelint results through various reporters.",

@@ -33,3 +33,3 @@ "main": "dist/index.js",

"promise": "^7.1.1",
"stylelint": "^5.0.1",
"stylelint": "^5.2.1",
"through2": "^2.0.1"

@@ -39,6 +39,6 @@ },

"babel-cli": "^6.6.5",
"babel-core": "^6.7.2",
"babel-core": "^6.7.4",
"babel-preset-es2015": "^6.3.13",
"babel-tape-runner": "^2.0.0",
"eslint": "^2.4.0",
"eslint": "^2.5.1",
"eslint-config-meetic": "^2.0.0",

@@ -45,0 +45,0 @@ "gulp": "^3.9.1",

@@ -22,7 +22,6 @@ # gulp-stylelint

```js
import gulp from 'gulp';
import gulpStylelint from 'gulp-stylelint';
import stylelintTextFormatter from 'stylelint-text-formatter';
gulp.task('lint-css', function lintCssTask() {
const gulp = require('gulp');
const gulpStylelint = require('gulp-stylelint');
gulp.task('lint-css', function lintCssTask() {
return gulp

@@ -38,8 +37,2 @@ .src('src/**/*.css')

Note that if you're using ES5, you will have to access the library via the `default` property due to [the way exports are handled in Babel 6](https://phabricator.babeljs.io/T2212):
```js
var gulpStylelint = require('gulp-stylelint').default;
```
## Formatters

@@ -59,7 +52,7 @@

```js
import gulp from 'gulp';
import gulpStylelint from 'gulp-stylelint';
import myStylelintFormatter from 'my-stylelint-formatters';
gulp.task('lint-css', function lintCssTask() {
const gulp = require('gulp');
const gulpStylelint = require('gulp-stylelint');
const myStylelintFormatter = require('my-stylelint-formatter');
gulp.task('lint-css', function lintCssTask() {
return gulp

@@ -94,12 +87,11 @@ .src('src/**/*.css')

{
// stylelint results formatter:
// stylelint results formatter (required):
// - pass a function for imported, custom or exposed formatters
// - pass a string ("string", "verbose", "json") for formatters
// bundled with stylelint by default
// - pass a string ("string", "verbose", "json") for formatters bundled with stylelint
formatter: myFormatter,
// save the formatted result to a file:
// save the formatted result to a file (optional):
save: 'text-report.txt',
// log the formatted result to console:
// log the formatted result to console (optional):
console: true

@@ -106,0 +98,0 @@ }

import path from 'path';
import gulp from 'gulp';
import test from 'tape';
import gulpStylelint from '../src/index';
import gulpStylelint from '../src';
/**

@@ -41,1 +40,10 @@ * Creates a full path to the fixtures glob.

});
test('should expose an object with stylelint formatter functions', t => {
t.plan(2);
t.equal(typeof gulpStylelint.formatters, 'object', 'formatters property is an object');
const formatters = Object
.keys(gulpStylelint.formatters)
.map(fName => gulpStylelint.formatters[fName]);
t.true(formatters.every(f => typeof f === 'function'), 'all formatters are functions');
});

@@ -8,7 +8,9 @@ /* eslint-disable no-sync */

import writer from '../src/writer';
import {stub} from 'sinon';
const tmpDir = path.resolve(__dirname, '../tmp');
test('writer should write to cwd if base dir is not specified', t => {
const cwd = process.cwd();
const reportDirPath = path.join(cwd);
const reportFilePath = path.join(reportDirPath, 'foo.txt');
stub(process, 'cwd').returns(tmpDir);
const reportFilePath = path.join(process.cwd(), 'foo.txt');

@@ -19,3 +21,3 @@ t.plan(2);

.then(() => {
t.ok(
t.true(
fs.statSync(reportFilePath).isFile(),

@@ -29,6 +31,6 @@ 'report file has been created in the current working directory'

);
fs.unlinkSync(reportFilePath);
})
.catch(e => {
t.fail(`failed to create report file: ${e.message}`);
.catch(e => t.fail(`failed to create report file: ${e.message}`))
.finally(() => {
process.cwd.restore();
fs.unlinkSync(reportFilePath);

@@ -39,4 +41,4 @@ });

test('writer should write to a base folder if it is specified', t => {
const cwd = process.cwd();
const reportDirPath = path.join(cwd, 'foodir');
stub(process, 'cwd').returns(tmpDir);
const reportDirPath = path.join(process.cwd(), 'foodir');
const reportFilePath = path.join(reportDirPath, 'foo.txt');

@@ -48,3 +50,3 @@

.then(() => {
t.ok(
t.true(
fs.statSync(reportFilePath).isFile(),

@@ -58,7 +60,6 @@ 'report file has been created in the specified base folder'

);
fs.unlinkSync(reportFilePath);
fs.rmdirSync(reportDirPath);
})
.catch(e => {
t.fail(`failed to create report file: ${e.message}`);
.catch(e => t.fail(`failed to create report file: ${e.message}`))
.finally(() => {
process.cwd.restore();
fs.unlinkSync(reportFilePath);

@@ -70,5 +71,4 @@ fs.rmdirSync(reportDirPath);

test('writer should strip chalk colors from formatted output', t => {
const cwd = process.cwd();
const reportDirPath = path.join(cwd);
const reportFilePath = path.join(reportDirPath, 'foo.txt');
stub(process, 'cwd').returns(tmpDir);
const reportFilePath = path.join(process.cwd(), 'foo.txt');

@@ -84,8 +84,8 @@ t.plan(1);

);
fs.unlinkSync(reportFilePath);
})
.catch(e => {
t.fail(`failed to create report file: ${e.message}`);
.catch(e => t.fail(`failed to create report file: ${e.message}`))
.finally(() => {
process.cwd.restore();
fs.unlinkSync(reportFilePath);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc