Skip to content

Commit 69cb48d

Browse files
committed
style: use antfu's code style
1 parent 95f22e8 commit 69cb48d

25 files changed

Lines changed: 1732 additions & 396 deletions

.prettierignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 20 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
// Disable the default formatter, use eslint instead
3+
"prettier.enable": false,
4+
"editor.formatOnSave": false,
5+
6+
// Auto fix
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": "explicit",
9+
"source.organizeImports": "never"
10+
},
11+
12+
// Silent the stylistic rules in you IDE, but still auto fix them
13+
"eslint.rules.customizations": [
14+
{ "rule": "style/*", "severity": "off" },
15+
{ "rule": "format/*", "severity": "off" },
16+
{ "rule": "*-indent", "severity": "off" },
17+
{ "rule": "*-spacing", "severity": "off" },
18+
{ "rule": "*-spaces", "severity": "off" },
19+
{ "rule": "*-order", "severity": "off" },
20+
{ "rule": "*-dangle", "severity": "off" },
21+
{ "rule": "*-newline", "severity": "off" },
22+
{ "rule": "*quotes", "severity": "off" },
23+
{ "rule": "*semi", "severity": "off" }
24+
],
25+
26+
// Enable eslint for all supported languages
27+
"eslint.validate": [
28+
"javascript",
29+
"javascriptreact",
30+
"typescript",
31+
"typescriptreact",
32+
"vue",
33+
"html",
34+
"markdown",
35+
"json",
36+
"jsonc",
37+
"yaml",
38+
"toml",
39+
"xml",
40+
"gql",
41+
"graphql",
42+
"astro",
43+
"css",
44+
"less",
45+
"scss",
46+
"pcss",
47+
"postcss"
48+
]
49+
}

eslint.config.js

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-
// @ts-check Let TS check this config file
2-
import eslint from "@eslint/js";
3-
import tseslint from "typescript-eslint";
1+
// eslint.config.mjs
2+
import antfu from "@antfu/eslint-config";
43

5-
export default tseslint.config(
6-
{
7-
ignores: ["build/**", "dist/**", "node_modules/**", "scripts/"],
8-
},
9-
{
10-
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
11-
rules: {
12-
"@typescript-eslint/ban-ts-comment": [
13-
"warn",
14-
{
15-
"ts-expect-error": "allow-with-description",
16-
"ts-ignore": "allow-with-description",
17-
"ts-nocheck": "allow-with-description",
18-
"ts-check": "allow-with-description",
19-
},
20-
],
21-
"@typescript-eslint/no-unused-vars": "off",
22-
"@typescript-eslint/no-explicit-any": [
23-
"off",
24-
{
25-
ignoreRestArgs: true,
26-
},
27-
],
28-
"@typescript-eslint/no-non-null-assertion": "off",
4+
export default antfu({
5+
javascript: {
6+
overrides: {
7+
"no-console": "off",
298
},
309
},
31-
);
10+
typescript: true,
11+
stylistic: {
12+
semi: true,
13+
quotes: "double",
14+
},
15+
formatters: true,
16+
});

package.json

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
{
22
"name": "zotero-plugin-scaffold",
3+
"type": "module",
34
"version": "0.0.32",
5+
"packageManager": "pnpm@9.5.0",
46
"description": "A scaffold for Zotero plugin development.",
5-
"scripts": {
6-
"dev": "unbuild --stub",
7-
"build": "tsc --noEmit && unbuild",
8-
"lint": "eslint . & prettier --check .",
9-
"lint:fix": "eslint --fix . & prettier --write .",
10-
"release": "bumpp --commit \"chore(release): publish v%s\"",
11-
"update:deps": "pnpx taze minor -w -f -l",
12-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"author": "northword",
8+
"license": "AGPL-3.0-or-later",
9+
"homepage": "https://github.com/northword/zotero-plugin-scaffold#readme",
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/northword/zotero-plugin-scaffold.git"
1313
},
14-
"type": "module",
14+
"bugs": {
15+
"url": "https://github.com/northword/zotero-plugin-scaffold/issues"
16+
},
17+
"keywords": [
18+
"zotero",
19+
"plugin",
20+
"developer",
21+
"scaffold",
22+
"web-ext"
23+
],
1524
"exports": {
1625
".": {
1726
"types": "./dist/index.d.ts",
@@ -27,23 +36,18 @@
2736
"files": [
2837
"dist"
2938
],
30-
"keywords": [
31-
"zotero",
32-
"plugin",
33-
"developer",
34-
"scaffold",
35-
"web-ext"
36-
],
37-
"author": "northword",
38-
"license": "AGPL-3.0-or-later",
39-
"repository": {
40-
"type": "git",
41-
"url": "https://github.com/northword/zotero-plugin-scaffold.git"
39+
"engines": {
40+
"node": ">=18"
4241
},
43-
"bugs": {
44-
"url": "https://github.com/northword/zotero-plugin-scaffold/issues"
42+
"scripts": {
43+
"dev": "unbuild --stub",
44+
"build": "tsc --noEmit && unbuild",
45+
"lint": "eslint .",
46+
"lint:fix": "eslint . --fix",
47+
"release": "bumpp --commit \"chore(release): publish v%s\"",
48+
"update:deps": "pnpx taze minor -w -f -l",
49+
"test": "echo \"Error: no test specified\" && exit 1"
4550
},
46-
"homepage": "https://github.com/northword/zotero-plugin-scaffold#readme",
4751
"publishConfig": {
4852
"access": "public",
4953
"registry": "https://registry.npmjs.org"
@@ -52,10 +56,6 @@
5256
"lib": "dist",
5357
"doc": "docs"
5458
},
55-
"engines": {
56-
"node": ">=18"
57-
},
58-
"packageManager": "pnpm@9.5.0",
5959
"dependencies": {
6060
"@inquirer/prompts": "5.1.2",
6161
"bumpp": "9.4.1",
@@ -78,14 +78,13 @@
7878
"web-ext": "8.2.0"
7979
},
8080
"devDependencies": {
81-
"@trivago/prettier-plugin-sort-imports": "4.3.0",
81+
"@antfu/eslint-config": "^2.23.0",
8282
"@types/fs-extra": "11.0.4",
8383
"@types/node": "20.14.10",
8484
"@types/update-notifier": "6.0.8",
8585
"eslint": "9.6.0",
86-
"prettier": "3.3.2",
86+
"eslint-plugin-format": "^0.1.2",
8787
"typescript": "5.5.3",
88-
"typescript-eslint": "8.0.0-alpha.39",
8988
"unbuild": "2.0.0"
9089
},
9190
"pnpm": {

0 commit comments

Comments
 (0)