From 1e2ac44ed4743df297e9c3f45b782d588ce73912 Mon Sep 17 00:00:00 2001 From: jordan-ae Date: Fri, 19 Apr 2024 12:35:55 +0100 Subject: [PATCH 1/4] chore: add pascal case linter to enforce Erc20Permit and Erc721Permit naming conventions --- .eslintrc | 10 +++++++++- .github/workflows/cypress-testing.yml | 2 +- .github/workflows/jest-testing.yml | 4 ++-- .github/workflows/release-please.yml | 2 +- README.md | 5 +++++ tsconfig.json | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.eslintrc b/.eslintrc index ae05460..51a8eb9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -49,7 +49,15 @@ { "selector": "variable", "modifiers": ["destructured"], "format": null }, { "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] }, { "selector": "variableLike", "format": ["camelCase"] }, - { "selector": ["function", "variable"], "format": ["camelCase"] } + { "selector": ["function", "variable"], "format": ["camelCase"] }, + { + "selector": "variable", + "format": ["PascalCase"], + "filter": { + "regex": "^(Erc20Permit|Erc721Permit)$", + "match": true + } + } ] } } diff --git a/.github/workflows/cypress-testing.yml b/.github/workflows/cypress-testing.yml index eadd68e..1cf9d5a 100644 --- a/.github/workflows/cypress-testing.yml +++ b/.github/workflows/cypress-testing.yml @@ -2,7 +2,7 @@ name: Run Cypress testing suite on: workflow_dispatch: pull_request: - types: [ opened, synchronize ] + types: [opened, synchronize] jobs: cypress-run: diff --git a/.github/workflows/jest-testing.yml b/.github/workflows/jest-testing.yml index 1671cd4..a7e36fa 100644 --- a/.github/workflows/jest-testing.yml +++ b/.github/workflows/jest-testing.yml @@ -2,7 +2,7 @@ name: Run Jest testing suite on: workflow_dispatch: pull_request_target: - types: [ opened, synchronize ] + types: [opened, synchronize] env: NODE_ENV: "test" @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: '20.10.0' + node-version: "20.10.0" - uses: actions/checkout@master with: fetch-depth: 0 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 75d28f0..a5b40f7 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v4 with: - node-version: '20.10.0' + node-version: "20.10.0" registry-url: https://registry.npmjs.org/ - run: | yarn install --immutable --immutable-cache --check-cache diff --git a/README.md b/README.md index fb15148..7b0867a 100644 --- a/README.md +++ b/README.md @@ -10,18 +10,23 @@ This template repository includes support for the following: ## Testing ### Cypress + To test with Cypress Studio UI, run + ```shell yarn cy:open ``` Otherwise to simply run the tests through the console, run + ```shell yarn cy:run ``` ### Jest + To start Jest tests, run + ```shell yarn test ``` diff --git a/tsconfig.json b/tsconfig.json index f9ab3da..c6d3097 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -104,7 +104,7 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */, "resolveJsonModule": true } } From 66e9fe83e45ccb5a9d7ae19d507e41584c4d7a5e Mon Sep 17 00:00:00 2001 From: jordan-ae Date: Tue, 23 Apr 2024 02:39:33 +0100 Subject: [PATCH 2/4] chore: enable StrictPascalCase on all Identifiers --- .eslintrc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.eslintrc b/.eslintrc index 51a8eb9..43cb02e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -40,24 +40,16 @@ "sonarjs/no-identical-expressions": "error", "@typescript-eslint/naming-convention": [ "error", - { "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } }, - { "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" }, - { "selector": "typeLike", "format": ["PascalCase"] }, - { "selector": "typeParameter", "format": ["PascalCase"], "prefix": ["T"] }, - { "selector": "variable", "format": ["camelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, - { "selector": "variable", "format": ["camelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, + { "selector": "interface", "format": ["StrictPascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } }, + { "selector": "memberLike", "modifiers": ["private"], "format": ["StrictPascalCase"], "leadingUnderscore": "require" }, + { "selector": "typeLike", "format": ["StrictPascalCase"] }, + { "selector": "typeParameter", "format": ["StrictPascalCase"], "prefix": ["T"] }, + { "selector": "variable", "format": ["StrictPascalCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, + { "selector": "variable", "format": ["StrictPascalCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, { "selector": "variable", "modifiers": ["destructured"], "format": null }, { "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] }, - { "selector": "variableLike", "format": ["camelCase"] }, - { "selector": ["function", "variable"], "format": ["camelCase"] }, - { - "selector": "variable", - "format": ["PascalCase"], - "filter": { - "regex": "^(Erc20Permit|Erc721Permit)$", - "match": true - } - } + { "selector": "variableLike", "format": ["StrictPascalCase"] }, + { "selector": ["function", "variable"], "format": ["StrictPascalCase"] } ] } } From 9385bab27707b0e96b810f52146d63d005958b27 Mon Sep 17 00:00:00 2001 From: jordan-ae Date: Mon, 29 Apr 2024 03:11:04 +0100 Subject: [PATCH 3/4] chore: undo unnecessary changes --- .github/workflows/cypress-testing.yml | 2 +- .github/workflows/jest-testing.yml | 4 ++-- .github/workflows/release-please.yml | 2 +- README.md | 7 +------ tsconfig.json | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cypress-testing.yml b/.github/workflows/cypress-testing.yml index 1cf9d5a..eadd68e 100644 --- a/.github/workflows/cypress-testing.yml +++ b/.github/workflows/cypress-testing.yml @@ -2,7 +2,7 @@ name: Run Cypress testing suite on: workflow_dispatch: pull_request: - types: [opened, synchronize] + types: [ opened, synchronize ] jobs: cypress-run: diff --git a/.github/workflows/jest-testing.yml b/.github/workflows/jest-testing.yml index a7e36fa..1671cd4 100644 --- a/.github/workflows/jest-testing.yml +++ b/.github/workflows/jest-testing.yml @@ -2,7 +2,7 @@ name: Run Jest testing suite on: workflow_dispatch: pull_request_target: - types: [opened, synchronize] + types: [ opened, synchronize ] env: NODE_ENV: "test" @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: "20.10.0" + node-version: '20.10.0' - uses: actions/checkout@master with: fetch-depth: 0 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index a5b40f7..75d28f0 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v4 with: - node-version: "20.10.0" + node-version: '20.10.0' registry-url: https://registry.npmjs.org/ - run: | yarn install --immutable --immutable-cache --check-cache diff --git a/README.md b/README.md index 7b0867a..01b981c 100644 --- a/README.md +++ b/README.md @@ -10,23 +10,18 @@ This template repository includes support for the following: ## Testing ### Cypress - To test with Cypress Studio UI, run - ```shell yarn cy:open ``` Otherwise to simply run the tests through the console, run - ```shell yarn cy:run ``` ### Jest - To start Jest tests, run - ```shell yarn test -``` +``` \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index c6d3097..f9ab3da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -104,7 +104,7 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */, + "skipLibCheck": true, /* Skip type checking all .d.ts files. */ "resolveJsonModule": true } } From 850886a618282f14518c39beab52baf9a5a03d70 Mon Sep 17 00:00:00 2001 From: jordan-ae Date: Thu, 2 May 2024 14:43:02 +0100 Subject: [PATCH 4/4] revert camelCase deletions and change to strictCamelCase --- .eslintrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.eslintrc b/.eslintrc index 43cb02e..4e0a67d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -41,15 +41,15 @@ "@typescript-eslint/naming-convention": [ "error", { "selector": "interface", "format": ["StrictPascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } }, - { "selector": "memberLike", "modifiers": ["private"], "format": ["StrictPascalCase"], "leadingUnderscore": "require" }, + { "selector": "memberLike", "modifiers": ["private"], "format": ["strictCamelCase"], "leadingUnderscore": "require" }, { "selector": "typeLike", "format": ["StrictPascalCase"] }, { "selector": "typeParameter", "format": ["StrictPascalCase"], "prefix": ["T"] }, - { "selector": "variable", "format": ["StrictPascalCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, - { "selector": "variable", "format": ["StrictPascalCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, + { "selector": "variable", "format": ["strictCamelCase", "UPPER_CASE"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, + { "selector": "variable", "format": ["strictCamelCase"], "leadingUnderscore": "allow", "trailingUnderscore": "allow" }, { "selector": "variable", "modifiers": ["destructured"], "format": null }, - { "selector": "variable", "types": ["boolean"], "format": ["PascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] }, - { "selector": "variableLike", "format": ["StrictPascalCase"] }, - { "selector": ["function", "variable"], "format": ["StrictPascalCase"] } + { "selector": "variable", "types": ["boolean"], "format": ["StrictPascalCase"], "prefix": ["is", "should", "has", "can", "did", "will", "does"] }, + { "selector": "variableLike", "format": ["strictCamelCase"] }, + { "selector": ["function", "variable"], "format": ["strictCamelCase"] } ] } }