forked from aptos-labs/identity-connect-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workspace] Imported shared config packages
- Loading branch information
1 parent
c195aea
commit cfeb8fd
Showing
16 changed files
with
4,239 additions
and
0 deletions.
There are no files selected for viewing
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,97 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
node_modules | ||
**/node_modules/ | ||
coverage | ||
**/coverage | ||
build | ||
.DS_Store | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.yarn-integrity | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
*.zip | ||
|
||
# Xcode | ||
# | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
apps/mobile/xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
ios/.xcode.env.local | ||
|
||
# Android/IntelliJ | ||
# | ||
apps/mobile/.idea | ||
apps/mobile/.gradle | ||
apps/mobile/local.properties | ||
*.iml | ||
*.hprof | ||
|
||
# BUCK | ||
apps/mobile/buck-out/ | ||
apps/mobile/.buckd/ | ||
*.keystore | ||
apps/mobile/!debug.keystore | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
# screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/ | ||
|
||
**/fastlane/report.xml | ||
**/fastlane/Preview.html | ||
**/fastlane/screenshots | ||
**/fastlane/test_output | ||
|
||
# Bundle artifact | ||
apps/mobile/*.jsbundle | ||
|
||
# Ruby / CocoaPods | ||
apps/mobile/ios/Pods/ | ||
apps/mobile/vendor/bundle/ | ||
|
||
# Turborepo | ||
.turbo | ||
**/.turbo | ||
.next/** | ||
**/*.log | ||
**/out/ | ||
|
||
# Webpack profiler | ||
stats.json | ||
apps/extension/dist | ||
|
||
# JetBrains IDE | ||
.idea | ||
|
||
# Playwright | ||
test-results | ||
playwright-report | ||
e2e/.cache | ||
|
||
# eslint | ||
.eslintcache | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
dist/ |
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,17 @@ | ||
# Identity Connect Docs | ||
|
||
This is a public repository for Identity Connect, that will contain docs, examples and source code for the SDKs. | ||
|
||
This monorepo uses `turborepo`. | ||
|
||
## Getting started | ||
|
||
1. Install `node.js` | ||
2. Clone the repo | ||
3. run `yarn install` from the root directory | ||
|
||
## Packages | ||
|
||
- `eslint-config`: `eslint` configurations | ||
- `tsconfig`: `tsconfig.json`s used throughout the monorepo | ||
|
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,37 @@ | ||
{ | ||
"name": "identity-connect-docs", | ||
"version": "0.0.0", | ||
"private": true, | ||
"workspaces": { | ||
"packages": [ | ||
"examples/*", | ||
"packages/*" | ||
] | ||
}, | ||
"scripts": { | ||
"build": "turbo run build", | ||
"lint": "turbo run lint", | ||
"lint:fix": "turbo run lint:fix", | ||
"test": "turbo run test", | ||
"format": "prettier --write \"**/*.{ts,tsx,md}\"" | ||
}, | ||
"devDependencies": { | ||
"@identity-connect/eslint-config": "*", | ||
"@identity-connect/eslint-plugin": "*", | ||
"dotenv": "^16.0.3", | ||
"eslint": "^8.21.0", | ||
"prettier": "latest", | ||
"syncpack": "^8.4.11", | ||
"turbo": "latest", | ||
"typescript": "5.0.4" | ||
}, | ||
"engines": { | ||
"npm": ">=7.0.0", | ||
"node": ">=14.0.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
"resolutions": { | ||
"typescript": "5.0.4" | ||
}, | ||
"prettier": "@identity-connect/prettier-config" | ||
} |
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,76 @@ | ||
// Copyright (c) Aptos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module.exports = { | ||
env: { | ||
es2021: true, | ||
jest: true, | ||
}, | ||
extends: ['airbnb', 'airbnb-typescript', 'plugin:typescript-sort-keys/recommended'], | ||
ignorePatterns: ['dist/**/*', '*.css', '*.jsx'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
project: ['tsconfig.json', 'tsconfig.build.json'], | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
}, | ||
plugins: [ | ||
'@identity-connect', | ||
'@typescript-eslint', | ||
'react', | ||
'react-hooks', | ||
'sort-class-members', | ||
'sort-destructure-keys', | ||
'sort-keys-fix', | ||
'header', | ||
], | ||
rules: { | ||
'@typescript-eslint/brace-style': 'off', | ||
'@typescript-eslint/indent': 'off', | ||
'@typescript-eslint/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }], | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'variableLike', | ||
modifiers: ['unused'], | ||
format: ['camelCase', 'PascalCase', 'UPPER_CASE'], | ||
leadingUnderscore: 'allow', | ||
}, | ||
], | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
// allow unused variables that start with an underscore | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], | ||
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }], | ||
'function-paren-newline': 'off', | ||
'header/header': [2, 'line', [' Copyright © Aptos', ' SPDX-License-Identifier: Apache-2.0'], 2], | ||
'implicit-arrow-linebreak': 'off', | ||
'import/prefer-default-export': 'off', | ||
'max-classes-per-file': 'off', | ||
'max-len': ['error', { code: 120 }], | ||
'no-confusing-arrow': 'off', | ||
'no-continue': 'off', | ||
// Replacing airbnb rule with following, to re-enable 'ForOfStatement' | ||
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], | ||
'no-underscore-dangle': 'off', | ||
// Allow prepending statements with void to explicitly ignore the return value | ||
'no-void': ['error', { allowAsStatement: true }], | ||
'object-curly-newline': 'off', | ||
'operator-linebreak': 'off', | ||
'react/require-default-props': 0, | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react/jsx-closing-tag-location': 'off', | ||
'react/jsx-curly-newline': 'off', | ||
'react/jsx-indent': 'off', | ||
'react/jsx-one-expression-per-line': 'off', | ||
'react/jsx-props-no-spreading': 'off', | ||
'react/jsx-wrap-multilines': 'off', | ||
'sort-destructure-keys/sort-destructure-keys': 2, | ||
'sort-keys-fix/sort-keys-fix': 'warn', | ||
'sort-keys': ['error', 'asc', { caseSensitive: true, minKeys: 2, natural: false }], | ||
'newline-per-chained-call': ['off'], | ||
}, | ||
}; |
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,25 @@ | ||
{ | ||
"name": "@identity-connect/eslint-config", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "index.js", | ||
"dependencies": { | ||
"@identity-connect/eslint-plugin": "*", | ||
"@typescript-eslint/eslint-plugin": "^5.51.0", | ||
"@typescript-eslint/parser": "^5.51.0", | ||
"eslint": "^8.33.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-airbnb-typescript": "^17.0.0", | ||
"eslint-plugin-header": "^3.1.1", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jsx-a11y": "^6.6.1", | ||
"eslint-plugin-promise": "^6.0.0", | ||
"eslint-plugin-react": "^7.30.1", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"eslint-plugin-sort-class-members": "^1.14.1", | ||
"eslint-plugin-sort-destructure-keys": "^1.4.0", | ||
"eslint-plugin-sort-keys-fix": "^1.1.2", | ||
"eslint-plugin-typescript-sort-keys": "^2.3.0", | ||
"typescript": "5.0.4" | ||
} | ||
} |
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,8 @@ | ||
// Copyright (c) Aptos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module.exports = { | ||
rules: { | ||
'no-client-date': require('./rules/no-client-date'), | ||
}, | ||
}; |
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,15 @@ | ||
{ | ||
"name": "@identity-connect/eslint-plugin", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^8.33.0" | ||
}, | ||
"devDependencies": { | ||
"jest": "^29.5.0" | ||
} | ||
} |
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,43 @@ | ||
// Copyright (c) Aptos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module.exports = { | ||
meta: { | ||
type: 'problem', | ||
docs: { | ||
description: 'Use server time instead of client time', | ||
}, | ||
fixable: 'code', | ||
messages: { | ||
dateNow: 'Use getServerTime() instead of Date.now().', | ||
newDate: 'Use getServerDate() instead of new Date().', | ||
}, | ||
}, | ||
create(context) { | ||
return { | ||
CallExpression(node) { | ||
const { object, property } = node.callee; | ||
if (object?.name === 'Date' && property?.name === 'now') { | ||
context.report({ | ||
node, | ||
messageId: 'dateNow', | ||
fix: (fixer) => { | ||
return fixer.replaceText(node, 'getServerTime()'); | ||
}, | ||
}); | ||
} | ||
}, | ||
NewExpression(node) { | ||
if (node.callee.name === 'Date' && node.arguments.length === 0) { | ||
context.report({ | ||
node, | ||
messageId: 'newDate', | ||
fix: (fixer) => { | ||
return fixer.replaceText(node, 'getServerDate()'); | ||
}, | ||
}); | ||
} | ||
}, | ||
}; | ||
}, | ||
}; |
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,32 @@ | ||
// Copyright (c) Aptos | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
const { RuleTester } = require('eslint'); | ||
const noClientDateRule = require('./no-client-date'); | ||
|
||
const ruleTester = new RuleTester(); | ||
ruleTester.run('no-client-date', noClientDateRule, { | ||
valid: [ | ||
{ | ||
code: 'getServerDate()', | ||
}, | ||
{ | ||
code: 'getServerTime()', | ||
}, | ||
{ | ||
code: 'new Date(timestamp)', | ||
}, | ||
], | ||
invalid: [ | ||
{ | ||
code: 'Date.now()', | ||
errors: [{ messageId: 'dateNow' }], | ||
output: 'getServerTime()', | ||
}, | ||
{ | ||
code: 'new Date()', | ||
errors: [{ messageId: 'newDate' }], | ||
output: 'getServerDate()', | ||
}, | ||
], | ||
}); |
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 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/prettierrc", | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 120 | ||
} |
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 @@ | ||
{ | ||
"name": "@identity-connect/prettier-config", | ||
"version": "0.0.0", | ||
"private": true, | ||
"main": "index.json" | ||
} |
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,3 @@ | ||
# `tsconfig` | ||
|
||
These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from. |
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,18 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "es2021", | ||
"lib": [ | ||
"es2021" | ||
], | ||
"module": "esnext", | ||
"moduleResolution": "node", | ||
"isolatedModules": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"skipLibCheck": true, | ||
"noEmitOnError": true | ||
} | ||
} |
Oops, something went wrong.