diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7a9d74e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.go] +indent_style = tab + +[Makefile] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 1e602b0..ae66203 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,6 @@ resources/ # Node.js dependencies node_modules/ -package-lock.json # Hugo build artifacts public/ diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..ee09fac --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20.11.1 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7ef555f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +node_modules +exampleSite/public +exampleSite/resources +public +resources +.hugo_build.lock +flake.lock +package-lock.json +*.min.js +*.min.css +static/bibtex diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..15049be --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,13 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "tabWidth": 2, + "useTabs": false, + "endOfLine": "lf", + "overrides": [ + { "files": "*.md", "options": { "printWidth": 80, "proseWrap": "preserve" } }, + { "files": "*.html", "options": { "parser": "html" } } + ] +} diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..b38ddd1 --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,5 @@ +node_modules +exampleSite/public +public +resources +**/*.min.css diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..48d0d71 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,9 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "declaration-no-important": [true, { "severity": "warning" }], + "custom-property-pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$", + "selector-class-pattern": null, + "no-descending-specificity": null + } +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..381fc6b --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,25 @@ +import js from '@eslint/js'; +import globals from 'globals'; + +export default [ + js.configs.recommended, + { + languageOptions: { + ecmaVersion: 2023, + sourceType: 'module', + globals: { ...globals.browser, ...globals.node }, + }, + rules: { + 'prefer-const': 'warn', + 'no-var': 'warn', + eqeqeq: ['warn', 'smart'], + 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], + 'no-console': ['warn', { allow: ['warn', 'error'] }], + }, + }, + { + files: ['scripts/**/*.js'], + languageOptions: { sourceType: 'commonjs' }, + }, + { ignores: ['node_modules', 'exampleSite/public', 'public', 'resources', '**/*.min.js'] }, +]; diff --git a/package.json b/package.json index f97fe40..604907c 100644 --- a/package.json +++ b/package.json @@ -5,23 +5,33 @@ "private": true, "scripts": { "build": "hugo --gc --minify", - "build:advanced": "npm run build && npm run optimize-images && npm run seo-audit", "dev": "hugo server --disableFastRender --navigateToChanged", "optimize-images": "node scripts/optimize-images.js", - "seo-audit": "node scripts/seo-audit.js", - "validate-seo": "node scripts/validate-seo.js" + "lint": "eslint assets/js scripts && stylelint 'assets/css/**/*.css'", + "lint:fix": "eslint --fix assets/js scripts && stylelint --fix 'assets/css/**/*.css'", + "format": "prettier --write 'assets/**/*.{js,css,md}' 'layouts/**/*.html' 'scripts/**/*.js' '**/*.md'", + "format:check": "prettier --check 'assets/**/*.{js,css,md}' 'layouts/**/*.html' 'scripts/**/*.js' '**/*.md'" }, "devDependencies": { - "sharp": "^0.34.0", + "@eslint/js": "^9.0.0", + "autoprefixer": "^10.4.0", + "cheerio": "^1.0.0", + "eslint": "^9.0.0", + "globals": "^15.0.0", "glob": "^11.0.0", - "cheerio": "^1.0.0" + "postcss": "^8.4.0", + "postcss-preset-env": "^9.5.0", + "prettier": "^3.2.0", + "sharp": "^0.34.0", + "stylelint": "^16.0.0", + "stylelint-config-standard": "^36.0.0" }, "engines": { - "node": ">=18.17.0" + "node": ">=20.0.0" }, "repository": { "type": "git", - "url": "https://github.com/your-username/pkb-theme" + "url": "https://github.com/stradichenko/PKB-theme" }, "keywords": [ "hugo", diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..ec964bc --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + autoprefixer: {}, + 'postcss-preset-env': { stage: 2 }, + }, +};