Skip to content

Commit 4947b67

Browse files
committed
chore: fix formatting so eslint and prettier work together reliably
Addsthe eslint-plugin-prettier, so eslint and prettier work together. Add rerun of eslint without fix to break on errors.
1 parent 7d7409f commit 4947b67

File tree

4 files changed

+98
-8
lines changed

4 files changed

+98
-8
lines changed

editv1.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isSetAttributes } from './editv2';
1+
import { isSetAttributes } from './editv2.js';
22

33
/** Intent to `parent.insertBefore(node, reference)` */
44
export type Insert = {
@@ -57,7 +57,9 @@ export type EditEvent<E extends Edit = Edit> = CustomEvent<E>;
5757

5858
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5959
export function isEdit(edit: any): edit is Edit {
60-
if (isComplex(edit)) return !edit.some(e => !isEdit(e));
60+
if (isComplex(edit)) {
61+
return !edit.some(e => !isEdit(e));
62+
}
6163

6264
return (
6365
!isSetAttributes(edit) &&

editv2.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export function isInsert(edit: EditV2): edit is Insert {
6666

6767
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6868
export function isEditV2(edit: any): edit is EditV2 {
69-
if (isComplex(edit)) return !edit.some(e => !isEditV2(e));
69+
if (isComplex(edit)) {
70+
return !edit.some(e => !isEditV2(e));
71+
}
7072

7173
return (
7274
isSetAttributes(edit) ||

package-lock.json

Lines changed: 81 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"types": "./dist/oscd-api.d.ts",
88
"scripts": {
99
"lint": "eslint . && prettier \"**/*.ts\" --check --ignore-path .gitignore",
10-
"format": "eslint . --fix && prettier \"**/*.ts\" --write --ignore-path .gitignore",
10+
"format": "eslint ./*.ts --fix",
1111
"test": "npm run build && wtr --coverage",
1212
"test:watch": "npm run build && concurrently -k -r \"tsc -b --watch --preserveWatchOutput\" \"wtr --watch --coverage\"",
1313
"build": "npx rimraf dist && tsc --pretty",
@@ -48,6 +48,7 @@
4848
"concurrently": "^9.0.1",
4949
"eslint": "^8.57.0",
5050
"eslint-config-prettier": "^9.1.0",
51+
"eslint-plugin-prettier": "^5.4.1",
5152
"eslint-plugin-tsdoc": "^0.4.0",
5253
"husky": "^9.1.7",
5354
"lint-staged": "^16.1.0",
@@ -66,11 +67,14 @@
6667
},
6768
"extends": [
6869
"@open-wc",
69-
"prettier"
70+
"prettier",
71+
"plugin:prettier/recommended"
7072
],
7173
"ignorePatterns": [
72-
"*/**/*.js",
73-
"*/**/*.d.ts"
74+
"dist/",
75+
"node_modules",
76+
"coverage",
77+
"doc"
7478
],
7579
"plugins": [
7680
"@typescript-eslint",
@@ -141,7 +145,8 @@
141145
"lint-staged": {
142146
"*.ts": [
143147
"eslint --fix --config package.json",
144-
"prettier --write"
148+
"prettier --write",
149+
"eslint --config package.json"
145150
]
146151
}
147152
}

0 commit comments

Comments
 (0)