From f82d4b548c3b73537d71dc068a6a0bc79e16621f Mon Sep 17 00:00:00 2001 From: Zamralik Date: Tue, 14 Jun 2022 12:48:17 +0200 Subject: [PATCH] Formatting --- .github/workflows/main.yml | 308 +++++++++++++++++----------------- .vscode/cspell.json | 84 +++++----- README.md | 17 +- npmpackagejsonlint.config.cjs | 152 ++++++++--------- tsconfig.build.cjs.json | 18 +- tsconfig.build.esm.json | 16 +- tsconfig.build.json | 22 +-- tsconfig.eslint.json | 6 +- tsconfig.json | 114 ++++++------- tsconfig.stryker.json | 10 +- 10 files changed, 373 insertions(+), 374 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 567e9b3..94727c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,164 +1,164 @@ name: main on: - push: - branches: [main, alpha, beta, next] - pull_request: - types: [opened, synchronize, reopened] + push: + branches: [main, alpha, beta, next] + pull_request: + types: [opened, synchronize, reopened] jobs: - qa-format-and-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "yarn" - - name: Install dependencies - run: yarn install --immutable - - name: Lint markdown - run: yarn markdownlint:lint - - name: Lint package.json - run: yarn packagejson:lint - - name: Check package.json library usage - run: yarn packagejson:check - - name: Spell checking with Cspell - run: yarn cspell:ci - - name: Format codebase with Prettier - run: yarn prettier:ci - - name: Lint codebase with Eslint - run: yarn eslint:ci - - name: Typecheck codebase - run: yarn ts:check - - name: Upload reports - uses: actions/upload-artifact@v3 - with: - name: eslint - path: reports/eslint - if-no-files-found: error + qa-format-and-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + - name: Install dependencies + run: yarn install --immutable + - name: Lint markdown + run: yarn markdownlint:lint + - name: Lint package.json + run: yarn packagejson:lint + - name: Check package.json library usage + run: yarn packagejson:check + - name: Spell checking with Cspell + run: yarn cspell:ci + - name: Format codebase with Prettier + run: yarn prettier:ci + - name: Lint codebase with Eslint + run: yarn eslint:ci + - name: Typecheck codebase + run: yarn ts:check + - name: Upload reports + uses: actions/upload-artifact@v3 + with: + name: eslint + path: reports/eslint + if-no-files-found: error - qa-unit-testing: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "yarn" - - name: Install dependencies - run: yarn install --immutable - - name: Run unit and intergration specs - run: yarn test:unit - - name: Upload reports - uses: actions/upload-artifact@v3 - with: - name: mocha - path: reports/mocha - if-no-files-found: error + qa-unit-testing: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + - name: Install dependencies + run: yarn install --immutable + - name: Run unit and intergration specs + run: yarn test:unit + - name: Upload reports + uses: actions/upload-artifact@v3 + with: + name: mocha + path: reports/mocha + if-no-files-found: error - qa-mutation-testing: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "yarn" - - name: Install dependencies - run: yarn install --immutable - - name: Run mutation specs - run: yarn test:mutation - # env: - # STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} - - name: Upload reports - uses: actions/upload-artifact@v3 - with: - name: stryker - path: reports/stryker - if-no-files-found: error + qa-mutation-testing: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + - name: Install dependencies + run: yarn install --immutable + - name: Run mutation specs + run: yarn test:mutation + # env: + # STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} + - name: Upload reports + uses: actions/upload-artifact@v3 + with: + name: stryker + path: reports/stryker + if-no-files-found: error - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: "yarn" - - name: Install dependencies - run: yarn install --immutable - - name: Build package - run: yarn build - - name: Upload lib - uses: actions/upload-artifact@v3 - with: - name: lib - path: lib - if-no-files-found: error + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + cache: "yarn" + - name: Install dependencies + run: yarn install --immutable + - name: Build package + run: yarn build + - name: Upload lib + uses: actions/upload-artifact@v3 + with: + name: lib + path: lib + if-no-files-found: error - # qa-sonar-cloud: - # needs: [qa-lint, qa-unit-testing] - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # - name: Use Node.js - # uses: actions/setup-node@v3 - # with: - # node-version-file: '.nvmrc' - # cache: 'yarn' - # - name: Install dependencies - # run: yarn install - # - name: Download Eslint artifact - # uses: actions/download-artifact@v3 - # with: - # name: eslint - # path: reports/eslint - # - name: Download Jest artifact - # uses: actions/download-artifact@v3 - # with: - # name: jest - # path: reports/jest - # - name: SonarCloud Scan - # uses: SonarSource/sonarcloud-github-action@master - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # qa-sonar-cloud: + # needs: [qa-lint, qa-unit-testing] + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # with: + # fetch-depth: 0 + # - name: Use Node.js + # uses: actions/setup-node@v3 + # with: + # node-version-file: '.nvmrc' + # cache: 'yarn' + # - name: Install dependencies + # run: yarn install + # - name: Download Eslint artifact + # uses: actions/download-artifact@v3 + # with: + # name: eslint + # path: reports/eslint + # - name: Download Jest artifact + # uses: actions/download-artifact@v3 + # with: + # name: jest + # path: reports/jest + # - name: SonarCloud Scan + # uses: SonarSource/sonarcloud-github-action@master + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # publish: - # needs: [build, qa-format-and-lint, qa-unit-testing, qa-mutation-testing] - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - # persist-credentials: false - # - name: Use Node.js - # uses: actions/setup-node@v3 - # with: - # node-version-file: '.nvmrc' - # cache: 'yarn' - # - name: Install dependencies - # run: yarn install - # - name: Download lib - # uses: actions/download-artifact@v3 - # with: - # name: lib - # path: lib - # - name: Semantic release - # run: yarn semantic-release - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + # publish: + # needs: [build, qa-format-and-lint, qa-unit-testing, qa-mutation-testing] + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + # with: + # fetch-depth: 0 + # persist-credentials: false + # - name: Use Node.js + # uses: actions/setup-node@v3 + # with: + # node-version-file: '.nvmrc' + # cache: 'yarn' + # - name: Install dependencies + # run: yarn install + # - name: Download lib + # uses: actions/download-artifact@v3 + # with: + # name: lib + # path: lib + # - name: Semantic release + # run: yarn semantic-release + # env: + # GH_TOKEN: ${{ secrets.GH_TOKEN }} + # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 2aa0263..022d290 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -1,44 +1,44 @@ { - "version": "0.2", - "language": "en", - "allowCompoundWords": true, - "dictionaries": ["softwareTerms", "typescript", "node", "html", "css", "bash", "npm"], - "words": [ - "browserslistrc", - "honestica", - "lcov", - "Lifen", - "mocharc", - "nocheck", - "npmrc", - "pinst", - "sonarjs", - "stylelintrc", - "webm", - "webp", - "yalc", - "Zamralik" - ], - "ignoreWords": ["cond", "nocheck", "iife", "isnan", "testem", "ehthumbs", "dccache"], - "flagWords": ["hte"], - "ignorePaths": [ - "**/node_modules/**", - "**/.husky/**", - "**/.yarn/**", - "**/.stryker-tmp/**", - "**/stats/**", - "**/docs/**", - "**/documentations/**", - "**/reports/**", - "**/coverage/**", - "**/build/**", - "**/dist/**", - "**/lib/**", - "**/.git/**", - "vscode-extension", - ".github/CODEOWNERS", - ".vscode", - "*.lock", - "CHANGELOG.md" - ] + "version": "0.2", + "language": "en", + "allowCompoundWords": true, + "dictionaries": ["softwareTerms", "typescript", "node", "html", "css", "bash", "npm"], + "words": [ + "browserslistrc", + "honestica", + "lcov", + "Lifen", + "mocharc", + "nocheck", + "npmrc", + "pinst", + "sonarjs", + "stylelintrc", + "webm", + "webp", + "yalc", + "Zamralik" + ], + "ignoreWords": ["cond", "nocheck", "iife", "isnan", "testem", "ehthumbs", "dccache"], + "flagWords": ["hte"], + "ignorePaths": [ + "**/node_modules/**", + "**/.husky/**", + "**/.yarn/**", + "**/.stryker-tmp/**", + "**/stats/**", + "**/docs/**", + "**/documentations/**", + "**/reports/**", + "**/coverage/**", + "**/build/**", + "**/dist/**", + "**/lib/**", + "**/.git/**", + "vscode-extension", + ".github/CODEOWNERS", + ".vscode", + "*.lock", + "CHANGELOG.md" + ] } diff --git a/README.md b/README.md index abf1135..3bd2dc7 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,10 @@ Asserts that the value is an array. The optional parameter `constraints` accept an object described by the following interface. ```ts -interface ArrayConstraints { - minLength?: number; - itemGuard?: (item: unknown) => item is T; +interface ArrayConstraints +{ + minLength?: number; + itemGuard?: (item: unknown) => item is T; } ``` @@ -89,7 +90,8 @@ Like `IsArray`, but asserts that the array is never empty too. static IsRecord(value: unknown): void ``` -Asserts that the value is a record: an object with no prototype, or directly using Object prototype. +Asserts that the value is a record: an object with no prototype, or directly +using Object prototype. ### IsObject @@ -200,9 +202,10 @@ Narrow down the value to being an array. The optional parameter `constraints` accept an object described by the following interface. ```ts -interface ArrayConstraints { - minLength?: number; - itemGuard?: (item: unknown) => item is T; +interface ArrayConstraints +{ + minLength?: number; + itemGuard?: (item: unknown) => item is T; } ``` diff --git a/npmpackagejsonlint.config.cjs b/npmpackagejsonlint.config.cjs index a267bce..ebd9288 100644 --- a/npmpackagejsonlint.config.cjs +++ b/npmpackagejsonlint.config.cjs @@ -1,80 +1,80 @@ const { keyOrder } = require("./prettier-package-json.config.cjs"); module.exports = { - rules: { - "require-author": "error", - "require-description": "error", - "require-license": "error", - "require-name": "error", - "require-repository": "error", - "require-version": "error", - "require-bugs": "error", - "require-homepage": "error", - "require-keywords": "error", - "bin-type": "error", - "config-type": "error", - "description-type": "error", - "devDependencies-type": "error", - "directories-type": "error", - "engines-type": "error", - "files-type": "error", - "homepage-type": "error", - "keywords-type": "error", - "license-type": "error", - "main-type": "error", - "man-type": "error", - "name-type": "error", - "preferGlobal-type": "error", - "private-type": "error", - "repository-type": "error", - "scripts-type": "error", - "version-type": "error", - "valid-values-license": ["error", ["MIT"]], - "valid-values-publishConfig": ["error", [{ access: "public", registry: " https://registry.npmjs.org" }]], - "no-restricted-dependencies": [ - "error", - [ - "@types/*", - "@commitlint/*", - "@testing-library/*", - "@babel/*", - "babel-*", - "@storybook/*", - "eslint", - "eslint-*", - "tslint", - "tslint-*", - "prettier", - "jest", - "jest-*", - "mocha", - "mocha-*", - "husky", - "lint-staged", - "typescript", - "webpack", - "webpack-*", - "rollup", - "rollup-*", - "ts-*", - "cypress", - "cypress-*", - "@cypress/*", - "react-app-rewired", - "react-scripts", - "@stryker-mutator/*", - "chai", - ], - ], - "no-restricted-pre-release-dependencies": "off", - "no-restricted-devDependencies": ["error", ["tslib", "core-js", "tslint", "tslint-*"]], - "no-restricted-pre-release-devDependencies": "off", - "prefer-alphabetical-dependencies": "error", - "prefer-alphabetical-peerDependencies": "error", - "prefer-alphabetical-bundledDependencies": "error", - "prefer-alphabetical-optionalDependencies": "error", - "prefer-property-order": ["error", keyOrder], - "name-format": "error", - "version-format": "error", - }, + rules: { + "require-author": "error", + "require-description": "error", + "require-license": "error", + "require-name": "error", + "require-repository": "error", + "require-version": "error", + "require-bugs": "error", + "require-homepage": "error", + "require-keywords": "error", + "bin-type": "error", + "config-type": "error", + "description-type": "error", + "devDependencies-type": "error", + "directories-type": "error", + "engines-type": "error", + "files-type": "error", + "homepage-type": "error", + "keywords-type": "error", + "license-type": "error", + "main-type": "error", + "man-type": "error", + "name-type": "error", + "preferGlobal-type": "error", + "private-type": "error", + "repository-type": "error", + "scripts-type": "error", + "version-type": "error", + "valid-values-license": ["error", ["MIT"]], + "valid-values-publishConfig": ["error", [{ access: "public", registry: " https://registry.npmjs.org" }]], + "no-restricted-dependencies": [ + "error", + [ + "@types/*", + "@commitlint/*", + "@testing-library/*", + "@babel/*", + "babel-*", + "@storybook/*", + "eslint", + "eslint-*", + "tslint", + "tslint-*", + "prettier", + "jest", + "jest-*", + "mocha", + "mocha-*", + "husky", + "lint-staged", + "typescript", + "webpack", + "webpack-*", + "rollup", + "rollup-*", + "ts-*", + "cypress", + "cypress-*", + "@cypress/*", + "react-app-rewired", + "react-scripts", + "@stryker-mutator/*", + "chai", + ], + ], + "no-restricted-pre-release-dependencies": "off", + "no-restricted-devDependencies": ["error", ["tslib", "core-js", "tslint", "tslint-*"]], + "no-restricted-pre-release-devDependencies": "off", + "prefer-alphabetical-dependencies": "error", + "prefer-alphabetical-peerDependencies": "error", + "prefer-alphabetical-bundledDependencies": "error", + "prefer-alphabetical-optionalDependencies": "error", + "prefer-property-order": ["error", keyOrder], + "name-format": "error", + "version-format": "error", + }, }; diff --git a/tsconfig.build.cjs.json b/tsconfig.build.cjs.json index 86c8ccb..a7f7dcf 100644 --- a/tsconfig.build.cjs.json +++ b/tsconfig.build.cjs.json @@ -1,11 +1,11 @@ { - "extends": "./tsconfig.build.json", - "compilerOptions": { - "outDir": "./lib/cjs", - "target": "ES2015", - "module": "CommonJS", - "declaration": false, - "declarationMap": false - }, - "include": ["./src/**/*"] + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "./lib/cjs", + "target": "ES2015", + "module": "CommonJS", + "declaration": false, + "declarationMap": false + }, + "include": ["./src/**/*"] } diff --git a/tsconfig.build.esm.json b/tsconfig.build.esm.json index 8d0cb1e..d84c9c8 100644 --- a/tsconfig.build.esm.json +++ b/tsconfig.build.esm.json @@ -1,10 +1,10 @@ { - "extends": "./tsconfig.build.json", - "compilerOptions": { - "outDir": "./lib/esm", - "target": "ES2020", - "module": "ES2022", - "declarationDir": "./lib/types" - }, - "include": ["./src/**/*"] + "extends": "./tsconfig.build.json", + "compilerOptions": { + "outDir": "./lib/esm", + "target": "ES2020", + "module": "ES2022", + "declarationDir": "./lib/types" + }, + "include": ["./src/**/*"] } diff --git a/tsconfig.build.json b/tsconfig.build.json index d2232a8..d2a88f3 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,13 +1,13 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "baseUrl": ".", - "declaration": true, - "declarationMap": true, - "removeComments": false, - "sourceMap": true, - "noEmit": false, - "listFiles": false, - "listEmittedFiles": true - } + "extends": "./tsconfig.json", + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "declarationMap": true, + "removeComments": false, + "sourceMap": true, + "noEmit": false, + "listFiles": false, + "listEmittedFiles": true + } } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 6599115..0419776 100755 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,8 +1,4 @@ { "extends": "./tsconfig.json", - "include": [ - ".", - "./.*", - "./**/*.json" - ] + "include": [".", "./.*", "./**/*.json"] } diff --git a/tsconfig.json b/tsconfig.json index 7a310c0..1289866 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,59 +1,59 @@ { - "compilerOptions": { - "sourceMap": false, - "noEmit": true, - "pretty": true, - "charset": "UTF-8", - "newLine": "LF", - "target": "ESNext", - "module": "ESNext", - "moduleResolution": "NodeNext", - "lib": ["ESNext"], - "skipLibCheck": true, - "allowJs": false, - "checkJs": false, - /* Code Quality */ - "allowUnreachableCode": false, - "allowUnusedLabels": false, - "alwaysStrict": true, - "exactOptionalPropertyTypes": true, - "forceConsistentCasingInFileNames": true, - "noErrorTruncation": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "noUncheckedIndexedAccess": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "strict": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "useUnknownInCatchVariables": true, - "preserveConstEnums": true, - "noStrictGenericChecks": false, - "importsNotUsedAsValues": "error", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": false - }, - "exclude": [ - "**/node_modules/**", - "**/.github/**", - "**/.husky/**", - "**/.yarn/**", - "**/.stryker-tmp/**", - "**/stats/**", - "**/docs/**", - "**/documentations/**", - "**/reports/**", - "**/coverage/**", - "**/build/**", - "**/dist/**", - "**/lib/**" - ] + "compilerOptions": { + "sourceMap": false, + "noEmit": true, + "pretty": true, + "charset": "UTF-8", + "newLine": "LF", + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "NodeNext", + "lib": ["ESNext"], + "skipLibCheck": true, + "allowJs": false, + "checkJs": false, + /* Code Quality */ + "allowUnreachableCode": false, + "allowUnusedLabels": false, + "alwaysStrict": true, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "noErrorTruncation": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + "strictBindCallApply": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "useUnknownInCatchVariables": true, + "preserveConstEnums": true, + "noStrictGenericChecks": false, + "importsNotUsedAsValues": "error", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": false + }, + "exclude": [ + "**/node_modules/**", + "**/.github/**", + "**/.husky/**", + "**/.yarn/**", + "**/.stryker-tmp/**", + "**/stats/**", + "**/docs/**", + "**/documentations/**", + "**/reports/**", + "**/coverage/**", + "**/build/**", + "**/dist/**", + "**/lib/**" + ] } diff --git a/tsconfig.stryker.json b/tsconfig.stryker.json index 5a9d151..2858f9f 100644 --- a/tsconfig.stryker.json +++ b/tsconfig.stryker.json @@ -1,7 +1,7 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "sourceMap": true - }, - "include": ["./src/**/*", "./__tests__/**/*"] + "extends": "./tsconfig.json", + "compilerOptions": { + "sourceMap": true + }, + "include": ["./src/**/*", "./__tests__/**/*"] }