From 0f35779f55a9728b364c5ad4fb93a5282d925bd6 Mon Sep 17 00:00:00 2001 From: yumiura Date: Sun, 7 Jul 2024 02:42:10 +0900 Subject: [PATCH 1/3] ignore prettiersetting src/parser. raason for autogenerate add indent --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 079923e0..1b1ea462 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ /lib /node_modules /src/dialects/*.js +/src/parser.ts changelog.hbs From 0ca12658fed333d4134cb7487a4967a13a36c583 Mon Sep 17 00:00:00 2001 From: yumiura Date: Sun, 7 Jul 2024 02:42:50 +0900 Subject: [PATCH 2/3] exec prettier check --- src/cstTransformer.ts | 2 +- src/cstVisitor.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cstTransformer.ts b/src/cstTransformer.ts index 9ef27785..e06835f5 100644 --- a/src/cstTransformer.ts +++ b/src/cstTransformer.ts @@ -29,7 +29,7 @@ export type TransformMap = Partial< export function cstTransformer(map: TransformMap): (node: Node) => T { return (node: Node) => { const fn = map[node.type] as ( - param: NodeByType + param: NodeByType<(typeof node)["type"], Node> ) => T; if (!fn) { if (!node.type) { diff --git a/src/cstVisitor.ts b/src/cstVisitor.ts index 5f04e63e..8bd837c7 100644 --- a/src/cstVisitor.ts +++ b/src/cstVisitor.ts @@ -27,7 +27,7 @@ export type FullVisitorMap = { export function cstVisitor(map: Partial): (node: Node) => void { const visit = (node: Node) => { const visitType = map[node.type] as ( - e: Extract + e: Extract ) => VisitorAction | void; // Visit the node itself From 359cedf8c5de542c7954f570d39797d61a648c30 Mon Sep 17 00:00:00 2001 From: yumiura Date: Sun, 7 Jul 2024 02:44:10 +0900 Subject: [PATCH 3/3] add prettier setting to eslint --- .eslintrc.json | 3 ++- package.json | 1 + yarn.lock | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 15ec65ba..a6c70213 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,8 @@ "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "prettier" ], "overrides": [], "parser": "@typescript-eslint/parser", diff --git a/package.json b/package.json index 2fe8577b..eb93fd02 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "auto-changelog": "^2.4.0", "benchmark": "^2.1.4", "eslint": "^8.30.0", + "eslint-config-prettier": "^9.1.0", "jest": "^29.1.2", "npm-watch": "^0.11.0", "peggy": "^3.0.2", diff --git a/yarn.lock b/yarn.lock index 6f13e32d..7c17c3e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1342,6 +1342,11 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +eslint-config-prettier@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"