1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-10-20 17:53:45 +00:00

chore: complete ESLint v9 configuration

This commit is contained in:
Cotes Chung 2025-07-26 20:49:56 +08:00
parent 8bf72fc234
commit 49519d13e5
No known key found for this signature in database
GPG Key ID: 0D9E54843167A808
3 changed files with 41 additions and 6 deletions

View File

@ -1,5 +1,35 @@
export default [ import { defineConfig, globalIgnores } from 'eslint/config';
import js from '@eslint/js';
import globals from 'globals';
export default defineConfig([
globalIgnores(['assets/*', 'node_modules/*', '_site/*']),
js.configs.recommended,
{ {
files: ['_javascript/**/*.js'] rules: {
semi: ['error', 'always'],
quotes: ['error', 'single']
},
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['_javascript/**/*.js'],
languageOptions: {
globals: {
ClipboardJS: 'readonly',
GLightbox: 'readonly',
Theme: 'readonly',
dayjs: 'readonly',
mermaid: 'readonly',
tocbot: 'readonly',
importScripts: 'readonly',
swconf: 'readonly'
}
}
} }
]; ]);

View File

@ -13,14 +13,16 @@
"url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues" "url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues"
}, },
"homepage": "https://github.com/cotes2020/jekyll-theme-chirpy/", "homepage": "https://github.com/cotes2020/jekyll-theme-chirpy/",
"type": "module",
"scripts": { "scripts": {
"build": "concurrently npm:build:*", "build": "concurrently npm:build:*",
"build:css": "node purgecss.js", "build:css": "node purgecss.js",
"build:js": "rollup -c --bundleConfigAsCjs --environment BUILD:production", "build:js": "rollup -c --bundleConfigAsCjs --environment BUILD:production",
"watch:js": "rollup -c --bundleConfigAsCjs -w", "watch:js": "rollup -c --bundleConfigAsCjs -w",
"lint:js": "eslint",
"lint:scss": "stylelint _sass/**/*.scss", "lint:scss": "stylelint _sass/**/*.scss",
"lint:fix:scss": "npm run lint:scss -- --fix", "lint:fix:scss": "npm run lint:scss -- --fix",
"test": "npm run lint:scss", "test": "npm run lint:js && npm run lint:scss",
"prepare": "husky" "prepare": "husky"
}, },
"dependencies": { "dependencies": {
@ -42,6 +44,8 @@
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"concurrently": "^9.1.2", "concurrently": "^9.1.2",
"conventional-changelog-conventionalcommits": "^8.0.0", "conventional-changelog-conventionalcommits": "^8.0.0",
"eslint": "^9.27.0",
"globals": "^16.1.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"purgecss": "^7.0.2", "purgecss": "^7.0.2",
"rollup": "^4.41.0", "rollup": "^4.41.0",

View File

@ -1,5 +1,6 @@
const fs = require('fs').promises; import { promises as fs } from 'fs';
const { PurgeCSS } = require('purgecss'); import { PurgeCSS } from 'purgecss';
const DIST_PATH = '_sass/vendors'; const DIST_PATH = '_sass/vendors';
const output = `${DIST_PATH}/_bootstrap.scss`; const output = `${DIST_PATH}/_bootstrap.scss`;