Skip to content

Commit 49519d1

Browse files
committed
chore: complete ESLint v9 configuration
1 parent 8bf72fc commit 49519d1

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

eslint.config.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
1-
export default [
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import js from '@eslint/js';
3+
import globals from 'globals';
4+
5+
export default defineConfig([
6+
globalIgnores(['assets/*', 'node_modules/*', '_site/*']),
7+
js.configs.recommended,
28
{
3-
files: ['_javascript/**/*.js']
9+
rules: {
10+
semi: ['error', 'always'],
11+
quotes: ['error', 'single']
12+
},
13+
languageOptions: {
14+
globals: {
15+
...globals.browser,
16+
...globals.node
17+
}
18+
}
19+
},
20+
{
21+
files: ['_javascript/**/*.js'],
22+
languageOptions: {
23+
globals: {
24+
ClipboardJS: 'readonly',
25+
GLightbox: 'readonly',
26+
Theme: 'readonly',
27+
dayjs: 'readonly',
28+
mermaid: 'readonly',
29+
tocbot: 'readonly',
30+
importScripts: 'readonly',
31+
swconf: 'readonly'
32+
}
33+
}
434
}
5-
];
35+
]);

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
"url": "https://github.com/cotes2020/jekyll-theme-chirpy/issues"
1414
},
1515
"homepage": "https://github.com/cotes2020/jekyll-theme-chirpy/",
16+
"type": "module",
1617
"scripts": {
1718
"build": "concurrently npm:build:*",
1819
"build:css": "node purgecss.js",
1920
"build:js": "rollup -c --bundleConfigAsCjs --environment BUILD:production",
2021
"watch:js": "rollup -c --bundleConfigAsCjs -w",
22+
"lint:js": "eslint",
2123
"lint:scss": "stylelint _sass/**/*.scss",
2224
"lint:fix:scss": "npm run lint:scss -- --fix",
23-
"test": "npm run lint:scss",
25+
"test": "npm run lint:js && npm run lint:scss",
2426
"prepare": "husky"
2527
},
2628
"dependencies": {
@@ -42,6 +44,8 @@
4244
"@semantic-release/git": "^10.0.1",
4345
"concurrently": "^9.1.2",
4446
"conventional-changelog-conventionalcommits": "^8.0.0",
47+
"eslint": "^9.27.0",
48+
"globals": "^16.1.0",
4549
"husky": "^9.1.7",
4650
"purgecss": "^7.0.2",
4751
"rollup": "^4.41.0",

purgecss.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const fs = require('fs').promises;
2-
const { PurgeCSS } = require('purgecss');
1+
import { promises as fs } from 'fs';
2+
import { PurgeCSS } from 'purgecss';
3+
34
const DIST_PATH = '_sass/vendors';
45
const output = `${DIST_PATH}/_bootstrap.scss`;
56

0 commit comments

Comments
 (0)