eslint-plugin-anti-trojan-source
Advanced tools
Comparing version 1.0.6 to 1.1.0
@@ -1,1 +0,1 @@ | ||
var u=Object.create;var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var f=t=>o(t,"__esModule",{value:!0});var l=(t,i,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of c(i))!m.call(t,r)&&r!=="default"&&o(t,r,{get:()=>i[r],enumerable:!(e=n(i,r))||e.enumerable});return t},h=t=>l(f(o(t!=null?u(d(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var a=h(require("anti-trojan-source"));function s(t){return{onCodePathStart:function(i,e){e.tokens&&Array.isArray(e.tokens)&&e.tokens.forEach(r=>{r.value&&(0,a.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'."})}),e.comments&&Array.isArray(e.comments)&&e.comments.forEach(r=>{r.value&&(0,a.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'."})})}}}module.exports={rules:{"no-bidi":{create:s}}}; | ||
var s=Object.create;var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var f=t=>o(t,"__esModule",{value:!0});var l=(t,i,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of c(i))!m.call(t,r)&&r!=="default"&&o(t,r,{get:()=>i[r],enumerable:!(e=u(i,r))||e.enumerable});return t},h=t=>l(f(o(t!=null?s(d(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var a=h(require("anti-trojan-source"));function n(t){return{onCodePathStart:function(i,e){e.tokens&&Array.isArray(e.tokens)&&e.tokens.forEach(r=>{r.value&&(0,a.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this code: '{{text}}'."})}),e.comments&&Array.isArray(e.comments)&&e.comments.forEach(r=>{r.value&&(0,a.hasTrojanSource)({sourceText:r.value})&&t.report({node:e,data:{text:r.value.toString("utf-8")},message:"Detected potential trojan source attack with unicode bidi introduced in this comment: '{{text}}'."})})}}}module.exports={rules:{"no-bidi":{create:n}},configs:{recommended:{plugins:["anti-trojan-source"],rules:{"anti-trojan-source/no-bidi":"error"}}}}; |
{ | ||
"name": "eslint-plugin-anti-trojan-source", | ||
"version": "1.0.6", | ||
"version": "1.1.0", | ||
"description": "ESLint plugin to detect and stop Trojan Source attacks", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -36,5 +36,19 @@ <p align="center"><h1 align="center"> | ||
## Usage example | ||
## Usage | ||
Once you've installed this plugin, add it to your eslint configuration as follows. | ||
### Recommended | ||
This plugin exports a `recommended` configuration. | ||
To enable this configuration, extend it in the configuration for your project. | ||
```json | ||
{ | ||
"extends": ["eslint:recommended", "plugin:anti-trojan-source/recommended"] | ||
} | ||
``` | ||
### Manual | ||
First, you need to define it as a plugin: | ||
@@ -41,0 +55,0 @@ |
@@ -9,2 +9,10 @@ import { noBidi } from "./rules/no-bidi"; | ||
}, | ||
configs: { | ||
recommended: { | ||
plugins: ['anti-trojan-source'], | ||
rules: { | ||
'anti-trojan-source/no-bidi': 'error', | ||
}, | ||
}, | ||
}, | ||
}; |
20730
69
100