Skip to content

Commit

Permalink
Merge pull request #164 from kieler/nre/prettier
Browse files Browse the repository at this point in the history
Prettier
  • Loading branch information
NiklasRentzCAU authored Jan 12, 2024
2 parents 4db9d95 + 28fd509 commit 0bd5f86
Show file tree
Hide file tree
Showing 113 changed files with 5,668 additions and 3,799 deletions.
32 changes: 28 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"ecmaVersion": 13,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint", "prettier", "import"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "airbnb-base", "prettier" ],
"rules": {
"prettier/prettier": 2, // Means error
"import/extensions": [0, "never"],
"no-plusplus": 0,
"import/no-unresolved": [2, { "ignore": ["vscode"] }],
"import/prefer-default-export": 0,
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.[jt]s", "**/*.test.[jt]sx", "**/*.spec.[jt]s"]}],
"no-useless-constructor": 0,
"no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"],
"max-classes-per-file": 0,
"no-use-before-define": 0,
"no-underscore-dangle": 0,
"no-restricted-globals": 0,
"no-nested-ternary": 0,
"no-param-reassign": 0,
"no-shadow": 0,
"@typescript-eslint/no-shadow": 2,
"class-methods-use-this": 0,
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-namespace": "off",
Expand All @@ -21,5 +38,12 @@
}
]
},
"ignorePatterns": ["**/*.d.ts", "lib", "dist", "pack", "webpack.config.js"]
"ignorePatterns": ["**/*.d.ts", "lib", "dist", "pack", "webpack.config.js"],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ jobs:
with:
node-version: 16.x
- run: yarn
- run: yarn lint
- run: yarn build
- run: yarn lint
- run: yarn test
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"useTabs": false,
"tabWidth": 4,
"printWidth": 120
}
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
136 changes: 69 additions & 67 deletions applications/klighd-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,71 @@
{
"name": "@kieler/klighd-cli",
"version": "0.4.2",
"description": "Standalone web view for klighd-core diagrams",
"author": "KIELER <[email protected]>",
"license": "EPL-2.0",
"keywords": [
"sprotty",
"klighd",
"diagram",
"standalone"
],
"main": "./lib/server.js",
"bin": "./lib/klighd.js",
"files": [
"lib",
"dist"
],
"scripts": {
"clean": "rimraf lib dist bin",
"lint": "eslint .",
"build": "run-p --print-label \"build:*\"",
"build:app": "webpack --mode production --devtool hidden-source-map",
"build:server": "tsc -p ./tsconfig.server.json",
"watch": "run-p --print-label \"watch:*\"",
"watch:app": "webpack --watch",
"watch:server": "tsc -w -p ./tsconfig.server.json",
"prepackage": "cross-var replace \"@VERSION@\" $npm_package_version ./lib/version.js",
"package": "pkg -c pkg.json ./lib/klighd.js",
"start": "node ./lib/main.js",
"socket": "node ./lib/main.js --ls_port=5007"
},
"dependencies": {
"@kieler/klighd-core": "^0.4.2",
"buffer": "^6.0.3",
"commander": "^8.1.0",
"crypto-browserify": "^3.12.0",
"fastify": "^3.15.0",
"fastify-static": "^4.0.1",
"fastify-websocket": "^3.1.0",
"get-port": "^5.1.1",
"net": "^1.0.2",
"open": "^7.4.2",
"os-browserify": "^0.3.0",
"pino-pretty": "^4.7.1",
"reflect-metadata": "^0.2.1",
"setimmediate": "^1.0.5",
"stream-browserify": "^3.0.0",
"vscode-languageserver-protocol": "^3.17.5",
"vscode-ws-jsonrpc": "^0.2.0"
},
"devDependencies": {
"@types/ws": "^7.4.4",
"clean-webpack-plugin": "^4.0.0",
"cross-var": "^1.1.0",
"css-loader": "^6.8.1",
"file-loader": "6.2.0",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.7.6",
"node-polyfill-webpack-plugin": "^3.0.0",
"npm-run-all": "^4.1.5",
"pkg": "^5.8.1",
"replace": "^1.2.2",
"rimraf": "^4.4.0",
"ts-loader": "^9.5.1",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
"name": "@kieler/klighd-cli",
"version": "0.4.2",
"description": "Standalone web view for klighd-core diagrams",
"author": "KIELER <[email protected]>",
"license": "EPL-2.0",
"keywords": [
"sprotty",
"klighd",
"diagram",
"standalone"
],
"main": "./lib/server.js",
"bin": "./lib/klighd.js",
"files": [
"lib",
"dist"
],
"scripts": {
"clean": "rimraf lib dist bin",
"lint": "eslint .",
"build": "run-p --print-label \"build:*\"",
"build:app": "webpack --mode production --devtool hidden-source-map",
"build:server": "tsc -p ./tsconfig.server.json",
"watch": "run-p --print-label \"watch:*\"",
"watch:app": "webpack --watch",
"watch:server": "tsc -w -p ./tsconfig.server.json",
"prepackage": "cross-var replace \"@VERSION@\" $npm_package_version ./lib/version.js",
"package": "pkg -c pkg.json ./lib/klighd.js",
"start": "node ./lib/main.js",
"socket": "node ./lib/main.js --ls_port=5007"
},
"dependencies": {
"@kieler/klighd-core": "^0.4.2",
"buffer": "^6.0.3",
"commander": "^8.1.0",
"crypto-browserify": "^3.12.0",
"fastify": "^3.15.0",
"fastify-static": "^4.0.1",
"fastify-websocket": "^3.1.0",
"get-port": "^5.1.1",
"net": "^1.0.2",
"open": "^7.4.2",
"os-browserify": "^0.3.0",
"pino-pretty": "^4.7.1",
"reflect-metadata": "^0.2.1",
"setimmediate": "^1.0.5",
"sprotty-protocol": "^1.1.0",
"stream-browserify": "^3.0.0",
"vscode-languageserver-protocol": "^3.17.5",
"vscode-ws-jsonrpc": "^0.2.0",
"ws": "^8.16.0"
},
"devDependencies": {
"@types/ws": "^7.4.4",
"clean-webpack-plugin": "^4.0.0",
"cross-var": "^1.1.0",
"css-loader": "^6.8.1",
"file-loader": "6.2.0",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.7.6",
"node-polyfill-webpack-plugin": "^3.0.0",
"npm-run-all": "^4.1.5",
"pkg": "^5.8.1",
"replace": "^1.2.2",
"rimraf": "^4.4.0",
"ts-loader": "^9.5.1",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
}
10 changes: 5 additions & 5 deletions applications/klighd-cli/server/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

/** Parses a string or undefined as an integer. */
export function parseIntOrUndefined(number?: string): number | undefined {
if (typeof number !== "string") return undefined;
return parseInt(number, 10);
if (typeof number !== 'string') return undefined
return parseInt(number, 10)
}

/** Parses a value for a given name from the process arguments. */
export function getArgValue(argName: string): string | undefined {
const prefix = `--${argName}=`;
const argument: string | undefined = process.argv.filter((arg) => arg.startsWith(prefix))[0];
const prefix = `--${argName}=`
const argument: string | undefined = process.argv.filter((arg) => arg.startsWith(prefix))[0]

return argument ? argument.substring(prefix.length) : undefined;
return argument ? argument.substring(prefix.length) : undefined
}
Loading

0 comments on commit 0bd5f86

Please sign in to comment.