fix: lint-staged and merge eslint-config-html (#2550)

This commit is contained in:
Matthieu MOREL
2021-12-11 11:12:14 +01:00
committed by GitHub
parent b7eb71e7d3
commit 67143b7bfd
5 changed files with 30 additions and 40 deletions

View File

@@ -14,7 +14,7 @@
"sourceType": "module" "sourceType": "module"
}, },
"extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:markdown/recommended", "plugin:prettier/recommended"], "extends": ["eslint:recommended", "plugin:jsdoc/recommended", "plugin:markdown/recommended", "plugin:prettier/recommended"],
"plugins": ["jest", "jsdoc", "prettier"], "plugins": ["html", "jest", "jsdoc", "prettier"],
"rules": { "rules": {
"no-prototype-builtins": 0, "no-prototype-builtins": 0,
"no-unused-vars": 0, "no-unused-vars": 0,

7
.gitignore vendored
View File

@@ -4,8 +4,7 @@ node_modules/
coverage/ coverage/
.idea/ .idea/
dist/*.js dist/
dist/*.map
yarn-error.log yarn-error.log
.npmrc .npmrc
@@ -13,10 +12,6 @@ token
package-lock.json package-lock.json
dist/classTest.html
dist/sequenceTest.html
.vscode/ .vscode/
cypress/platform/current.html cypress/platform/current.html
cypress/platform/experimental.html cypress/platform/experimental.html

View File

@@ -1,5 +1,5 @@
{ {
"*": [ "*.{js,html,md}": [
"yarn lint:fix" "yarn lint:fix"
] ]
} }

View File

@@ -46,8 +46,8 @@
<script src="./mermaid.js"></script> <script src="./mermaid.js"></script>
<script> <script>
mermaid.parseError = function (err, hash) { mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err); // console.error('Mermaid error: ', err);
}; };
mermaid.initialize({ mermaid.initialize({
theme: 'forest', theme: 'forest',
arrowMarkerAbsolute: true, arrowMarkerAbsolute: true,
@@ -58,11 +58,13 @@
}, },
flowchart: { flowchart: {
// defaultRenderer: 'dagre-wrapper', // defaultRenderer: 'dagre-wrapper',
nodeSpacing: 10, curve: 'cardinal', htmlLabels: true nodeSpacing: 10,
curve: 'cardinal',
htmlLabels: true,
}, },
htmlLabels: true, htmlLabels: true,
// gantt: { axisFormat: '%m/%d/%Y' }, // gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorFontFamily: 'courier',actorMargin: 50, showSequenceNumbers: false }, sequence: { actorFontFamily: 'courier', actorMargin: 50, showSequenceNumbers: false },
// sequenceDiagram: { actorMargin: 300 } // deprecated // sequenceDiagram: { actorMargin: 300 } // deprecated
// fontFamily: '"times", sans-serif', // fontFamily: '"times", sans-serif',
// fontFamily: 'courier', // fontFamily: 'courier',
@@ -70,34 +72,36 @@
curve: 'basis', curve: 'basis',
securityLevel: 'antiscript', securityLevel: 'antiscript',
startOnLoad: false, startOnLoad: false,
secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'] secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
// themeVariables: {relationLabelColor: 'red'} // themeVariables: {relationLabelColor: 'red'}
}); });
function callback(){alert('It worked');} function callback() {
function xssAttack(){ alert('It worked');
const div = document.createElement('div') }
div.id = 'the-malware' function xssAttack() {
div.className = 'malware' const div = document.createElement('div');
div.innerHTML = 'XSS Succeeded' div.id = 'the-malware';
div.className = 'malware';
div.innerHTML = 'XSS Succeeded';
document.getElementsByTagName('body')[0].appendChild(div); document.getElementsByTagName('body')[0].appendChild(div);
throw new Error('XSS Succeded'); throw new Error('XSS Succeded');
} }
var diagram = "classDiagram\n" var diagram = 'classDiagram\n';
diagram += "classA <-- classB : <ifr"; diagram += 'classA <-- classB : <ifr';
diagram += "ame/srcdoc='<scr"; diagram += "ame/srcdoc='<scr";
diagram += "ipt>parent.xssAttack(`XSS`)</"; diagram += 'ipt>parent.xssAttack(`XSS`)</';
diagram += "script>'>"; diagram += "script>'>";
// var diagram = "stateDiagram-v2\n"; // var diagram = "stateDiagram-v2\n";
// diagram += "<img/src='1'/onerror" // diagram += "<img/src='1'/onerror"
// diagram += "=xssAttack()> --> B"; // diagram += "=xssAttack()> --> B";
console.log(diagram); console.log(diagram);
// document.querySelector('#diagram').innerHTML = diagram; // document.querySelector('#diagram').innerHTML = diagram;
mermaid.render('diagram', diagram, (res) => { mermaid.render('diagram', diagram, (res) => {
console.log(res); console.log(res);
document.querySelector('#res').innerHTML = res; document.querySelector('#res').innerHTML = res;
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@@ -5150,15 +5150,6 @@ espree@^9.2.0:
acorn-jsx "^5.3.1" acorn-jsx "^5.3.1"
eslint-visitor-keys "^3.1.0" eslint-visitor-keys "^3.1.0"
espree@^9.1.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-9.2.0.tgz#c50814e01611c2d0f8bd4daa83c369eabba80dbc"
integrity sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==
dependencies:
acorn "^8.6.0"
acorn-jsx "^5.3.1"
eslint-visitor-keys "^3.1.0"
esprima@1.1.x, esprima@~1.1.1: esprima@1.1.x, esprima@~1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549" resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549"