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

chore(init): Setup #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Dependencies
.yarn/
node_modules/

# Auto-generated
build/
dist/
252 changes: 252 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
{
"root": true,
"env": {
"browser": true,
"es6": true,
"node": true
},
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json"
}
},
"react": {
"version": "detect"
}
},
"parserOptions": {
"ecmaVersion": "latest",
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"eslint-plugin-react",
"etc",
"react-hooks",
"sonarjs"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:etc/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:sonarjs/recommended"
],
"overrides": [{
"files": "*.ts?(x)",
"parser": "@typescript-eslint/parser"
}, {
"files": "*.test.ts?(x)",
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"etc/throw-error": "off"
}
}, {
"files": "*.typetest.ts?(x)",
"rules": {
"@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": false }],
"etc/throw-error": "off"
}
}, {
"files": "*.js?(x)",
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/restrict-template-expressions": "off"
}
}],
"rules": {
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/member-ordering": ["error", {
"classes": [
"static-field",
"field",
"constructor",
"static-method",
"abstract-method",
"protected-method",
"public-method",
"private-method"
],
"interfaces": { "order": "alphabetically" },
"typeLiterals": { "order": "alphabetically" }
}],
"@typescript-eslint/member-delimiter-style": ["error", {
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": true
}
}],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": ["error", { "ignoreRestArgs": true }],
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-inferrable-types": ["error", {
"ignoreParameters": true,
"ignoreProperties": true
}],
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-redundant-type-constituents": "error",
"@typescript-eslint/no-shadow": ["error", { "hoist": "all" }],
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
"@typescript-eslint/no-unused-vars": ["error", {
"destructuredArrayIgnorePattern": "^_",
"ignoreRestSiblings": true
}],
"@typescript-eslint/no-use-before-define": ["error", {
"functions": false,
"classes": false
}],
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/parameter-properties": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": ["error", "double", {
"avoidEscape": true,
"allowTemplateLiterals": false
}],
"@typescript-eslint/restrict-template-expressions": ["error", {
"allowNumber": true,
"allowBoolean": true,
"allowNullish": true
}],
"@typescript-eslint/semi": "error",
"@typescript-eslint/space-infix-ops": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": ["error", { "ignoreStatic": true }],
"@typescript-eslint/unified-signatures": "error",
"array-bracket-spacing": "error",
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"brace-style": "error",
"camelcase": "error",
"comma-spacing": "error",
"computed-property-spacing": "error",
"constructor-super": "error",
"curly": "error",
"etc/no-commented-out-code": "error",
"etc/throw-error": "error",
"eol-last": "error",
"eqeqeq": "error",
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
"import/newline-after-import": "error",
"import/no-absolute-path": "error",
"import/no-cycle": ["error", {
"allowUnsafeDynamicCyclicDependency": true,
"ignoreExternal": true
}],
"import/no-duplicates": "error",
"import/no-import-module-exports": "error",
"import/no-namespace": "error",
"import/no-relative-packages": "error",
"import/no-unresolved": "error",
"import/no-useless-path-segments": "error",
"import/order": ["error", {
"alphabetize": {
"caseInsensitive": false,
"order": "asc"
},
"newlines-between": "always",
"groups": ["external", "parent", "sibling"]
}],
"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": ["error", { "excludeTags": ["example", "param", "returns"] }],
"jsdoc/tag-lines": ["error", "any", { "startLines": 1 }],
"jsx-quotes": "error",
"keyword-spacing": "error",
"linebreak-style": "error",
"max-classes-per-file": ["error", 1],
"max-len": ["error", {
"code": 120,
"comments": 80,
"ignoreRegExpLiterals": true,
"ignorePattern": "^import (\\{ )?\\w+( \\})? from \".+\";$",
"ignoreUrls": true,
"tabWidth": 2
}],
"new-parens": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-duplicate-imports": "error",
"no-empty-function": "error",
"no-eval": "error",
"no-extra-boolean-cast": ["error", { "enforceForLogicalOperands": true }],
"no-invalid-this": "error",
"no-labels": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0, "maxBOF": 0 }],
"no-multi-spaces": "error",
"no-new-wrappers": "error",
"no-param-reassign": "error",
"no-tabs": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-underscore-dangle": "error",
"no-use-before-define": "off",
"no-useless-computed-key": ["error", { "enforceForClassMembers": true }],
"no-var": "error",
"object-curly-spacing": ["error", "always"],
"object-shorthand": "error",
"one-var": ["error", "never"],
"prefer-const": "error",
"quote-props": ["error", "as-needed"],
"radix": "error",
"rest-spread-spacing": "error",
"react/display-name": "off",
"react/hook-use-state": "error",
"react/jsx-boolean-value": ["error", "always"],
"react/jsx-closing-bracket-location": "error",
"react/jsx-curly-spacing": ["error", { "when": "never" }],
"react/jsx-equals-spacing": ["error", "never"],
"react/jsx-max-props-per-line": ["error", {
"maximum": 1,
"when": "multiline"
}],
"react/jsx-no-bind": "error",
"react/jsx-no-literals": "error",
"react/jsx-tag-spacing": "error",
"react/prop-types": "off",
"react/self-closing-comp": "error",
"react-hooks/rules-of-hooks": "error",
"semi-spacing": "error",
"sonarjs/cognitive-complexity": "off",
"sonarjs/no-duplicate-string": "off",
"sonarjs/no-inverted-boolean-check": "error",
"sort-keys": "error",
"space-before-blocks": "error",
"space-in-parens": "error",
"spaced-comment": "error",
"switch-colon-spacing": "error"
}
}
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# all other files
* eol=lf

# specific for windows script files
*.bat text eol=crlf
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: CI

on:
push:
workflow_call:

concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [16, 17, 18, 19, 20]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: yarn
- run: yarn install --immutable
- run: yarn compile
- run: yarn lint
# - run: yarn test
18 changes: 18 additions & 0 deletions .github/workflows/owner-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Auto approve for owner

on:
push:
pull_request:
types: [opened, reopened]

jobs:
approve:
if: github.actor == github.repository_owner
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Release

on:
workflow_dispatch:

concurrency:
group: release
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/ci.yml

deploy:
runs-on: ubuntu-latest
needs: [build]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: yarn
- run: yarn install --immutable
- run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# pages:
# uses: ./.github/workflows/pages.yml
# needs: [deploy]
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Turborepo
.turbo/

# Node.js
node_modules/
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Generated
build/
dist/

# VSCode
.vscode/

# Logs
*.log
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.4.0
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-engines.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-engines",
factory: function (require) {
var plugin=(()=>{var P=Object.create,f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var b=n=>f(n,"__esModule",{value:!0});var i=n=>{if(typeof require!="undefined")return require(n);throw new Error('Dynamic require of "'+n+'" is not supported')};var T=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of N(e))!Y.call(n,t)&&t!=="default"&&f(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(b(f(n!=null?P(j(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var U={};T(U,{default:()=>q});var o=s(i("@yarnpkg/core")),c;(function(r){r.Yarn="Yarn",r.Console="Console"})(c||(c={}));var h=class{constructor(e){this.throwWrongEngineError=(e,r)=>{let t=this.formatErrorMessage(e,r);this.throwError(t)};this.throwError=e=>{switch(this.errorReporter){case c.Yarn:this.reportYarnError(e);break;case c.Console:default:this.reportConsoleError(e);break}};this.reportYarnError=e=>{throw new o.ReportError(o.MessageName.UNNAMED,e)};this.reportConsoleError=e=>{console.error(e),process.exit(1)};this.formatErrorMessage=(e,r)=>{let{configuration:t}=this.project,p=o.formatUtils.applyStyle(t,o.formatUtils.pretty(t,this.engine,"green"),2),g=o.formatUtils.pretty(t,e,"cyan"),d=o.formatUtils.pretty(t,r,"cyan"),w=`The current ${p} version ${g} does not satisfy the required version ${d}.`;return o.formatUtils.pretty(t,w,"red")};this.project=e.project,this.errorReporter=e.errorReporter}};var m=s(i("fs")),y=s(i("path")),l=s(i("semver")),k=s(i("@yarnpkg/fslib")),a=s(i("@yarnpkg/core"));var v=class extends h{constructor(){super(...arguments);this.resolveNvmRequiredVersion=()=>{let{configuration:e,cwd:r}=this.project,t=(0,y.resolve)(k.npath.fromPortablePath(r),".nvmrc"),p=a.formatUtils.applyStyle(e,a.formatUtils.pretty(e,this.engine,"green"),2);if(!(0,m.existsSync)(t)){this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The .nvmrc file does not exist.`,"red"));return}let g=(0,m.readFileSync)(t,"utf-8").trim();if((0,l.validRange)(g))return g;let d=a.formatUtils.pretty(e,".nvmrc","yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The ${d} file contains an invalid semver range.`,"red"))}}get engine(){return"Node"}verifyEngine(e){let r=e.node;r!=null&&(r===".nvmrc"&&(r=this.resolveNvmRequiredVersion()),(0,l.satisfies)(process.version,r,{includePrerelease:!0})||this.throwWrongEngineError(process.version.replace(/^v/i,""),r.replace(/^v/i,"")))}};var x=s(i("semver")),E=s(i("@yarnpkg/core"));var u=class extends h{get engine(){return"Yarn"}verifyEngine(e){let r=e.yarn;r!=null&&((0,x.satisfies)(E.YarnVersion,r,{includePrerelease:!0})||this.throwWrongEngineError(E.YarnVersion,r))}};var C=n=>e=>{if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{engines:r={}}=e.getWorkspaceByCwd(e.cwd).manifest.raw,t={project:e,errorReporter:n};[new v(t),new u(t)].forEach(g=>g.verifyEngine(r))},S={hooks:{validateProject:C(c.Yarn),setupScriptEnvironment:C(c.Console)}},q=S;return U;})();
return plugin;
}
};
Loading
Loading