tr-core-lib v2.0.15
TR-CORE 1
Unofficial JavaScript SDK for the transresult api. Written in Typescript.
Prerequisites (installation and usage)
(1) globally install typescript @types/node und eslint to your maschine
um vscode mit typescript, eslint und prettier zu nutzen sollte typescript und eslint global installiert sein
npm install -g eslint typescript @types/node
(2) recommended VSCODE Extentions
darüber hinaus sollten die folgenden extentions in vscode installiert sein
Installation and usage
A) TYPESCRIPT
Konfiguration devDependancy npm
typescript und die types als devDependance installieren
npm install typescript @types/node --save-dev
tsconfig.json erstellen
npx tsc --init --rootDir src --outDir dist --esModuleInterop --resolveJsonModule --lib es6 --module commonjs --allowJs true --noImplicitAny true
B) typescript+ESLINT
Konfiguration devDependancy npm
npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
echo {} >> .eslintrc.json
mkdir src
echo "console.log('hello');" > src/index.ts
echo {"extends": "../tsconfig.json","include": ["./**/*.ts"]} > src/tsconfig.json
danach kommt dann die Frage ob man global
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
// Do not search for further eslint configs in upper directories
"root": true,
"rules": {
"no-console": 1,
}
}
C) typescript+eslint+PRETTIER
Konfiguration devDependancy npm
Install eslint-config-prettier:
npm install --save-dev eslint-config-prettier
Then, add eslint-config-prettier to the "extends" array in your .eslintrc.*
file. Make sure to put it last, so it gets the chance to override other
configs.
eslint-config-prettier#installation
There's also a recommended configuration for VSCode.
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint"
],
// Do not search for further eslint configs in upper directories
"root": true,
"rules": {
"no-console": 1
}
}
eslint-config-peerigon You can also combine these linting rules with Prettier (see below). There's also a recommended configuration for VSCode.
D) code ersteleln
codine in src ablegen (build in dist)
mkdir src
echo console.log('Hello ') >> src/index.ts
echo console.log('world!') >> src/index.ts
E) package.json anpassen
...
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [ "dist" ],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint src --ext js,ts",
"build": "tsc -p src/tsconfig.json",
"build:dev": "tsc --watch --preserveWatchOutput",
"start": "node dist/index.js"
},
"keywords": [],
"author": "develop@transresult.de",
"license": "ISC",
...
Konfigurieren release-IT
- INSTALL npm install dotenv --save-dev
- INSTALL npm init release-it
- Obtain a personal access token (release-it only needs "repo" access; no "admin" or other scopes).
Examples creating npm packages
- 1903-How to publish packages to npm (the way the industry does things)
- 1810-Build and publish your first NPM package
- 1803-Step by step: Building and publishing an NPM Typescript package.
Prettier peerigon
https://github.com/peerigon/eslint-config-peerigon
https://developer.aliyun.com/mirror/npm/package/eslint-config-peerigon
There is a Prettier config in this repository that
corresponds to our linting rules as much as possible. Add a .prettierrc
file
to your repository with the following content:
"eslint-config-peerigon/prettier"
Please note that our linting rules will complain about specific code snippets
coming from Prettier. We recommend running eslint --fix
afterwards.
VSCode
This is our recommended VSCode configuration using the Prettier extension. Adjust it to the needs of your particular project:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
--> not workinbg
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"prettier.eslintIntegration": true,
"prettier.tslintIntegration": false,
"prettier.requireConfig": true
}
License
Unlicense
Credits
Thank you to all the people who have already contributed to Vue.js!
Sponsors
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago