1
0
Fork 0
mirror of https://github.com/sexybiggetje/pixdisp.git synced 2024-11-21 17:21:01 +01:00

Add eslint-plugin-security and config

This commit is contained in:
Martijn de Boer 2018-01-07 09:41:17 +01:00
parent 38d395d587
commit 740995190e
4 changed files with 40 additions and 8 deletions

View file

@ -3,7 +3,13 @@
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"plugins": [
"security"
],
"extends": [
"eslint:recommended",
"plugin:security/recommended"
],
"parserOptions": {
"sourceType": "module"
},
@ -25,6 +31,8 @@
"always"
],
"no-case-declarations": "off",
"no-console": "off"
"no-console": "off",
"security/detect-new-buffer": "off",
"security/detect-object-injection": "off"
}
}

View file

@ -9,16 +9,15 @@ class PimoroniUnicorn extends Driver {
super();
this.spi = false;
this.spiPath = '/dev/spidev0.0';
}
write( buffer ) {
if ( this.spi === false) {
if ( fs.existsSync( this.spiPath ) ) {
if ( fs.existsSync( '/dev/spidev0.0' ) ) {
let SPI = require( 'pi-spi' );
this.spi = SPI.initialize( this.spiPath );
this.spi = SPI.initialize( '/dev/spidev0.0' );
} else {
console.warn( 'Device path ' + this.spiPath + ' was unavailable.' );
console.warn( 'Device path \'/dev/spidev0.0\' was unavailable.' );
return;
}
}

28
package-lock.json generated
View file

@ -1027,6 +1027,15 @@
}
}
},
"eslint-plugin-security": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-security/-/eslint-plugin-security-1.4.0.tgz",
"integrity": "sha512-xlS7P2PLMXeqfhyf3NpqbvbnW04kN8M9NtmhpR3XGyOvt/vNKS7XPXT5EDbwKW9vCjWH4PpfQvgD/+JgN0VJKA==",
"dev": true,
"requires": {
"safe-regex": "1.1.0"
}
},
"eslint-scope": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz",
@ -1506,7 +1515,7 @@
}
},
"debug": {
"version": "2.6.9",
"version": "2.6.8",
"bundled": true,
"dev": true,
"optional": true,
@ -2146,7 +2155,7 @@
"dev": true,
"optional": true,
"requires": {
"debug": "2.6.9",
"debug": "2.6.8",
"fstream": "1.0.11",
"fstream-ignore": "1.0.5",
"once": "1.4.0",
@ -4831,6 +4840,12 @@
"signal-exit": "3.0.2"
}
},
"ret": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
"dev": true
},
"right-align": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
@ -4880,6 +4895,15 @@
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
"dev": true
},
"safe-regex": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true,
"requires": {
"ret": "0.1.15"
}
},
"sane": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/sane/-/sane-2.2.0.tgz",

View file

@ -12,6 +12,7 @@
},
"devDependencies": {
"eslint": "^4.15.0",
"eslint-plugin-security": "^1.4.0",
"jest": "^22.0.4"
},
"scripts": {