Skip to content

Commit

Permalink
feat: copy typescript rules
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Jan 31, 2024
1 parent 53bfa02 commit 86cb568
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 21 deletions.
12 changes: 5 additions & 7 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"useGitignore": true,
"version": "0.2",
"language": "en",
"words": [

]
}
"useGitignore": true,
"version": "0.2",
"language": "en",
"words": []
}
33 changes: 29 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,39 @@
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint", "sonarjs"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended"],
"ignorePatterns": ["**/*.js"],
"rules": {
"prefer-arrow-callback": ["warn", { "allowNamedFunctions": true }], // Disallow arrow functions as expressions
"func-style": ["warn", "declaration", { "allowArrowFunctions": false }], // Disallow the use of function expressions
"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"],
"use-isnan": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"ignoreRestSiblings": true,
"vars": "all",
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/no-unnecessary-condition": ["error", { "allowConstantLoopConditions": true }],
"sonarjs/no-all-duplicated-branches": "error",
"sonarjs/no-collection-size-mischeck": "error",
"sonarjs/no-duplicated-branches": "error",
"sonarjs/no-element-overwrite": "error",
"sonarjs/no-identical-conditions": "error",
"sonarjs/no-identical-expressions": "error",
"@typescript-eslint/naming-convention": [
"error",
{ "selector": "typeLike", "format": ["PascalCase"] },
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.10.0'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"

- name: Install cspell
run: yarn add cspell
- name: Install cspell
run: yarn add cspell

- name: Run cspell
run: cspell "src/**/*.{ts,json}"
- name: Run cspell
run: cspell "src/**/*.{ts,json}"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-sonarjs": "^0.23.0",
"husky": "^8.0.3",
"knip": "^3.3.0",
"lint-staged": "^15.1.0",
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,15 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-sonarjs@npm:^0.23.0":
version: 0.23.0
resolution: "eslint-plugin-sonarjs@npm:0.23.0"
peerDependencies:
eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
checksum: 4f56557740ab438eee8d98e4d93363a8dadcf8d6d795a5d95e6a0b0d6335273a06c5633fe753271c6a56c14a3b0086014b8278984b5594fad5db274ec7fd7edf
languageName: node
linkType: hard

"eslint-scope@npm:^7.2.2":
version: 7.2.2
resolution: "eslint-scope@npm:7.2.2"
Expand Down Expand Up @@ -5393,6 +5402,7 @@ __metadata:
eslint: ^8.54.0
eslint-config-prettier: ^9.0.0
eslint-plugin-prettier: ^5.0.1
eslint-plugin-sonarjs: ^0.23.0
husky: ^8.0.3
knip: ^3.3.0
lint-staged: ^15.1.0
Expand Down

0 comments on commit 86cb568

Please sign in to comment.