mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
feat: add ESLint and update linting errors (#26)
* Install ESLint and Astro ESLint plugin * Configure 2 plugins * Improve ignore files * Add lint script * Install astro-eslint-parser * Add parser and fix linting errors
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
.husky
|
||||||
|
.vscode
|
||||||
|
node_modules
|
||||||
|
public
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
es2022: true,
|
||||||
|
browser: true,
|
||||||
|
},
|
||||||
|
extends: ["eslint:recommended", "plugin:astro/recommended"],
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: "latest",
|
||||||
|
sourceType: "module",
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["*.astro"],
|
||||||
|
parser: "astro-eslint-parser",
|
||||||
|
parserOptions: {
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
extraFileExtensions: [".astro"],
|
||||||
|
},
|
||||||
|
rules: {},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
+1
-1
@@ -9,5 +9,5 @@
|
|||||||
!astro.config.mjs
|
!astro.config.mjs
|
||||||
!package.json
|
!package.json
|
||||||
!.prettierrc
|
!.prettierrc
|
||||||
!.eslintrc.json
|
!.eslintrc.js
|
||||||
!README.md
|
!README.md
|
||||||
Generated
+1594
-22
File diff suppressed because it is too large
Load Diff
+6
-1
@@ -12,7 +12,8 @@
|
|||||||
"format:check": "prettier --check .",
|
"format:check": "prettier --check .",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
"cz": "cz",
|
"cz": "cz",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install",
|
||||||
|
"lint": "eslint ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/rss": "^2.1.0",
|
"@astrojs/rss": "^2.1.0",
|
||||||
@@ -31,8 +32,12 @@
|
|||||||
"@tailwindcss/typography": "^0.5.9",
|
"@tailwindcss/typography": "^0.5.9",
|
||||||
"@types/github-slugger": "^1.3.0",
|
"@types/github-slugger": "^1.3.0",
|
||||||
"@types/react": "^18.0.27",
|
"@types/react": "^18.0.27",
|
||||||
|
"@typescript-eslint/parser": "^5.50.0",
|
||||||
|
"astro-eslint-parser": "^0.11.0",
|
||||||
"commitizen": "^4.3.0",
|
"commitizen": "^4.3.0",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
|
"eslint": "^8.33.0",
|
||||||
|
"eslint-plugin-astro": "^0.23.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"lint-staged": "^13.1.0",
|
"lint-staged": "^13.1.0",
|
||||||
"prettier": "^2.8.3",
|
"prettier": "^2.8.3",
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const { activeNav } = Astro.props;
|
|||||||
const secondLine = document.querySelector("#second-line ")?.classList;
|
const secondLine = document.querySelector("#second-line ")?.classList;
|
||||||
const thirdLine = document.querySelector("#third-line")?.classList;
|
const thirdLine = document.querySelector("#third-line")?.classList;
|
||||||
|
|
||||||
menuBtn!.addEventListener("click", function (event) {
|
menuBtn?.addEventListener("click", function () {
|
||||||
const menuExpanded = menuBtn?.getAttribute("aria-expanded");
|
const menuExpanded = menuBtn?.getAttribute("aria-expanded");
|
||||||
if (menuExpanded === "false") {
|
if (menuExpanded === "false") {
|
||||||
menuBtn?.setAttribute("aria-expanded", "true");
|
menuBtn?.setAttribute("aria-expanded", "true");
|
||||||
|
|||||||
Reference in New Issue
Block a user