Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

access-sniff

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

access-sniff - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

23

dist/accesssniff.js

@@ -60,3 +60,3 @@ 'use strict';

this.basepath = process.cwd();
this.failTask = 0;
this.errorCount = 0;
this.log = '';

@@ -137,3 +137,3 @@ this.fileContents = '';

if (message && message.heading === 'ERROR') {
this.failTask += 1;
this.errorCount += 1;
}

@@ -269,2 +269,4 @@

value: function run(filesInput) {
var _this3 = this;
var files = _bluebird2.default.resolve(filesInput);

@@ -280,5 +282,16 @@

return logs;
}).catch(function (err) {
_logger2.default.generalError('There was an error', err);
return err;
}).then(function (data) {
if (!_this3.options.force && _this3.errorCount) {
var errorMessage = 'There was ' + _this3.errorCount + ' error';
if (_this3.errorCount > 1) {
errorMessage = 'There was ' + _this3.errorCount + ' errors';
}
_logger2.default.generalError(errorMessage);
return _bluebird2.default.reject(errorMessage);
}
return data;
});

@@ -285,0 +298,0 @@ }

@@ -18,2 +18,4 @@ 'use strict';

/*eslint-disable no-console */
exports.default = function (fileInput) {

@@ -33,11 +35,7 @@ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

// if (!reportFiles.length) {}
var task = new _accesssniff2.default(options);
return task.run(reportFiles).then(function (data) {
return data;
});
return task.run(reportFiles);
};
exports.report = _reports2.default;

@@ -77,3 +77,3 @@ 'use strict';

return error;
return _chalk2.default.red(error);
};

@@ -80,0 +80,0 @@

@@ -66,3 +66,3 @@ import gulp from 'gulp';

}))
.pipe(istanbul.enforceThresholds({ thresholds: { global: 80 } }))
.pipe(istanbul.enforceThresholds({ thresholds: { global: 75 } }))
);

@@ -69,0 +69,0 @@

{
"name": "access-sniff",
"version": "2.2.1",
"version": "2.3.0",
"description": "A node/iojs library & CLI for HTML_Codesniffer",

@@ -15,5 +15,5 @@ "main": "dist/",

"type": "git",
"url": "https://yargalot@github.com/yargalot/AccessSniff.git"
"url": "git+https://yargalot@github.com/yargalot/AccessSniff.git"
},
"author": "",
"author": "Steven John Miller (http://www.stevenjohnmiller.com/)",
"license": "ISC",

@@ -31,2 +31,13 @@ "bugs": {

],
"dependencies": {
"HTML_CodeSniffer": "github:squizlabs/HTML_CodeSniffer#2.0.6",
"axios": "^0.8.1",
"bluebird": "^2.9.13",
"chalk": "^1.1.1",
"commander": "^2.6.0",
"mkdirp": "^0.5.1",
"phantomjs-prebuilt": "^2.1.4",
"underscore": "^1.8.2",
"validator": "^3.39.0"
},
"devDependencies": {

@@ -47,14 +58,3 @@ "babel-core": "^6.3.26",

"run-sequence": "^1.1.5"
},
"dependencies": {
"HTML_CodeSniffer": "squizlabs/HTML_CodeSniffer.git#2.0.6",
"axios": "^0.8.1",
"bluebird": "^2.9.13",
"chalk": "^1.1.1",
"commander": "^2.6.0",
"mkdirp": "^0.5.1",
"phantomjs-prebuilt": "^2.1.4",
"underscore": "^1.8.2",
"validator": "^3.39.0"
}
}

@@ -12,16 +12,27 @@ # AccessSniff

## Getting Started
Install this plugin with `npm install access-sniff` then use it in your project with
Install this plugin with `npm install access-sniff --save`
```javascript
const AccessSniff = require('access-sniff');
const files = ['**/*.html'];
### ES5
```js
var AccessSniff = require('access-sniff');
AccessSniff
.default(files, options)
.then(report => AccessSniff.report(report, reportOptions))
.default(['**/*.html'], options)
.then(function(report) {
AccessSniff.report(report, reportOptions);
});
```
or install the module globally and type
### ES6
```js
import AccessSniff, { reports as AccessReports } from 'access-sniff';
AccessSniff(['**/*.html'], options)
.then(report => AccessReports(report, reportOptions));
```
### CLI
```
npm install access-sniff -g
sniff test/**/*.html -r json -l reports

@@ -41,5 +52,5 @@ ```

```accessibilityLevel``` is a string
`accessibilityLevel` is a string
```javascript
```js
options: {

@@ -50,10 +61,10 @@ accessibilityLevel: 'WCAG2A'

Levels are ```WCAG2A```, ```WCAG2AA```, and ```WCAG2AAA```
Levels are `WCAG2A`, `WCAG2AA`, and `WCAG2AAA`
### Accessibilityrc
```accessibilityrc``` is a boolean
`accessibilityrc` is a boolean
```javascript
```js
options: {

@@ -66,7 +77,7 @@ accessibilityrc: true

```javascript
```json
{
"ignore": [
"WCAG2A.Principle2.Guideline2_4.2_4_2.H25.1.NoTitleEl",
"WCAG2A.Principle3.Guideline3_1.3_1_1.H57.2"
"WCAG2A.Principle2.Guideline2_4.2_4_2.H25.1.NoTitleEl",
"WCAG2A.Principle3.Guideline3_1.3_1_1.H57.2"
]

@@ -79,9 +90,9 @@ }

```ignore``` is a array
`ignore` is an array
You can ignore rules by placing them in an array outlined below
```javascript
```js
options: {
ignore : [
ignore: [
'WCAG2A.Principle2.Guideline2_4.2_4_2.H25.1.NoTitleEl'

@@ -95,5 +106,5 @@ 'WCAG2A.Principle3.Guideline3_1.3_1_1.H57.2'

```verbose``` is a boolean
`verbose` is a boolean
```javascript
```js
options: {

@@ -109,5 +120,5 @@ verbose: false

``` domElement ``` is a boolean
`domElement` is a boolean
```javascript
```js
options: {

@@ -118,9 +129,9 @@ domElement: false

Include reference (tag name, class names & id) to reported elements. Optional for both output formats.
Include reference (tag name, class names & id) to reported elements. Optional for both output formats.
### Force
```force``` is a boolean
`force` is a boolean, defaults to `false`
```javascript
```js
options: {

@@ -131,3 +142,9 @@ force: true

Continue running grunt in the event of failures
Continue running in the event of failures.
You can catch failures from the promise as below:
```
AccessSniff(['**/*.html'], options)
.then(report => AccessReports(report, reportOptions));
.catch(error => console.error(error))
```

@@ -144,3 +161,3 @@ ## Reports

You can use the inbuilt system or create your own
```javascript
```js
AccessSniff.report(report, reportOptions)

@@ -151,4 +168,4 @@ ```

```reportType``` is a string
```javascript
`reportType` is a string
```js
options: {

@@ -161,13 +178,13 @@ reportType: 'json'

- 'txt' will output text files
- 'json' will output .json files
- 'csv' will output csv
- `txt` will output text files
- `json` will output .json files
- `csv` will output csv
### Report Location
```reportLocation``` is a string
`reportLocation` is a string
```javascript
```js
options: {
reportLocation : 'reports'
reportLocation: 'reports'
}

@@ -180,5 +197,5 @@ ```

`reportLevels` is a object
`reportLevels` is an object
```javascript
```js
options: {

@@ -193,3 +210,3 @@ reportLevels: {

Set a value to ```false``` to limit output
Set a value to `false` to limit output

@@ -196,0 +213,0 @@ ## CLI

@@ -22,4 +22,4 @@ /*

this.basepath = process.cwd();
this.failTask = 0;
this.log = '';
this.errorCount = 0;
this.log = '';
this.fileContents = '';

@@ -97,3 +97,3 @@

if (message && message.heading === 'ERROR') {
this.failTask += 1;
this.errorCount += 1;
}

@@ -239,5 +239,16 @@

})
.catch(err => {
logger.generalError('There was an error', err);
return err;
.then(data => {
if (!this.options.force && this.errorCount) {
let errorMessage = `There was ${this.errorCount} error`;
if (this.errorCount > 1) {
errorMessage = `There was ${this.errorCount} errors`;
}
logger.generalError(errorMessage);
return Promise.reject(errorMessage);
}
return data;
});

@@ -244,0 +255,0 @@ }

@@ -0,1 +1,2 @@

/*eslint-disable no-console */
import Accessibility from './accesssniff';

@@ -16,12 +17,8 @@ import reporter from './reports';

// if (!reportFiles.length) {}
const task = new Accessibility(options);
return task
.run(reportFiles)
.then(data => data);
.run(reportFiles);
};
export {reporter as report};

@@ -82,3 +82,3 @@ /* @flow */

return error;
return chalk.red(error);
};

@@ -85,0 +85,0 @@

@@ -32,3 +32,3 @@ var AccessSniff = require('../dist');

AccessSniff.default(target)
AccessSniff.default(target, {force: true})
.then(report => {

@@ -44,3 +44,3 @@ test.deepEqual(report[target], JSON.parse(expected), 'Should produce a json report for test.html');

AccessSniff.default([target], {})
AccessSniff.default([target], {force: true})
.then(report => {

@@ -55,3 +55,3 @@ test.ok(report[target], 'Should produce a json report from boostrap');

AccessSniff.default([testString], {})
AccessSniff.default([testString], {force: true})
.then(report => {

@@ -58,0 +58,0 @@ test.ok(report[testString], 'Should produce a json report for html string');

@@ -78,3 +78,3 @@ var logger = require('../dist/logger').default;

const message = logger.generalError('Error message');
test.equal(message, 'Error message');
test.equal(message, '\u001b[31mError message\u001b[39m');

@@ -81,0 +81,0 @@ test.expect(1);

@@ -29,3 +29,3 @@ var AccessSniff = require('../dist');

report_JSON: test => {
AccessSniff.default(['./test/examples/test.html'], {location: 'reports'})
AccessSniff.default(['./test/examples/test.html'], {location: 'reports', force: true})
.then(report => AccessSniff.report(report))

@@ -44,4 +44,4 @@ .then(report => {

report_CSV: test => {
AccessSniff.default(['./test/examples/test.html'], {})
.then(report => AccessSniff.report(report, {location: 'reports', reportType: 'csv'}))
AccessSniff.default(['./test/examples/test.html'], {force: true})
.then(report => AccessSniff.report(report, {location: 'reports', reportType: 'csv', force: true}))
.then(report => {

@@ -59,4 +59,4 @@ var writtenReport = fs.readFileSync('./reports/report.csv', 'utf8');

report_TXT: test => {
AccessSniff.default(['./test/examples/test.html'], {})
.then(report => AccessSniff.report(report, {location: 'reports', reportType: 'txt'}))
AccessSniff.default(['./test/examples/test.html'], {force: true})
.then(report => AccessSniff.report(report, {location: 'reports', reportType: 'txt', force: true}))
.then(report => {

@@ -63,0 +63,0 @@ var writtenReport = fs.readFileSync('./reports/report.txt', 'utf8');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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