feat: Add lint to normalize file syntaxe

This commit is contained in:
Simon 2023-05-17 16:44:21 +02:00
parent 05e9a05c5e
commit dc3dbb9f64
9 changed files with 3430 additions and 67 deletions

11
.editorconfig Normal file
View File

@ -0,0 +1,11 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

1
.eslintignore Normal file
View File

@ -0,0 +1 @@
node_modules

30
.eslintrc.json Normal file
View File

@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"bootstrap": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-console": 0,
"quotes": ["error", "single"],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}
]
}
}

1
.stylelintignore Normal file
View File

@ -0,0 +1 @@
node_modules

47
.stylelintrc.json Normal file
View File

@ -0,0 +1,47 @@
{
"extends": "stylelint-config-standard-scss",
"rules": {
"no-empty-source": null,
"scss/comment-no-empty": null,
"max-line-length": null,
"scss/at-extend-no-missing-placeholder": null,
"scss/dollar-variable-colon-space-after": null,
"scss/dollar-variable-empty-line-before": null,
"color-function-notation": null,
"alpha-value-notation": null,
"selector-id-pattern": null,
"selector-class-pattern": null,
"scss/no-global-function-names": null,
"number-max-precision": null,
"hue-degree-notation": null,
"value-no-vendor-prefix": null,
"property-no-vendor-prefix": null,
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"extend",
"at-root",
"debug",
"warn",
"error",
"if",
"else",
"for",
"each",
"while",
"mixin",
"include",
"content",
"return",
"function",
"tailwind",
"apply",
"responsive",
"variants",
"screen"
]
}
]
}
}

View File

@ -1,7 +1,7 @@
const pdfFileField = document.getElementById("pdfFile")
const pdfModal = document.getElementById("pdfModal")
const pdfModalLabel = document.getElementById("pdfModalLabel")
const pdfModalContent = document.getElementById("pdfModalContent")
const pdfFileField = document.getElementById('pdfFile')
const pdfModal = document.getElementById('pdfModal')
const pdfModalLabel = document.getElementById('pdfModalLabel')
const pdfModalContent = document.getElementById('pdfModalContent')
// FILE
@ -10,11 +10,11 @@ function pdfFileGetName() {
}
function pdfFileClear() {
pdfFileField.value = ""
pdfFileField.value = ''
}
async function pdfFileToBlob() {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
const fr = new FileReader()
const file = pdfFileField.files[0]
fr.readAsArrayBuffer(file)
@ -30,12 +30,12 @@ async function pdfFileToBlob() {
function pdfModalShow() {
pdfModalLabelUpdate();
pdfModalContentclear()
new bootstrap.Modal("#pdfModal").show()
new bootstrap.Modal('#pdfModal').show()
pdfModalContentLoad()
}
function pdfModalContentclear() {
pdfModalContent.innerHTML = ""
pdfModalContent.innerHTML = ''
}
async function pdfModalContentLoad() {
@ -69,7 +69,7 @@ async function pdfModalContentLoad() {
// Render PDF page into canvas context
var renderContext = {
canvasContext: context,
viewport: viewport
viewport: viewport,
};
var renderTask = page.render(renderContext);
renderTask.promise.then(function () {
@ -92,11 +92,11 @@ function pdfModalLabelUpdate() {
// START
async function start() {
pdfFileField.addEventListener('change', async function(event) {
pdfFileField.addEventListener('change', async function() {
pdfModalShow()
})
pdfModal.addEventListener('hidden.bs.modal', event => {
pdfModal.addEventListener('hidden.bs.modal', () => {
pdfFileClear()
})

View File

@ -48,6 +48,7 @@ body {
color: #fff;
border-bottom-color: #fff;
}
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
@ -56,7 +57,7 @@ body {
user-select: none;
}
@media (min-width: 768px) {
@media (width <= 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
@ -78,7 +79,7 @@ body {
.bi {
vertical-align: -.125em;
fill: currentColor;
fill: currentcolor;
}
.nav-scroller {

3359
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,19 +5,32 @@
"author": "Weko",
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prebuild": "npm run clean",
"build": "node_modules/.bin/hugo/hugo --gc --minify",
"clean": "rm -rf public resources",
"lint": "npm run -s lint:scripts && npm run -s lint:styles",
"lint:scripts": "eslint assets/scripts",
"lint:styles": "stylelint \"assets/styles/**/*.{css,sass,scss,sss,less}\"",
"postinstall": "hugo-installer --version otherDependencies.hugo --extended --destination node_modules/.bin/hugo"
},
"dependencies": {
"devDependencies": {
"@fullhuman/postcss-purgecss": "^5.0.0",
"autoprefixer": "^10.4.14",
"bootstrap": "^5.2.3",
"bootstrap-icons": "^1.10.5",
"cssnano": "^6.0.1",
"cssnano-preset-advanced": "^6.0.1",
"esbuild": "^0.17.19",
"eslint": "^8.40.0",
"hugo-installer": "^4.0.1",
"pdfjs-dist": "^3.6.172",
"postcss": "^8.4.23",
"postcss-cli": "^10.1.0"
"postcss-cli": "^10.1.0",
"stylelint": "^15.6.2",
"stylelint-config-standard-scss": "^9.0.0"
},
"otherDependencies": {
"hugo": "0.111.3"
},
"comments": {
"dependencies": {