updated sorting system and added linting

This commit is contained in:
mx 2022-07-13 18:36:48 +02:00
parent 2d33c28f6b
commit 116eb3c867
2 changed files with 55 additions and 19 deletions

View File

@ -9,7 +9,7 @@ module.exports = (config) => {
for (let page of pages) {
if (page.data.sort) {
if (sorted[page.data.sort]) {
sorted.splice(page.data.sort)
sorted.splice(page.data.sort, 0, page)
} else {
sorted[page.data.sort] = page
}
@ -21,25 +21,25 @@ module.exports = (config) => {
return sorted.concat(unsorted)
})
// custom filters
config.addFilter("makeLowercase", (value) => {
// custom filters
config.addFilter("makeLowercase", (value) => {
if (typeof value === 'string' || value instanceof String) {
return value.toLowerCase()
}
})
})
// added passthrough for global assets
config.addPassthroughCopy("assets")
// added passthrough for images in their respective folders
config.addPassthroughCopy("_content/**/images/**")
// added passthrough for global assets
config.addPassthroughCopy("assets")
// added passthrough for images in their respective folders
config.addPassthroughCopy("_content/**/images/**")
// reutrn updated config
return {
// reutrn updated config
return {
dir: {
input: "_content", // content
includes: "../_includes", // templates
output: "_site", // rendered site
data: "../_data" // global data files
}
}
}
}

36
.eslintrc.json Normal file
View File

@ -0,0 +1,36 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": false,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"no-var": "error",
"semi": ["error", "never"],
"quotes": ["error", "single"],
"indent": ["error", 2],
"arrow-spacing": "error",
"array-bracket-spacing": ["error", "always"],
"array-bracket-newline": ["error", "consistent"],
"object-curly-spacing": ["error", "always"],
"object-curly-newline": ["error", { "consistent": true }],
"space-before-blocks": ["error", "always"]
},
"overrides": [
{
"files": ["./assets/**/*.js"],
"env": {
"commonjs": false,
"node": false
},
"parserOptions": {
"sourceType": "module"
}
}
]
}