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

gulp-rb-validate-html

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-rb-validate-html - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

31

index.js

@@ -20,2 +20,8 @@ /*jslint node: true*/

mistake = mistake.substr(mistake.search(/\S|$/));
if (mistake.length > 80) {
mistake = mistake.substr(0, 80) + "...";
} else if (mistake.length === 0) {
mistake = '[whitespace only]';
}
}

@@ -100,4 +106,4 @@

// Img alt
else if (name === "img" && (!attribs.alt || attribs.alt === "")) {
validationError("Missing or empty ALT tag", '<' + name + '>', 'CI-FE-2006', true);
else if (name === "img" && !attribs.alt) {
validationError("Missing or empty ALT tag", '<' + name + ' src="' + attribs.src + '">', 'CI-FE-2006', true);
}

@@ -109,9 +115,9 @@ // Iframes

if (!isLowerCase(name)) {
validationError('All elements have to be lower case', '<' + name + '>', 'CI-FE-2001', false);
validationError('All elements have to be lower case', '<' + name + '>', 'CI-FE-2001', true);
}
if (attribs.type === "text/javascript") {
validationError('Script type="text/javascript" is superfluous', '<' + name + ' type="' + attribs.type + '" ...>', 'CI-FE-2007', true);
validationError('type="text/javascript" is superfluous', '<' + name + ' type="' + attribs.type + '" ...>', 'CI-FE-2007', true);
} else if (attribs.type === "text/css") {
validationError('Stylesheet type="text/css" is superfluous', '<' + name + ' type="' + attribs.type + '" ...>', 'CI-FE-2007', true);
validationError('type="text/css" is superfluous', '<' + name + ' type="' + attribs.type + '" ...>', 'CI-FE-2007', true);
}

@@ -144,4 +150,2 @@

var found = false,
correct = true,
parser = new htmlparser.Parser({

@@ -151,10 +155,11 @@ onopentag: function (name, attribs) {

if (name === "meta" && attribs.name === "viewport") {
found = true;
var nospace = attribs.content.replace(/\s/g, "");
if (!attribs.content.includes('user-scalable=no') || !attribs.content.includes('width=device-width') || !attribs.content.includes('initial-scale=1') || !attribs.content.includes('maximum-scale=1')) {
correct = false;
if (!nospace.includes('user-scalable=no') || !nospace.includes('width=device-width') || !nospace.includes('initial-scale=1') || !nospace.includes('maximum-scale=1')) {
validationError('Viewport tag is incorrect', attribs.content, 'CI-FE-2004', false);
}
}
}
}, {

@@ -168,4 +173,2 @@ decodeEntities: true

validationError('Viewport tag is missing', '<head>', 'CI-FE-2004', false);
} else if (!correct) {
validationError('Viewport tag is incorrect', '<head>', 'CI-FE-2004', false);
}

@@ -206,3 +209,3 @@ }

if (area.length > 0) {
validationError('Wrong indentation (line ' + count + ')', line.substr(pos), 'CI-FE-2001', false);
validationError('Wrong indentation on line ' + count, line, 'CI-FE-2001', false);
}

@@ -270,3 +273,3 @@ }

if (str.includes('<head>') && !str.includes('charset="utf-8"') && !str.includes('charset=utf-8')) {
validationError('Encoding', 'Undefined or wrong encoding, must be <meta charset="utf-8" />', 'CI-FE-2002', true);
validationError('Encoding', 'Undefined or wrong encoding, must be: charset="utf-8"', 'CI-FE-2002', true);
}

@@ -273,0 +276,0 @@

{
"name": "gulp-rb-validate-html",
"version": "0.0.1",
"description": "Gulp plugin to validate HTML files",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/rbcibd/gulp-rb-validate-html.git"
},
"keywords": [
"name": "gulp-rb-validate-html",
"version": "0.0.2",
"description": "Gulp plugin to check HTML files according to web frontend guidelines",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/rbcibd/gulp-rb-validate-html.git"
},
"keywords": [
"gulp",
"bosch"
],
"author": "Diana Salsa",
"license": "LicenseRef-LICENSE",
"dependencies": {
"fs": "0.0.2",
"gulp": "^3.9.0",
"gulp-util": "^3.0.6",
"htmlparser2": "^3.9.1",
"through2": "^2.0.0"
}
"author": "Diana Salsa",
"license": "LicenseRef-LICENSE",
"dependencies": {
"fs": "0.0.2",
"gulp": "^3.9.0",
"gulp-util": "^3.0.6",
"htmlparser2": "^3.9.1",
"through2": "^2.0.0"
}
}

@@ -5,17 +5,43 @@ #Installation

`npm install --save-dev gulp-rb-validate-html`
`npm install gulp-rb-validate-html --save-dev`
#Usage
#### Basic
```js
var rbhtml = require('gulp-rb-validate-html');
gulp.task('rb-validate', function ()
gulp.task('rb-validate', function () {
gulp.src('./src/**/*.html')
.pipe(rbhtml());
});
```
#### With Parameter
```js
var rbhtml = require('gulp-rb-validate-html');
gulp.task('rb-validate', function () {
gulp.src('./src/**/*.html')
.pipe(rbhtml({
abortOnError: true,
indent: '\t',
checkremote: false,
checkviewport: false
});
});
```
#Parameters
#### abortOnError: Boolean (Default: false)
This will cause the plugin to abort with exit code 1 as soon as an invalid file is detected.
#### indent: String (Default: 4 spaces)

@@ -35,10 +61,2 @@

Set to false if the application is not responsive/for mobile devices
#### abortOnError: Boolean (Default: false)
This will cause the plugin to abort with exit code 1 as soon as an invalid file is detected.
#License
Copyright (c) 2016 Robert Bosch GmbH. All Rights reserved
Set to false if the application is not responsive/for mobile devices
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