This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add prettier and linting rules
- Loading branch information
1 parent
30f3620
commit 16aecb9
Showing
24 changed files
with
1,811 additions
and
287 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"], | ||
"header-max-length": 50, | ||
"body-max-line-length": 80, | ||
"footer-max-length": 50 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,83 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"root": true, | ||
"ignorePatterns": ["out", "dist", "**/*.d.ts"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": ["tsconfig.json"], | ||
"ecmaVersion": 6, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"@typescript-eslint/naming-convention": "warn", | ||
"@typescript-eslint/semi": "warn", | ||
"curly": "warn", | ||
"eqeqeq": "warn", | ||
"no-throw-literal": "warn", | ||
"semi": "off" | ||
}, | ||
"ignorePatterns": [ | ||
"out", | ||
"dist", | ||
"**/*.d.ts" | ||
] | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"no-console": "error", | ||
"prefer-const": "error", | ||
"func-style": ["error", "declaration", { "allowArrowFunctions": true }], | ||
"no-param-reassign": "error", | ||
"no-else-return": "error", | ||
"max-len": [ | ||
"error", | ||
{ | ||
"code": 100, | ||
"ignoreStrings": true, | ||
"ignoreUrls": true, | ||
"ignoreTemplateLiterals": true, | ||
"ignoreRegExpLiterals": true | ||
} | ||
], | ||
"class-methods-use-this": "error", | ||
"no-magic-numbers": "off", // must disable the base rule as it can report incorrect errors | ||
"@typescript-eslint/no-magic-numbers": [ | ||
"error", | ||
{ "ignore": [0, 1], "ignoreDefaultValues": true } | ||
], | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ "argsIgnorePattern": "^_" } | ||
], | ||
"@typescript-eslint/array-type": "error", | ||
"@typescript-eslint/no-unnecessary-condition": "error", | ||
"@typescript-eslint/no-unnecessary-qualifier": "error", | ||
"@typescript-eslint/no-unnecessary-type-arguments": "error", | ||
"@typescript-eslint/prefer-for-of": "error", | ||
"@typescript-eslint/prefer-function-type": "error", | ||
"@typescript-eslint/prefer-includes": "error", | ||
"@typescript-eslint/prefer-nullish-coalescing": "error", | ||
"@typescript-eslint/prefer-optional-chain": "error", | ||
"@typescript-eslint/prefer-readonly": "error", | ||
"@typescript-eslint/prefer-as-const": "error", | ||
"@typescript-eslint/prefer-string-starts-ends-with": "error", | ||
"@typescript-eslint/prefer-ts-expect-error": "error", | ||
"@typescript-eslint/promise-function-async": [ | ||
"error", | ||
{ "checkArrowFunctions": false } | ||
], | ||
"@typescript-eslint/member-ordering": [ | ||
"error", | ||
{ | ||
"default": [ | ||
"static-field", | ||
"abstract-field", | ||
"instance-field", | ||
"decorated-field", | ||
"constructor", | ||
"static-method", | ||
"abstract-method", | ||
"instance-method", | ||
"decorated-method" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint | ||
run: npm run lint | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm install | ||
- run: xvfb-run -a npm test | ||
if: runner.os == 'Linux' | ||
- run: npm test | ||
if: runner.os != 'Linux' | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- run: npm ci | ||
- run: xvfb-run -a npm test | ||
if: runner.os == 'Linux' | ||
- run: npm test | ||
if: runner.os != 'Linux' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged | ||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"*.ts": "eslint --cache --fix", | ||
"*.{js,ts,scss,css,html,md,yml,json}": "prettier --write" | ||
} |
Oops, something went wrong.