Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use eslint-plugin-filename-rules #23

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 134 additions & 19 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,53 @@
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
"project": [
"./tsconfig.json"
]
},
"plugins": ["@typescript-eslint", "sonarjs"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
"ignorePatterns": ["**/*.js"],
"plugins": [
"@typescript-eslint",
"sonarjs",
"filename-rules"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:sonarjs/recommended"
],
"ignorePatterns": [
"**/*.js"
],
"rules": {
"prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }],
"func-style": ["warn", "declaration", { "allowArrowFunctions": false }],
"filename-rules/match": [
2,
"kebabcase",
"kebab-case"
],
"prefer-arrow-callback": [
"warn",
{
"allowNamedFunctions": true
}
],
"func-style": [
"warn",
"declaration",
{
"allowArrowFunctions": false
}
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"constructor-super": "error",
"no-invalid-this": "off",
"@typescript-eslint/no-invalid-this": ["error"],
"no-restricted-syntax": ["error", "ForInStatement"],
"@typescript-eslint/no-invalid-this": [
"error"
],
"no-restricted-syntax": [
"error",
"ForInStatement"
],
"use-isnan": "error",
"no-unneeded-ternary": "error",
"no-nested-ternary": "error",
Expand All @@ -40,16 +73,98 @@
"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": "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": "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": "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"
]
}
]
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/cypress-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run Cypress testing suite
on:
workflow_dispatch:
pull_request:
types: [ opened, synchronize ]
types: [opened, synchronize]

jobs:
cypress-run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Keyrxng marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"esbuild": "^0.20.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-filename-rules": "^1.3.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sonarjs": "^0.24.0",
"husky": "^9.0.11",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3376,6 +3376,11 @@ eslint-config-prettier@^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-plugin-filename-rules@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-filename-rules/-/eslint-plugin-filename-rules-1.3.1.tgz#8fb769f2c19dc832b43c13d76c1442bca4a2f4a4"
integrity sha512-kBMxGFvK3QrRBHMurhFSNa+PFdszezVtBV6egg39TDzlj6D4jL3Xx6oyNjm5xE4C+TdQUBzWwymHJHBPyxOreA==

eslint-plugin-prettier@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz#17cfade9e732cef32b5f5be53bd4e07afd8e67e1"
Expand Down
Loading