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

Feature add typescript support #58

Open
wants to merge 8 commits into
base: development
Choose a base branch
from
Open
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
37 changes: 37 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"plugin:react/recommended",
"airbnb",
"prettier",
"plugin:prettier/recommended",
"plugin:import/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["react", "@typescript-eslint", "prettier"],
rules: {
"prettier/prettier": "error",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
// Temporary disabled because eslint is currently not working with "@" imports (e.g. "@theme" by docusaurus) - other eslint import plugins did not fix this issue
"import/no-unresolved": ["off", { extensions: [".tsx"] }],
"react/jsx-filename-extension": ["warn", { extensions: [".ts", ".tsx"] }],
},
overrides: [
{
files: ["*.md", "*.mdx"],
parser: "eslint-mdx",
extends: "plugin:mdx/recommended",
},
],
};
30 changes: 0 additions & 30 deletions .eslintrc.json

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/yarn.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Website Yarn Build

on: [create, push, pull_request, workflow_dispatch]
on: [push, pull_request, workflow_dispatch]

jobs:
build:
Expand All @@ -20,12 +20,16 @@ jobs:
install-command: yarn --frozen-lockfile
- name: Check codestyle
uses: wearerequired/lint-action@v1
if: ${{ github.repository == 'CloudNetService/website' }}
with:
eslint: true
eslint_extensions: js,jsx,md,mdx
eslint_extensions: js,jsx,md,mdx,ts,tsx
prettier: true
prettier_extensions: js,jsx,css,md,mdx
prettier_extensions: js,jsx,css,md,mdx,ts,tsx
neutral_check_on_warning: true
- name: Check codestyle on external repositories
if: ${{ github.repository != 'CloudNetService/website' }}
run: yarn test
- name: Sync translations
env:
CROWDIN_PROJECT_ID: 4
Expand Down
1 change: 1 addition & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
### Docusaurus
.docusaurus/
build/

### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ module.exports = {
label: "CloudNet v3.3",
path: "3.3",
},
/*"2.2": {
/* "2.2": {
"label": "CloudNet v2",
"path": "2.2"
}*/
} */
},
lastVersion: "3.4",
showLastUpdateTime: true,
Expand Down
23 changes: 17 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"crowdin:sync": "docusaurus write-translations && crowdin upload && crowdin download",
"test:lint": "eslint . --ext js,jsx,md,mdx",
"test:lint": "eslint . --ext js,jsx,md,mdx,ts,tsx",
"test:style": "prettier --check .",
"test": "yarn run test:lint && yarn run test:style"
},
Expand All @@ -31,13 +31,24 @@
"react-select": "^4.3.1"
},
"devDependencies": {
"@types/eslint": "7.28.0",
"@types/eslint-config-prettier": "6.11.0",
"@types/prettier": "2.3.2",
"@docusaurus/module-type-aliases": "^2.0.0-beta.4",
"@tsconfig/docusaurus": "^1.0.2",
"@types/react": "^17.0.14",
"@types/react-helmet": "^6.1.2",
"@types/react-router-dom": "^5.1.8",
"@types/react-select": "^4.0.17",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "8.3.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-mdx": "^1.14.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"prettier": "2.3.2"
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.3.2",
"typescript": "^4.3.5"
}
}
Loading